Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-19 Thread glyph
On 04:26 am, [EMAIL PROTECTED] wrote: On Jan 19, 2008 5:54 PM, <[EMAIL PROTECTED]> wrote: On 19 Jan, 07:32 pm, [EMAIL PROTECTED] wrote: Starting with the most relevant bit before getting off into digressions that may not interest most people: Why can't we get that warning in -3 mode just th

Re: [Python-Dev] Bug Day outcome

2008-01-19 Thread Guido van Rossum
On Jan 19, 2008 5:14 PM, A.M. Kuchling <[EMAIL PROTECTED]> wrote: > Today's bug day was a great success. Experienced people like Georg, > Facundo, and Gregory P. Smith participated, and we also had people who > submitted their first patches, some of which got applied today, too. > Hopefully we'll

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-19 Thread Guido van Rossum
On Jan 19, 2008 5:54 PM, <[EMAIL PROTECTED]> wrote: > On 19 Jan, 07:32 pm, [EMAIL PROTECTED] wrote: > >There is no way to know whether that return value means text or data > >(plenty of apps legitimately read text straight off a socket in 2.x), > > IMHO, this is a stretch of the word "legitimately

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-19 Thread glyph
On 19 Jan, 07:32 pm, [EMAIL PROTECTED] wrote: >There is no way to know whether that return value means text or data >(plenty of apps legitimately read text straight off a socket in 2.x), IMHO, this is a stretch of the word "legitimately" ;-). If you're reading from a socket, what you're getting

Re: [Python-Dev] Rational approximation methods

2008-01-19 Thread Mark Dickinson
On Jan 19, 2008 3:06 PM, Jeffrey Yasskin <[EMAIL PROTECTED]> wrote: > In the Rational class that I've recently checked into Python 2.6 > (http://bugs.python.org/issue1682), it might be nice to provide a > method that, given a particular rational number, returns a nearby > number that's nicer in so

[Python-Dev] Bug Day outcome

2008-01-19 Thread A.M. Kuchling
Today's bug day was a great success. Experienced people like Georg, Facundo, and Gregory P. Smith participated, and we also had people who submitted their first patches, some of which got applied today, too. Hopefully we'll see those people again. As of this writing, 37 issues were closed today

Re: [Python-Dev] Rational approximation methods

2008-01-19 Thread Scott David Daniels
Jeffrey Yasskin wrote: > The second returns the simplest rational within some distance. For > instance, it'll prefer 22/7 over 333/106 if both are close enough. We > might call it .simplest_within() for now. This seems useful for > converting from float and displaying results to users, where we pre

[Python-Dev] Rational approximation methods

2008-01-19 Thread Jeffrey Yasskin
In the Rational class that I've recently checked into Python 2.6 (http://bugs.python.org/issue1682), it might be nice to provide a method that, given a particular rational number, returns a nearby number that's nicer in some way. I know of two reasonable behaviors for this operation. Since I don't

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-19 Thread Guido van Rossum
On Jan 19, 2008 10:53 AM, Neil Schemenauer <[EMAIL PROTECTED]> wrote: > Guido van Rossum <[EMAIL PROTECTED]> wrote: > > bytes is an alias for str (not even a subclass) > > b"" is an alias for "" > > One advantage of a subclass is that there could be a flag that warns > about combining bytes and uni

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-19 Thread Neil Schemenauer
Guido van Rossum <[EMAIL PROTECTED]> wrote: > bytes is an alias for str (not even a subclass) > b"" is an alias for "" One advantage of a subclass is that there could be a flag that warns about combining bytes and unicode data. For example, b"x" + u"y" would produce a warning. As someone who wri

Re: [Python-Dev] Monkeypatching idioms -- elegant or ugly?

2008-01-19 Thread Martin v. Löwis
> In Objective-C it's perfectly common to extend existing classes using > 'categories' and I have often found this idiom very useful. What is > described here is basically categories for Python. I've implemented > something like this before and I would be happy to see this added to > the

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-19 Thread Christian Heimes
Neil Schemenauer wrote: > I like this solution because of its simplicity. I've implemented and submitted the feature yesterday: Python 2.6a0 (trunk:60048M, Jan 18 2008, 19:08:16) [GCC 4.2.1 (Ubuntu 4.2.1-5ubuntu4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-19 Thread Neil Schemenauer
Guido van Rossum <[EMAIL PROTECTED]> wrote: > This may seem trivial (because we do all the work, and 2to3 just > leaves stuff alone), but having b"" and bytes as aliases for "" and > str in 2.6 would mean that we could write 2.6 code that correctly > expresses the use of binary data -- and we could

Re: [Python-Dev] Monkeypatching idioms -- elegant or ugly?

2008-01-19 Thread Nicko van Someren
On 15 Jan 2008, at 15:37, Guido van Rossum wrote: > Second, a "metaclass" to add a number of methods (or other attributes) > to an existing class, using a convenient class notation: ... > class (): >__metaclass__ = monkeypatch_class >def (...): ... >def (...): ... >... In Objective

Re: [Python-Dev] Is "0x" a valid token?

2008-01-19 Thread Guido van Rossum
On Jan 19, 2008 9:40 AM, Georg Brandl <[EMAIL PROTECTED]> wrote: > Python accepts 0x as an integer literal. Is this intended (the docs > say otherwise, but int() and tokenize.py concur)? Definitely a bug. I see no use case for this. -- --Guido van Rossum (home page: http://www.python.org/~guido/

[Python-Dev] Is "0x" a valid token?

2008-01-19 Thread Georg Brandl
Python accepts 0x as an integer literal. Is this intended (the docs say otherwise, but int() and tokenize.py concur)? Georg -- Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be

Re: [Python-Dev] Initial Development

2008-01-19 Thread Christian Heimes
Lorenzo Stoakes wrote: > Apologies if it's not appropriate to send this email to the mailing > list, however I am really really eager to contribute to the Python > project (as a developer), and wondered whether anyone could advise me > as to some entry-level tasks I could start out with. We are ha

[Python-Dev] Initial Development

2008-01-19 Thread Lorenzo Stoakes
Hi, Apologies if it's not appropriate to send this email to the mailing list, however I am really really eager to contribute to the Python project (as a developer), and wondered whether anyone could advise me as to some entry-level tasks I could start out with. Thanks, Lorenzo Stoakes ___

Re: [Python-Dev] Rationale for NamedTemporaryFile revisited [SEC=UNCLASSIFIED]

2008-01-19 Thread Graham Horler
On 18 Jan 2008, 06:42:26, Steve Holden wrote: > [EMAIL PROTECTED] wrote: > > Thank you very much for the quick reply. > > > > I believe we have to close the file in order be able to read it in - in this > > case to feed a unittest. I actually tried to read it in before closing it, > > but (as I s