Re: [Python-Dev] Destructors and Closing of File Objects

2013-04-26 Thread Guido van Rossum
There are no guarantees in life. On the other hand: Don't worry, be happy. On Fri, Apr 26, 2013 at 7:39 PM, Nikolaus Rath wrote: > Guido van Rossum writes: >> On Monday, April 15, 2013, Nikolaus Rath wrote: >>> Brian Curtin > writes: >>> > On Fri, A

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-27 Thread Guido van Rossum
o it is possible to reason about corner cases. (*) Proof: even I didn't think of it until just now. :-) On Sat, Apr 27, 2013 at 6:17 AM, Nick Coghlan wrote: > On Sat, Apr 27, 2013 at 7:41 AM, Guido van Rossum wrote: >> On Fri, Apr 26, 2013 at 11:17 AM, Eli Bendersky wrote: >>>

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-27 Thread Guido van Rossum
On Sat, Apr 27, 2013 at 9:41 AM, Nick Coghlan wrote: > On Sun, Apr 28, 2013 at 2:11 AM, Larry Hastings wrote: >> On 04/26/2013 02:41 PM, Guido van Rossum wrote: >> >> I am still optimistic that we can come up with a rule that >> works well enough in practice (and

Re: [Python-Dev] Questions about Codon Alignment Proposal

2013-04-27 Thread Guido van Rossum
comparing amino acid > sequences and nucleotide sequences. > > Best, > Zheng Ruan > > ___ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > h

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-27 Thread Guido van Rossum
red a general scope for miscellanea. (TBH, I think that using classes to scope variables is mostly misguided anyway -- the standard mechanism for scoping is the module.) -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-27 Thread Guido van Rossum
On Sat, Apr 27, 2013 at 1:01 PM, Ethan Furman wrote: > It seems to me that the *most* common case will be a simple name mapping, in > which case one can do: > > Planet = Enum._make('Planet', 'MERCURY VENUS EARTH') > > and be done with it. That looks horrib

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-27 Thread Guido van Rossum
SATURN >JUPITER >URANUS >PLUTO >''', > ): > '''Planets of the Solar System''' > > Not sure I like that. Ah well. The problem with this and si

Re: [Python-Dev] class name spaces inside an outer function

2013-04-27 Thread Guido van Rossum
umpteen times. > If you want something like this, doyou really have to inherit from Enum? -- --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

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-04-28 Thread Guido van Rossum
ed/excluded? IMO Everything should be enumerated except (a) things with a __get__() method (i.e. descriptors) (b) __dunder__ names Also, I believe there's still an issue on the order in which items are returned by iter(Seasons), but I don't know which way this is heading. -- --Guido van R

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-04-28 Thread Guido van Rossum
doesn't mean enums can't emulate aspects of it.) Together with my pronouncements earlier in this thread I am hoping that Eli and Barry will update the PEP and implementation (let's give them a week) and everyone else will quiet down. I realize we're deviating furth

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-04-28 Thread Guido van Rossum
perty is not justban implementation issue, it is part of the spec. Same for bool. (But == works too.) --Guido -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-de

Re: [Python-Dev] Enumeration items: `type(EnumClass.item) is EnumClass` ?

2013-04-29 Thread Guido van Rossum
But as soon as: >>> >>>type(Color.red) is Color # True >>>type(MoreColor.red) is MoreColor # True >> >> >> I don't believe this is correct. As I understand it, the proposal is the >> weaker guarantee: >> >>isinstance(Color.r

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-04-29 Thread Guido van Rossum
teger)? Does that become straightforward by nature of enum > values being the type of their enumerations? Correct, we'll still need an IntEnum subclass of Enum. I have no idea how this works out in the implementation, sorry. -- --Guido van

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-04-29 Thread Guido van Rossum
is better; the > former is error prone and doesn't seem to be useful too often. I think it should be A, and the choice should be the first one in definition order. -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-D

Re: [Python-Dev] Enumeration items: `type(EnumClass.item) is EnumClass` ?

2013-04-29 Thread Guido van Rossum
On Mon, Apr 29, 2013 at 9:12 AM, Ethan Furman wrote: > On 04/29/2013 08:39 AM, Guido van Rossum wrote: >> >> Indeed, the "type(Color.red) is Color" claim was meant for the >> situation where red is defined directly in Color, and I used type() >> instead of isi

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-04-29 Thread Guido van Rossum
ossible to define the aliases inside the enum class definition. The canonical one is the first one in definition order. -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/py

Re: [Python-Dev] Enumeration items: `type(EnumClass.item) is EnumClass` ?

2013-04-29 Thread Guido van Rossum
You are too verbose. I have already said what I needed to say. On Mon, Apr 29, 2013 at 11:24 AM, Steven D'Aprano wrote: > On 30/04/13 03:01, Guido van Rossum wrote: > >> Oh dear, this is actually a mess. I don't want MoreColor.red and >> Color.red to be distinct obje

Re: [Python-Dev] Enumeration items: `type(EnumClass.item) is EnumClass` ?

2013-04-29 Thread Guido van Rossum
is True), then you could incorrectly conclude that it is safe to call a MoreColor method on Color.red. Please do read the StackOverflow links I gave: http://stackoverflow.com/questions/4604978/subclassing-an-enum http://stackoverflow.com/questions/3427947/enumeration-inheritence-in-java/3428050#342805

Re: [Python-Dev] Enumeration items: `type(EnumClass.item) is EnumClass` ?

2013-04-29 Thread Guido van Rossum
have to special-case enums. (When we're not using duck typing.) -- --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/o

Re: [Python-Dev] Enumeration item arguments?

2013-04-29 Thread Guido van Rossum
> http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/guido%40python.org -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org http://ma

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-04-29 Thread Guido van Rossum
be happy with whatever you end up with and use it as > appropriate. This is a trick question though, isn't it? Example: class Color(Enum): red = 1 white = 2 blue = 3 class State(Enum): idle = 0 busy = 1 We would have State.busy == 1 and Color.red == 1, so now State

Re: [Python-Dev] Regression fix releases coming

2013-04-30 Thread Guido van Rossum
hon-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/guido%40python.org > -- --Guido van Rossum (python.org/~guido) ___ Py

Re: [Python-Dev] Regression fix releases coming

2013-04-30 Thread Guido van Rossum
Sorry, that was my confusion. The virus warnings were about the bz2 test data. XML bombs have not yet been addressed in any revision AFAIK. On Tue, Apr 30, 2013 at 2:06 PM, Nadeem Vawda wrote: > On Tue, Apr 30, 2013 at 4:07 PM, Benjamin Peterson > wrote: >> >> 2013/4/3

Re: [Python-Dev] PEP 428: stat caching undesirable?

2013-05-01 Thread Guido van Rossum
efits from caching there's a complementary use case that caching breaks. Since both use cases are important we must offer both APIs, in a way that makes it clear to even the casual reader of the code what's going on. -- --Guido van Rossum (py

Re: [Python-Dev] PEP-435 reference implementation

2013-05-01 Thread Guido van Rossum
-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/guido%40python.org -- --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

Re: [Python-Dev] PEP-435 reference implementation

2013-05-01 Thread Guido van Rossum
There doesn't even seem > to be an easy way to override the default behavior if you really wanted to do > it. > > -Barry > _______ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsu

Re: [Python-Dev] PEP-435 reference implementation

2013-05-01 Thread Guido van Rossum
ag_colors = list(Color) + list(ExtraColor) But this would be less or more acceptable depending on whether it is a common or esoteric use case. -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org http://mail.pytho

Re: [Python-Dev] Enum: subclassing?

2013-05-01 Thread Guido van Rossum
... > > --> class Planet(StrEnum): > ... mars = 'red' > ... earth = 'blue' > ... > > --> Season.summer.descripbe() > Hi! I'm a brown widget! > > --> Planet.earth.describe() > Hi! I'm a blue widget! If the base

Re: [Python-Dev] Enum: subclassing?

2013-05-01 Thread Guido van Rossum
> > As opposed to having an IntEnum explicitly, this just saves 2 characters > (comma+space), but is more explicit (zen!) and helps us avoid the > special-casing the subclass restriction implementation. Sounds good to me. -- --Guido van Rossum (python.org/~guido) ___

Re: [Python-Dev] Enum: subclassing?

2013-05-01 Thread Guido van Rossum
ete subclasses of >> IntEnum (or WhateverEnum). > > > You mean this? > > class BehaviorMixin: > # bla bla > > class MyBehavingIntEnum(int, BehaviorMixin, Enum): > foo = 1 > bar = 2 It's a common pattern to do this with a base class rather than a mixin, tho

Re: [Python-Dev] Enum: subclassing?

2013-05-01 Thread Guido van Rossum
> a Good Thing. What would int(x) return if x is an enum whose value is not a plain int? Why can't you use x.value for this use case? -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org http://mail.p

Re: [Python-Dev] Enum: subclassing?

2013-05-01 Thread Guido van Rossum
Yes. On Wed, May 1, 2013 at 3:51 PM, Ethan Furman wrote: > On 05/01/2013 02:07 PM, Guido van Rossum wrote: >> >> On Wed, May 1, 2013 at 2:04 PM, Eli Bendersky wrote: >>> >>> >>> class BehaviorMixin: >>># bla bla >>> >>&

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-05-02 Thread Guido van Rossum
eck, e.g. "if x in Color:". (Note that from this you cannot derive that Color[x] should work.) -- --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

Re: [Python-Dev] PyPy, Jython, & IronPython: Enum convenience function and pickleablity

2013-05-02 Thread Guido van Rossum
his, don't conclude that it's not important for namedtuple() or Enum() to return a picklable class. It is important. It is just not important to try to make it work when they are called through some other wrapper -- there's just not much use for such a pattern.) -- --Guido

Re: [Python-Dev] PyPy, Jython, & IronPython: Enum convenience function and pickleablity

2013-05-02 Thread Guido van Rossum
On Thu, May 2, 2013 at 4:14 PM, Nick Coghlan wrote: > I would suggest moving the field names into the class header for a class > based convenience API: > > class Animal(Enum, members='cat dog'): pass Would you propose the same for namedtuple? -- --Guido van Ros

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-05-03 Thread Guido van Rossum
, I haven't seen code in the style that Greg proposes in decades, and I don't think it is an important enough use case to support more directly than through getattr() + isinstance(). -- --Guido van Rossum (python.org/~guido) ___ Pyt

Re: [Python-Dev] PyPy, Jython, & IronPython: Enum convenience function and pickleablity

2013-05-03 Thread Guido van Rossum
the first argument could accept, but > not require dotted names in the first argument. If provided, rsplit the > string and use the prefix as __module__. If not given, fallback to the > _getframe() hack for those implementations where it's available. > > The same could pr

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-05-03 Thread Guido van Rossum
On Fri, May 3, 2013 at 4:08 PM, Greg Ewing wrote: > Guido van Rossum wrote: >> >> I haven't seen code in the style that >> Greg proposes in decades, > What style are you talking about here? Code that wants to validate a string the user typed as input. Web f

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-05-04 Thread Guido van Rossum
; Options 1 and 2 both sound reasonable to me, although I have a > preference for 2 due to the ability to produce a more appropriate > error message when the lookup fails. > > Cheers, > Nick. > > -- > Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia > ___

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-05-04 Thread Guido van Rossum
__ > 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/guido%40python.org > -- --Guido van Rossum (python.org/~guido)

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Guido van Rossum
resses concrete functional issues. > (but apparently you would very much like to sweep those issues under > the carpet in the name of "bikeshedding") > > Regards > > Antoine. > ___ > Python-Dev mailing list > Python-D

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Guido van Rossum
; >> Kind regards and happy weekend. >> >> >> >> >> >> ___ >> Python-Dev mailing list >> Python-Dev@python.org >> http://mail.python.org/mailman/listinfo/python-dev >> Unsubscribe: >

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Guido van Rossum
ob, I like the PEP a lot. But Python's enums are very unlike > those of other languages, and I suspect that's going to be more of an issue > than you'd hope... We're pretty confident that we're doing about the best job possible given the constraints (one of whi

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Guido van Rossum
ion; (b) specify the full dotted class name in the call. (We should modify namedtuple() to support this too BTW.) -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/pyt

Re: [Python-Dev] PEP 435: initial values must be specified? Yes

2013-05-05 Thread Guido van Rossum
On Sun, May 5, 2013 at 2:55 PM, Tim Delaney wrote: > So long as I can get one of the requirements documented to implement an > auto-number syntax I'll be happy enough with stdlib enums I think. Specifically what do you want the PEP to promise? -- --Guido van Rossum (python

Re: [Python-Dev] PEP 435: initial values must be specified? Yes

2013-05-05 Thread Guido van Rossum
On Sun, May 5, 2013 at 3:34 PM, Tim Delaney wrote: > On 6 May 2013 08:00, Guido van Rossum wrote: >> >> On Sun, May 5, 2013 at 2:55 PM, Tim Delaney >> wrote: >> > So long as I can get one of the requirements documented to implement an >> > auto-number

Re: [Python-Dev] PEP 435: initial values must be specified? Yes

2013-05-05 Thread Guido van Rossum
On Sun, May 5, 2013 at 3:55 PM, Eli Bendersky wrote: > > > > On Sun, May 5, 2013 at 3:34 PM, Tim Delaney > wrote: >> >> On 6 May 2013 08:00, Guido van Rossum wrote: >>> >>> On Sun, May 5, 2013 at 2:55 PM, Tim Delaney >>> wrote: >>&g

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Guido van Rossum
On Sun, May 5, 2013 at 4:15 PM, Ethan Furman wrote: > On 05/05/2013 03:16 PM, Nikolaus Rath wrote: >> >> Guido van Rossum writes: >>>> >>>> 1. Having to enter the values is annoying. Sorry, I read the rationale >>>> and >>>> all

Re: [Python-Dev] PEP 435: pickling enums created with the functional API

2013-05-09 Thread Guido van Rossum
___ > 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/guido%40python.org > > -- --Guido van Rossum (python.org/~gu

[Python-Dev] PEP 435 (Enums) is Accepted

2013-05-09 Thread Guido van Rossum
review now. -- --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

Re: [Python-Dev] PEP 0 maintenance - deferring some currently open PEPs

2013-05-10 Thread Guido van Rossum
drawn). > > > > > ___ > 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/guido%40python.org -- --Guido

Re: [Python-Dev] Pickling failure on Enums

2013-05-14 Thread Guido van Rossum
On Tue, May 14, 2013 at 1:09 PM, Ethan Furman wrote: > On 05/13/2013 11:32 AM, Guido van Rossum wrote: >> >> >> But now you enter a different phase of your project, or one of your >> collaborators does, or perhaps you've released your code on PyPI and one of >&

Re: [Python-Dev] Pickling failure on Enums

2013-05-14 Thread Guido van Rossum
On Tue, May 14, 2013 at 2:13 PM, Ethan Furman wrote: > On 05/14/2013 01:58 PM, Guido van Rossum wrote: >> >> On Tue, May 14, 2013 at 1:09 PM, Ethan Furman wrote: >>> I can get pickle failure on members created using the functional syntax >>> with no module set

Re: [Python-Dev] Mysterious Python pyc file corruption problems

2013-05-16 Thread Guido van Rossum
ke marshal doesn't always check for EOF immediately (sometimes it calls getc() without checking the result, and sometimes it doesn't check the error state after calling r_string()), so I think all the errors are actually explainable from this scenario. -- --

Re: [Python-Dev] Mysterious Python pyc file corruption problems

2013-05-16 Thread Guido van Rossum
I still suspect this might explain most of what Barry saw, if not all.  — Sent from Mailbox On Thu, May 16, 2013 at 2:36 PM, Brett Cannon wrote: > On Thu, May 16, 2013 at 5:19 PM, Guido van Rossum wrote: >> This reminds me of the following bug, which can happen when two >> pro

Re: [Python-Dev] Mysterious Python pyc file corruption problems

2013-05-16 Thread Guido van Rossum
On Thu, May 16, 2013 at 3:27 PM, Greg Ewing wrote: > Guido van Rossum wrote: >> >> This reminds me of the following bug, which can happen when two >> processes are both writing the .pyc file and a third is reading it. >> ... I think all the errors are >>

[Python-Dev] Ordering keyword dicts

2013-05-18 Thread Guido van Rossum
many special cases to consider; e.g. using **kwds in the call where kwds is an unordered dict, or calls from C, or calls to C. But maybe someone considers this a challenge and comes up with a patch? The benefits to *some* use cases would be obvious.

Re: [Python-Dev] HAVE_FSTAT?

2013-05-19 Thread Guido van Rossum
Fake values would probably cause hard to debug problems. It's a long standing Python tradition not to offer low level APIs that the platform doesn't have. — Sent from Mailbox On Sun, May 19, 2013 at 5:20 AM, Antoine Pitrou wrote: > On Sun, 19 May 2013 10:08:39 +0200 > Charles-François Natali w

Re: [Python-Dev] Ordering keyword dicts

2013-05-19 Thread Guido van Rossum
Hm. Wouldn'tvevery call site be slowed down by checking for that flag? — Sent from Mailbox On Sun, May 19, 2013 at 7:42 AM, Nick Coghlan wrote: > On Sun, May 19, 2013 at 11:01 PM, Antoine Pitrou wrote: >> The main use case seems to be the OrderedDict constructor itself. >> Otherwise, I can't th

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Guido van Rossum
Anyway, if you're doing arithmetic on enums you're doing it wrong.  — Sent from Mailbox On Sun, May 19, 2013 at 4:55 AM, Nick Coghlan wrote: > On Sun, May 19, 2013 at 4:41 PM, Raymond Hettinger > wrote: >> nicer repr" is worth "Sorry, I broke your tests, made your published >> examples >> out o

[Python-Dev] What if we didn't have repr?

2013-05-19 Thread Guido van Rossum
7;t see this as a proposal to change the language. Like Greg, I'm not advocating, just pondering. (With the exception that if I was allowed to use the time machine to go back a couple of weeks, I'd adjust PEP 435 to define str(x) as x.name, e.g. "red"

Re: [Python-Dev] Ordering keyword dicts

2013-05-20 Thread Guido van Rossum
ion to avoid slowing down function calls that don't benefit. --Guido van Rossum (sent from Android phone) On May 20, 2013 8:25 AM, "fwierzbi...@gmail.com" wrote: > On Mon, May 20, 2013 at 6:39 AM, Barry Warsaw wrote: > > Or in other words, if dicts are to be ordered, le

Re: [Python-Dev] What if we didn't have repr?

2013-05-21 Thread Guido van Rossum
pros and cons. Post design ideas to python-ideas please, not here! --Guido On Tuesday, May 21, 2013, Łukasz Langa wrote: > On 20 maj 2013, at 03:46, Guido van Rossum > > > wrote: > > On Sun, May 19, 2013 at 4:27 PM, Gregory P. Smith > > > wrote: > > Now yo

Re: [Python-Dev] PEP 442 delegate

2013-05-21 Thread Guido van Rossum
g list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/guido%40python.org -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing l

Re: [Python-Dev] PEP 443 - Single-dispatch generic functions

2013-05-22 Thread Guido van Rossum
2 special as well usually smells. So I'd say that Łukasz's single-dispatch proposal covers a fairly important patch of new ground, while dual-dispatch is both much harder and less useful. Ergo, Łukasz has made the right trade-off. -- --Guido van Rossum (python.org/~guido) _

Re: [Python-Dev] PEP 443 - Single-dispatch generic functions

2013-05-22 Thread Guido van Rossum
rg/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/guido%40python.org -- --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

Re: [Python-Dev] PEP 443 - Single-dispatch generic functions

2013-05-23 Thread Guido van Rossum
Łukasz, are there any open issues? Otherwise I'm ready to accept the PEP. -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe:

Re: [Python-Dev] PEP 443 - Single-dispatch generic functions

2013-05-23 Thread Guido van Rossum
Ok, happy bikeshedding. I'm outta here until that's settled. :-) On Thu, May 23, 2013 at 7:58 AM, Łukasz Langa wrote: > On 23 maj 2013, at 16:49, Guido van Rossum wrote: > >> Łukasz, are there any open issues? Otherwise I'm ready to accept the PEP. > > There

[Python-Dev] PEP 443 Accepted

2013-06-04 Thread Guido van Rossum
h, and you've managed the bikeshedding admirably. Thank you for your great contribution to Python! -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe:

Re: [Python-Dev] Unicode minus sign in numeric conversions

2013-06-08 Thread Guido van Rossum
> Twitter: @llanga > IRC: ambv on #python-dev > > ___ > 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/gui

Re: [Python-Dev] eval and triple quoted strings

2013-06-14 Thread Guido van Rossum
Not a bug. The same is done for file input -- CRLF is changed to LF before tokenizing. On Jun 14, 2013 8:27 AM, "Walter Dörwald" wrote: > Hello all! > > This surprised me: > >>>> eval("'''\r\n'''") >'\n' > > Where did the \r go? ast.literal_eval() has the same problem: > >>>> ast.lite

Re: [Python-Dev] eval and triple quoted strings

2013-06-15 Thread Guido van Rossum
The semantics of raw strings are clear. I don't see that they should be called out especially in any context. (Except for regexps.) Usually exec() is not used with a literal anyway (what would be the point). --Guido van Rossum (sent from Android phone) On Jun 15, 2013 1:03 PM, "Ron Ad

Re: [Python-Dev] eval and triple quoted strings

2013-06-17 Thread Guido van Rossum
g may not have originated from a file, so the universal newlines behavior of the io module is irrelevant here -- the parser must implement its own equivalent processing, and it does. -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python

Re: [Python-Dev] eval and triple quoted strings

2013-06-17 Thread Guido van Rossum
On Mon, Jun 17, 2013 at 3:18 PM, Greg Ewing wrote: > Guido van Rossum wrote: >> >> No. Executing a file containing those exact characters produces a >> string containing only '\n' and exec/eval is meant to behave the same >> way. The string may not have ori

Re: [Python-Dev] eval and triple quoted strings

2013-06-17 Thread Guido van Rossum
On Mon, Jun 17, 2013 at 4:40 PM, Benjamin Peterson wrote: > 2013/6/17 Greg Ewing : >> Guido van Rossum wrote: >>> >>> No. Executing a file containing those exact characters produces a >>> string containing only '\n' and exec/eval is meant to be

Re: [Python-Dev] eval and triple quoted strings

2013-06-17 Thread Guido van Rossum
On Mon, Jun 17, 2013 at 5:02 PM, Benjamin Peterson wrote: > 2013/6/17 Guido van Rossum : >> On Mon, Jun 17, 2013 at 4:40 PM, Benjamin Peterson >> wrote: >>> 2013/6/17 Greg Ewing : >>>> Guido van Rossum wrote: >>>>> >>>>>

Re: [Python-Dev] stat module in C -- what to do with stat.py?

2013-06-20 Thread Guido van Rossum
_ > 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/guido%40python.org > -- --Guido van Rossum (python.org/~guido)

Re: [Python-Dev] [python 2.7] a question about exporting a new method to socket object

2013-06-21 Thread Guido van Rossum
AttributeError: '_socketobject' object has no attribute 'arecvfrom' > > So what am I doing wrong? How do I export this new socket method? > > any help/pointer will be greatly appreciated. > > cheers, > ani > > -- > Ani > > __

Re: [Python-Dev] cpython (2.7): Fix comment blocks. Adjust blocksize to a power-of-two for better divmod

2013-06-22 Thread Guido van Rossum
s, I am skeptical that any tuning of > this structure provides any meaningful performance improvement. Actually the data buffer is an array of pointers too, so with the original BLOCKLEN value of 62, sizeof(block) would be 64 times sizeof(PyObject *). In the Py3 version of the source there's

Re: [Python-Dev] cpython (2.7): Fix comment blocks. Adjust blocksize to a power-of-two for better divmod

2013-06-24 Thread Guido van Rossum
makes intuitive sense now. I think the general feeling is that folks overreacted (perhaps confused by your silence) and that the reversal will be rolled back. Benjamin? -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@pytho

Re: [Python-Dev] PyArg_ParseTupe(): parse unsigned integer and check for overflow

2013-06-26 Thread Guido van Rossum
g_AsLong(), and check value <= UINT_MAX? Why can't you use the K format? It won't reject out-of-range values, but it will convert them to in-range so there aren't any attacks possible based on bypassing the range check. I'm probably misunderstanding something -- I don&#x

[Python-Dev] Reminder: an oft-forgotten rule about docstring formatting (PEP 257)

2013-06-26 Thread Guido van Rossum
portant that it fits on one line and is separated from the rest of the docstring by a blank line. [...] """ I still like this rule, but it is violated frequently, in the stdlib and elsewhere. I'd like to urge stdlib contributors and core devs to heed it -- or explain why

Re: [Python-Dev] Reminder: an oft-forgotten rule about docstring formatting (PEP 257)

2013-06-27 Thread Guido van Rossum
On Thu, Jun 27, 2013 at 1:21 AM, Antoine Pitrou wrote: > I don't always find it easy to summarize a function in one line. Neither do I. But I always manage to do it anyway. My reasoning is, you can always leave out more detail and add it to the subsequent paragraph. -- --Guido va

Re: [Python-Dev] Reminder: an oft-forgotten rule about docstring formatting (PEP 257)

2013-06-27 Thread Guido van Rossum
Yes on one line, capitalized, period. No on single sentence. --Guido van Rossum (sent from Android phone) On Jun 27, 2013 8:17 AM, "Larry Hastings" wrote: > On 06/26/2013 08:56 PM, Guido van Rossum wrote: > > PEP 257 says this on the formatting of multi-line docstrings: &

Re: [Python-Dev] Reminder: an oft-forgotten rule about docstring formatting (PEP 257)

2013-06-27 Thread Guido van Rossum
It was never my intention to enforce that everything has a docstring. Just that if it does, it looks good. On Thu, Jun 27, 2013 at 9:40 AM, Terry Reedy wrote: > On 6/27/2013 11:57 AM, Guido van Rossum wrote: >> >> Yes on one line, capitalized, period. No on single sentence. >

Re: [Python-Dev] backported Enum

2013-06-28 Thread Guido van Rossum
y mappings) but still the mnemonic tip "foo[bar] is a lookup" should help in remembering the meaning. I have no idea why it was the other way around in flufl.enum, but admittedly neither of these rules are absolute, and it's possible that fluf

Re: [Python-Dev] Issue 4199: combining assignment with global & nonlocal

2013-06-29 Thread Guido van Rossum
t; be closed (and maybe a note added to the PEP that "we didn't do this > after all")? > > --amk > ___ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev

Re: [Python-Dev] Hooking into super() attribute resolution

2013-07-02 Thread Guido van Rossum
No time to read the PEP in detail but the motivation sound reasonable. --Guido van Rossum (sent from Android phone) On Jul 2, 2013 4:53 AM, "Ronald Oussoren" wrote: > Hi, > > Below is a very preliminary draft PEP for adding a special method that can > be used to h

Re: [Python-Dev] lament for the demise of unbound methods

2013-07-04 Thread Guido van Rossum
Chris, what do you want to do with the knowledge you are seeking? --Guido van Rossum (sent from Android phone) On Jul 4, 2013 4:28 AM, "Chris Withers" wrote: > Hi All, > > In Python 2, I can figure out whether I have a method or a function, and, > more importantly, for an

Re: [Python-Dev] lament for the demise of unbound methods

2013-07-04 Thread Guido van Rossum
> > runner = Runner(T0, C1.meth, C2.meth1, C2.meth2) > > ...but if I do that, how can the runner know that what it gets for its > second argument is a class method of C1? > (which is this case means that it should do C1().meth() rather than > C1.meth()) > > cheers, >

Re: [Python-Dev] Oddity in MISC/News on default

2013-07-04 Thread Guido van Rossum
> http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/guido%40python.org > -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org http://mail.pyth

Re: [Python-Dev] Oddity in MISC/News on default

2013-07-04 Thread Guido van Rossum
Le jeudi 04 juillet 2013 à 12:17 -0700, Guido van Rossum a écrit : > > Why not? Presumably those news items were all merged into the default > > branch, and Misc/NEWS also has all the news for all 3.3.0 releases. > > Why pick on 3.3.1 rc1? > > 3.3.1rc1 is the only post-3.3.

Re: [Python-Dev] Python 3.4 and Windows XP: just 45 days until EOL

2013-07-12 Thread Guido van Rossum
others around them don't or if they need certain software. --Guido van Rossum (sent from Android phone) On Jul 12, 2013 4:34 AM, "Christian Heimes" wrote: > Am 12.07.2013 03:49, schrieb Ben Hoyt: > > I guess it has to be dropped at some stage, but with Windows XP it

Re: [Python-Dev] PEP 447: hooking into super() attribute resolution

2013-07-15 Thread Guido van Rossum
u want (never mind whether it matches the exact API currently proposed), and (b) doesn't slow down classes that don't provide this hook. Other than that, I think that it's a laudable attempt at generalizing, and I hope you solve the implementation conundrum. -- --Guido van Rossum

Re: [Python-Dev] PEP 447: hooking into super() attribute resolution

2013-07-15 Thread Guido van Rossum
On Mon, Jul 15, 2013 at 9:56 AM, Ronald Oussoren wrote: > > On 15 Jul, 2013, at 18:49, Guido van Rossum wrote: >> >> >>> A major open issue: the __locallookup__ method could also be used for >>> normal attribute resolution, but that probably causes issues

[Python-Dev] Misc re.match() complaint

2013-07-15 Thread Guido van Rossum
type always matches that of the target string. I think this is bad -- apart from the lifetime concern, it means that if your target happens to be a bytearray, the return value isn't even hashable! Does anyone remember whether this was a conscious decision? Is it too late to fix? -- --Guido

Re: [Python-Dev] Misc re.match() complaint

2013-07-15 Thread Guido van Rossum
Ok, created http://bugs.python.org/issue18468. On Mon, Jul 15, 2013 at 4:30 PM, Gregory P. Smith wrote: > > On Mon, Jul 15, 2013 at 4:14 PM, Guido van Rossum wrote: >> >> In a discussion about mypy I discovered that the Python 3 version of >> the re module'

Re: [Python-Dev] Misc re.match() complaint

2013-07-15 Thread Guido van Rossum
On Mon, Jul 15, 2013 at 5:10 PM, MRAB wrote: > On 16/07/2013 00:30, Gregory P. Smith wrote: >> >> >> On Mon, Jul 15, 2013 at 4:14 PM, Guido van Rossum > <mailto:gu...@python.org>> wrote: >> >> In a discussion about mypy I discovered that the Pyt

Re: [Python-Dev] Misc re.match() complaint

2013-07-15 Thread Guido van Rossum
On Mon, Jul 15, 2013 at 7:03 PM, Stephen J. Turnbull wrote: > Guido van Rossum writes: > > > And I still think that any return type for group() except bytes or str > > is wrong. (Except possibly a subclass of these.) > > I'm not sure I understand. Do you mea

Re: [Python-Dev] Misc re.match() complaint

2013-07-15 Thread Guido van Rossum
you'd only see complaints from folks who (a) use the regex module, (b) use it with a buffer object as the target string, and (c) try to use the group() return value as a dict key. Each of these is probably a small majority of all users. -- --Guido van Rossum (python.org/~guido) __

<    13   14   15   16   17   18   19   20   21   22   >