On 04/26/2013 07:29 PM, Glenn Linderman wrote:
On 4/26/2013 6:22 PM, Greg Ewing wrote:
Guido van Rossum wrote:
If we had access to the syntax used for the definition, this would be
simple: assignments define items, def statements define methods. But
at run time we only see the final object resu
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, Apr 12, 2013 at 12:04 AM, Nikolaus Rath
>>> > >
Steven D'Aprano writes:
> On 26/04/13 13:22, Greg wrote:
>> On 26/04/2013 3:12 p.m., Glenn Linderman wrote:
>>> On 4/25/2013 7:49 PM, Nick Coghlan wrote:
>>
You couldn't create an enum of callables, but that would be a
seriously weird thing to do anyway
>>>
>>> But aren't all classes
Guido van Rossum writes:
> On Monday, April 15, 2013, Nikolaus Rath wrote:
>> Brian Curtin > writes:
>> > On Fri, Apr 12, 2013 at 12:04 AM, Nikolaus Rath
>> > >
>> wrote:
>> >> [ Note: I already asked this on
>> >> http://stackoverflow.com/questions/15917502 but didn't get any
>> >> satisfactory
On 04/26/2013 11:17 AM, Eli Bendersky wrote:
I feel that this thread has lost track of it long ago. Some time back in the
Enum discussions (some 350 messages ago or
so), there was a proposal to have this:
class Color(Enum):
RED, BLUE, GREEN
By doing some crazy-cool shenanigans. Although th
On 04/26/2013 06:37 PM, Greg Ewing wrote:
Eli Bendersky wrote:
There's a conceptual difference between a value of an enumeration and a
collection of such values.
Not if you think of an enum as a type and a type as
defining a set of values. From that point of view, the
enum itself is already a
On 4/26/2013 6:22 PM, Greg Ewing wrote:
Guido van Rossum wrote:
If we had access to the syntax used for the definition, this would be
simple: assignments define items, def statements define methods. But
at run time we only see the final object resulting from the
definition,
Another way we coul
Eli Bendersky wrote:
There's a conceptual
difference between a value of an enumeration and a collection of such
values.
Not if you think of an enum as a type and a type as
defining a set of values. From that point of view, the
enum itself is already a collection of values, and
introducing anot
Guido van Rossum wrote:
If we had access to the syntax used for the definition, this would be
simple: assignments define items, def statements define methods. But
at run time we only see the final object resulting from the
definition,
Another way we could tell the difference is if the def
state
On Fri, Apr 26, 2013 at 2:41 PM, Guido van Rossum wrote:
> On Fri, Apr 26, 2013 at 11:17 AM, Eli Bendersky wrote:
> > On Fri, Apr 26, 2013 at 10:36 AM, Guido van Rossum
> wrote:
> >> > On 4/25/2013 9:19 PM, Guido van Rossum wrote:
> >> I think you've lost track of the Zen of Python.
> >
> > I f
Hello,
I have proposed a new generator finalization scheme in
http://bugs.python.org/issue17807: it removes the tp_del from
generator objects, instead electing to cleanup the generator
(equivalent of calling close()) in the frame's tp_clean function. This
way, generators with a try / finally bloc
On Fri, Apr 26, 2013 at 11:17 AM, Eli Bendersky wrote:
> On Fri, Apr 26, 2013 at 10:36 AM, Guido van Rossum wrote:
>> > On 4/25/2013 9:19 PM, Guido van Rossum wrote:
>> I think you've lost track of the Zen of Python.
>
> I feel that this thread has lost track of it long ago.
Perhaps. The thread
Thank you for your answers, Barry. Eli already answered me most of my
questions.
20.04.13 22:18, Barry Warsaw написав(ла):
On Apr 13, 2013, at 11:31 AM, Serhiy Storchaka wrote:
The str and repr of the enumeration class also provides useful information::
>>> print(Colors)
>>
26.04.13 05:13, Nick Coghlan написав(ла):
With a merged design, it becomes *really* hard to give the instances
custom behaviour, because the metaclass will somehow have to
differentiate between namespace entries that are intended to be
callables, and those which are intended to be instances of th
26.04.13 11:00, Greg Ewing написав(ла):
However, there's a worse problem with defining enum
inheritance that way. The subtype relation for extensible
enums works the opposite way to that of classes.
To see this, imagine a function expecting something
of type Colors. It knows what to do with red,
On Fri, Apr 26, 2013 at 10:36 AM, Guido van Rossum wrote:
> On Fri, Apr 26, 2013 at 10:33 AM, Glenn Linderman
> wrote:
> > On 4/25/2013 9:19 PM, Guido van Rossum wrote:
> >
> > On Thu, Apr 25, 2013 at 8:39 PM, Glenn Linderman
> > wrote:
> >
> > an enumeration of objects whose class defines __ca
On 4/25/2013 9:19 PM, Guido van Rossum wrote:
On Thu, Apr 25, 2013 at 8:39 PM, Glenn Linderman wrote:
an enumeration of objects whose class defines __call__ would
not be so weird.
Seriously? You'd complexificate the basic usage in order to cater for
such an esoteric use case? The *only* use ca
On 04/26/2013 09:27 AM, Serhiy Storchaka wrote:
26.04.13 18:50, Larry Hastings написав(ла):
On 04/26/2013 12:34 AM, Greg Ewing wrote:
Or if, as Guido says, the only sensible things to use
as enum values are ints and strings, just leave anything
alone that isn't one of those.
The standard Java
On 04/26/2013 09:27 AM, Serhiy Storchaka wrote:
26.04.13 18:50, Larry Hastings написав(ла):
The standard Java documentation on enums:
http://docs.oracle.com/javase/tutorial/java/javaOO/enum.html
This example requires more than features discussed here. It requires
an enum constructor.
On Fri, Apr 26, 2013 at 10:33 AM, Glenn Linderman wrote:
> On 4/25/2013 9:19 PM, Guido van Rossum wrote:
>
> On Thu, Apr 25, 2013 at 8:39 PM, Glenn Linderman
> wrote:
>
> an enumeration of objects whose class defines __call__ would
> not be so weird.
>
> Seriously? You'd complexificate the basic
On 04/26/2013 08:50 AM, Larry Hastings wrote:
FWIW I'm +0.5 on "the enum metaclass ignores callables and
descriptors". This seems reasonably Pythonic, much more so than "ignore
everything except ints and strings". And as long as we're
special-casing it I think we should opt for flexibility. Cer
26.04.13 18:50, Larry Hastings написав(ла):
On 04/26/2013 12:34 AM, Greg Ewing wrote:
Or if, as Guido says, the only sensible things to use
as enum values are ints and strings, just leave anything
alone that isn't one of those.
The standard Java documentation on enums:
http://docs.oracle.
ACTIVITY SUMMARY (2013-04-19 - 2013-04-26)
Python tracker at http://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open3949 (+21)
closed 25674 (+32)
total 29623 (+53)
Open issues wit
On 04/26/2013 12:34 AM, Greg Ewing wrote:
Or if, as Guido says, the only sensible things to use
as enum values are ints and strings, just leave anything
alone that isn't one of those.
The standard Java documentation on enums:
http://docs.oracle.com/javase/tutorial/java/javaOO/enum.html
has
On 26/04/2013 06:21, Ethan Furman wrote:
On 04/25/2013 08:14 PM, Greg wrote:
On 26/04/2013 1:28 p.m., Ethan Furman wrote:
Interesting idea, but why does Day(3) have to be disallowed to make it
work?
Because it's ambiguous. Which day of the week is number 3? It
depends on where you start.
Ah
On 26/04/13 18:00, Greg Ewing wrote:
However, there's a worse problem with defining enum
inheritance that way. The subtype relation for extensible
enums works the opposite way to that of classes.
To see this, imagine a function expecting something
of type Colors. It knows what to do with red, g
26.04.13 11:00, Greg Ewing написав(ла):
However, there's a worse problem with defining enum
inheritance that way. The subtype relation for extensible
enums works the opposite way to that of classes.
To see this, imagine a function expecting something
of type Colors. It knows what to do with red,
Piotr Duda wrote:
There is at least one more problem, enum inheritance, given:
class Colors(Enum):
red = 1
green = 2
blue = 3
class MoreColors(Color):
cyan = 4
magenta = 5
yellow = 6
what type is MoreColors.red?
Given the implementation we're considering, it would
probably be Col
Steven D'Aprano wrote:
I don't think iscallable will work, since that descriptors like
staticmethod and classmethod aren't callable. Nor are properties.
Hmmm, maybe we should look for a __get__ method as
well? Enums of descriptors would seem to fall into
the seriously-weird category as well.
O
On Fri, Apr 26, 2013 at 1:09 AM, Ethan Furman wrote:
> We just fixed NoneType() to return None instead of raising an exception.
>
> Another use-case for calling NoneType is working with ORMs:
>
> result = []
> for field in row:
> type = get_type(field) # returns int, bool, str, NoneType,
On Thu, 25 Apr 2013 16:09:41 -0700
Ethan Furman wrote:
> We just fixed NoneType() to return None instead of raising an exception.
>
> Another use-case for calling NoneType is working with ORMs:
>
> result = []
> for field in row:
> type = get_type(field) # returns int, bool, str, None
31 matches
Mail list logo