Movatterモバイル変換


[0]ホーム

URL:


ANN: Experimental Number Types (Integer, Rational, Floats)

Moshe Zadkamoshez at zadka.site.co.il
Thu Apr 26 00:48:08 EDT 2001


On Wed, 25 Apr 2001 12:14:01 +0200, "M.-A. Lemburg" <mal at lemburg.com> wrote: > Still, you have valid points here and I think Moshe should consider> these in his PEP (that's why I put him on CC -- hi Moshe ;-)Thanks. I try to read c.l.py, but I sometimes miss out.I'll try to put some more words under "Open Issues". Basically,I'm not sure if I want to make the string matcher that complicated --also recognize "1.0 1/2"? "3/1 5/7"? "4/2 3/4" etc....And anyway, my PEP is behind the implementation -- this *will* be fixed,but anyone who is really interested in the future of my PEP shoulddefinitely checkout the implementation. Currently, the implementationrecognizes these types strings --1. "105"2. "105.7"3. "105.7e1"4. "105/7"5. "105.7/8.3"6. "105.7e1/8.3e-2"In other words the implementation recognizes either a single "float" literalor two "float" literals seperated by a "/". Do you want me to put something like thatdef rational(s)    if type(s) is type(''):        if ' ' in s:            nums = s.split(' ')            return reduce(operator.add, map(rational, nums))        ...That's easy enough to implement....I can also add:        if '+' in s:            nums = s.split('+')            return reduce(operator.add, map(rational, nums))That's also easy to implement....Something which is sorely missing from my PEP, but I'm not into addingright now, is correct handling of Unicode. This is probably trickierthen I think ;-)-- "I'll be ex-DPL soon anyway so I'm        |LUKE: Is Perl better than Python?looking for someplace else to grab power."|YODA: No...no... no. Quicker,   -- Wichert Akkerman (on debian-private)|      easier, more seductive.For public key, fingermoshez at debian.org  |http://www.{python,debian,gnu}.org


More information about the Python-listmailing list

[8]ページ先頭

©2009-2025 Movatter.jp