[Python-Dev] [format] Restrict fill characters for numerical values
Hi, I think http://www.python.org/dev/peps/pep-3101/ is too liberal with the choice of fill characters for numerical values. As far as I can see, this is quite legal: Python 2.7a0 (trunk:76132M, Nov 6 2009, 15:20:35) [GCC 4.1.3 20080623 (prerelease) (Ubuntu 4.1.2-23ubuntu3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from decimal import * >>> format(Decimal(4), "9<10") '49' >>> format(Decimal(4), "9>10") '94' >>> format(Decimal(4), "->2") '-4' >>> I propose to disallow digits and '+-' fill characters for numerical values, except for the combination '0, left-padding'. Actually, I'd prefer to allow only whitespace and '0, left-padding'. See also: http://bugs.python.org/issue6871 http://bugs.python.org/issue6902 Stefan Krah ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] [format] Restrict fill characters for numerical values
Stefan Krah wrote: Hi, I think http://www.python.org/dev/peps/pep-3101/ is too liberal with the choice of fill characters for numerical values. As far as I can see, this is quite legal: Python 2.7a0 (trunk:76132M, Nov 6 2009, 15:20:35) [GCC 4.1.3 20080623 (prerelease) (Ubuntu 4.1.2-23ubuntu3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. from decimal import * format(Decimal(4), "9<10") '49' format(Decimal(4), "9>10") '94' format(Decimal(4), "->2") '-4' I propose to disallow digits and '+-' fill characters for numerical values, except for the combination '0, left-padding'. Actually, I'd prefer to allow only whitespace and '0, left-padding'. Why? What problem are you trying to prevent that would justify the extra code to implement this and the extra documentation to explain it? Eric. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] [format] Restrict fill characters for numerical values
Eric Smith wrote: > Stefan Krah wrote: > >Hi, > > > >I think http://www.python.org/dev/peps/pep-3101/ is too liberal with the > >choice of fill characters for numerical values. As far as I can see, this > >is quite legal: > > > > > >Python 2.7a0 (trunk:76132M, Nov 6 2009, 15:20:35) > >[GCC 4.1.3 20080623 (prerelease) (Ubuntu 4.1.2-23ubuntu3)] on linux2 > >Type "help", "copyright", "credits" or "license" for more information. > from decimal import * > format(Decimal(4), "9<10") > >'49' > format(Decimal(4), "9>10") > >'94' > format(Decimal(4), "->2") > >'-4' > > > > > >I propose to disallow digits and '+-' fill characters for numerical values, > >except for the combination '0, left-padding'. Actually, I'd prefer to allow > >only whitespace and '0, left-padding'. > > Why? > > What problem are you trying to prevent that would justify the extra code > to implement this and the extra documentation to explain it? I simply think that apart from rounding, the output of format should not change the numerical value of its argument. The format functions in C do not allow this to happen. Are there other languages where this is possible? Stefan Krah ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] PEP 382 status
Hi, I was wondering what's the status of PEP 382. Is anyone (MvL?) is going to start to work on its implementation for Python 2.7/3.2 inclusion ? Regards Tarek ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] [format] Restrict fill characters for numerical values
Stefan Krah wrote: > I simply think that apart from rounding, the output of format should not > change the numerical value of its argument. The format functions in C do > not allow this to happen. Are there other languages where this is possible? Actually there are other cases: strfmon() allows this, too. Let's drop it. Stefan Krah ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Replacing IDLE
On Tue, Nov 10, 2009 at 10:07 PM, Greg Ewing wrote: > Seems to me the only kind of IDE that it makes sense to > ship with Python is one that is written in Python and > maintained by the core developers. Anything else is best > left as a third party package for download by those > who want to use it. > > Tkinter is arguably not a very good basis for it from a > technical point of view, but so far all the alternatives > are too bloated and/or nonportable to consider bundling > with the standard distribution. > > So the only realistic alternatives at the moment seem > to be either IDLE+Tkinter or nothing. > My immediate reaction? What about stdwin? Then I found this: http://mail.python.org/pipermail/python-dev/2000-October/010113.html ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] [format] Restrict fill characters for numerical values
Stefan Krah wrote: Eric Smith wrote: Stefan Krah wrote: Hi, I think http://www.python.org/dev/peps/pep-3101/ is too liberal with the choice of fill characters for numerical values. As far as I can see, this is quite legal: Python 2.7a0 (trunk:76132M, Nov 6 2009, 15:20:35) [GCC 4.1.3 20080623 (prerelease) (Ubuntu 4.1.2-23ubuntu3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >from decimal import * format(Decimal(4), "9<10") '49' format(Decimal(4), "9>10") '94' format(Decimal(4), "->2") '-4' I propose to disallow digits and '+-' fill characters for numerical values, except for the combination '0, left-padding'. Actually, I'd prefer to allow only whitespace and '0, left-padding'. Why? What problem are you trying to prevent that would justify the extra code to implement this and the extra documentation to explain it? I simply think that apart from rounding, the output of format should not change the numerical value of its argument. The format functions in C do not allow this to happen. Are there other languages where this is possible? I don't know if there are other languages that allow it. But I definitely have use cases for padding with '*', for example. I don't see the point in just disallowing numbers 1 through 9. If you don't want your numbers padded with 9's, don't put a 9 in your format string. Eric. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] PEP 382 status
Tarek Ziadé wrote: I was wondering what's the status of PEP 382. Is anyone (MvL?) is going to start to work on its implementation for Python 2.7/3.2 inclusion ? If Martin isn't interested in doing it, I'll take a try at it. But I'll need some rough guidance on the implementation approach. Eric. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Is this a bug of the HTMLParser?
Hi all, I'm using BeautifulSoup to parsing an HTML page and find it refused to parse the page. By looking at the backtrace, I found it is a problem with the python built-in HTMLParser.py. In fact, the web page I'm parsing is with some Chinese characters. there is a tag like , note this is legacy html page where the attributes are not quoted. However, the regexp defined in HTMLParser.py is : attrfind = re.compile( r'\s*([a-zA-Z_][-.:a-zA-Z_0-9]*)(\s*=\s*' r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./,:;+*%?!&$\(\)_...@]*))?') Note that the Chinese character (also any other non-english characters), so it fire an error parsing this. I'm not sure whether the HTML standard allow un-quoted non-ASCII characters in the attributes. If it allows, this seems to be a bug. and the regexp to better be [^>\s] IMHO. BTW: It seems something like : var st = ""; can not be parsed. :-/ -- pluskid http://blog.pluskid.org ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Is this a bug of the HTMLParser?
Hello Zhang Chiyuan, Can you file a bug on the Python issue tracker please: http://bugs.python.org Thanks Michael Foord Zhang Chiyuan wrote: Hi all, I'm using BeautifulSoup to parsing an HTML page and find it refused to parse the page. By looking at the backtrace, I found it is a problem with the python built-in HTMLParser.py. In fact, the web page I'm parsing is with some Chinese characters. there is a tag like , note this is legacy html page where the attributes are not quoted. However, the regexp defined in HTMLParser.py is : attrfind = re.compile( r'\s*([a-zA-Z_][-.:a-zA-Z_0-9]*)(\s*=\s*' r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./,:;+*%?!&$\(\)_...@]*))?') Note that the Chinese character (also any other non-english characters), so it fire an error parsing this. I'm not sure whether the HTML standard allow un-quoted non-ASCII characters in the attributes. If it allows, this seems to be a bug. and the regexp to better be [^>\s] IMHO. BTW: It seems something like : var st = ""; can not be parsed. :-/ -- pluskid http://blog.pluskid.org ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk -- http://www.ironpythoninaction.com/ ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] IDLE as default Python editor
On Tue, Nov 10, 2009 at 5:27 PM, Georg Brandl wrote: > > Quite simple: because we can't possibly ship Emacs. > > cheers, > Georg > We just need a PyEmacs. Written in python, extensible in elist and python. Nice and simple ;-D -- -Brandon Singer ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] IDLE as default Python editor
On Wed, Nov 11, 2009 at 12:59 PM, Echo wrote: > We just need a PyEmacs. Written in python, extensible in elist and > python. Nice and simple ;-D I'd even give up the elisp support if I could have Python in my Emacs. -Fred -- Fred L. Drake, Jr. "Chaos is the score upon which reality is written." --Henry Miller ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] PEP 382 status
> I was wondering what's the status of PEP 382. Is anyone (MvL?) is > going to start to work on its implementation for Python 2.7/3.2 > inclusion ? I'll be working on an implementation, but contributions are welcome. Unfortunately, I'm really short on free software time recently (and keep hoping that this will improve). One thing that I always wondered about is the status of importlib. Will that be used in 3.2? In addition, I still owe a few answers to comments from the previous discussion. Regards, Martin ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] IDLE as default Python editor
On Wed, Nov 11, 2009 at 1:50 PM, Fred Drake wrote: > On Wed, Nov 11, 2009 at 12:59 PM, Echo wrote: >> We just need a PyEmacs. Written in python, extensible in elist and >> python. Nice and simple ;-D > I'd even give up the elisp support if I could have Python in my Emacs. Have you tried Pymacs? ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] 2.7/3.2 release schedule
Raymond Hettinger wrote: > > [MvL] >>> I personally think that decoupling the releases would be best, i.e. >>> not start thinking about 3.2 for another 6 months. > > [Benjamin] >> The problem with that is that there is a period of time where 2.x has >> features which 3.x doesn't. My preference is to move back the whole >> schedule 6 months. > > My preference is to decouple and let 2.7 go out 18 months after 2.6. > In general, 2.x users should not have to pay a price for whatever > we do with 3.x. And I guess anyone doing forward ports is likely going to be maintaining 2.6 compatibility anyway, so waiting until 3.2 comes out before using new 2.7 features wouldn't be a major burden. I think I've decided I don't mind either way, so I'm fine with whichever approach is easier for Benjamin and the platform installer builders to manage. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia --- ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] 2.7/3.2 release schedule
On Wed, Nov 11, 2009 at 1:18 PM, Nick Coghlan wrote: > I think I've decided I don't mind either way, so I'm fine with whichever > approach is easier for Benjamin and the platform installer builders to > manage. +1 -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com