On 4 May 2013 05:17, "Georg Brandl" wrote:
>
> Am 03.05.2013 11:40, schrieb Steven D'Aprano:
> > On 03/05/13 18:42, Antoine Pitrou wrote:
> >> Le Fri, 3 May 2013 09:14:22 +1000, Nick Coghlan a
> >> écrit :
> >
> >>> I would suggest moving the field names into the class header for a
class
> >>> ba
On 5/3/2013 12:08 PM, Barry Warsaw wrote:
Exactly right, but let's stop calling it the "convenience API" and instead
call it the "functional API". I probably started the perpetuation of this
problem; let's update the PEP.
Please do. To me, a 'convenience function' is something like the timeit
Am 03.05.2013 11:40, schrieb Steven D'Aprano:
> On 03/05/13 18:42, Antoine Pitrou wrote:
>> Le Fri, 3 May 2013 09:14:22 +1000, Nick Coghlan a
>> écrit :
>
>>> I would suggest moving the field names into the class header for a class
>>> based convenience API:
>>>
>>> class Animal(Enum, members='c
2013/5/3 Barry Warsaw :
> On May 03, 2013, at 07:40 PM, Steven D'Aprano wrote:
>
>>The problem is that this is not an expression, it is a statement. The
>>advantage of the convenience function is not just that it is shorter, but
>>that it is an expression.
>
> Exactly right, but let's stop calling
On Fri, May 3, 2013 at 9:08 AM, Barry Warsaw wrote:
> On May 03, 2013, at 07:40 PM, Steven D'Aprano wrote:
>
>>The problem is that this is not an expression, it is a statement. The
>>advantage of the convenience function is not just that it is shorter, but
>>that it is an expression.
>
> Exactly r
On May 03, 2013, at 07:40 PM, Steven D'Aprano wrote:
>The problem is that this is not an expression, it is a statement. The
>advantage of the convenience function is not just that it is shorter, but
>that it is an expression.
Exactly right, but let's stop calling it the "convenience API" and inst
Ethan Furman, 02.05.2013 21:07:
> In order for the Enum convenience function to be pickleable, we have this
> line of code in the metaclass:
>
> enum_class.__module__ = sys._getframe(1).f_globals['__name__']
What a hack. And fragile, too.
> This works fine for Cpython, but what about the ot
Le Fri, 03 May 2013 19:40:21 +1000,
Steven D'Aprano a écrit :
> On 03/05/13 18:42, Antoine Pitrou wrote:
> > Le Fri, 3 May 2013 09:14:22 +1000,
> > Nick Coghlan a écrit :
>
> >> I would suggest moving the field names into the class header for a
> >> class based convenience API:
> >>
> >> class A
On 03/05/13 18:42, Antoine Pitrou wrote:
Le Fri, 3 May 2013 09:14:22 +1000,
Nick Coghlan a écrit :
I would suggest moving the field names into the class header for a
class based convenience API:
class Animal(Enum, members='cat dog'): pass
This looks good to me (assuming some people don't l
Le Thu, 2 May 2013 14:57:35 -0700,
Eli Bendersky a écrit :
>
> class Animal(Enum):
> __values__ = 'cat dog'
>
> This is obviously a matter of preference (and hence bikeshedding),
> but this still looks better to me:
>
> Animal = Enum('Animal', 'cat dog')
>
> It has two advantages:
>
> 1. Sh
Le Fri, 3 May 2013 09:14:22 +1000,
Nick Coghlan a écrit :
> >
> > The other issue is your proposal to have a class-based convenience
> > syntax
> akin to (correct me if I got this wrong):
> >
> > class Animal(Enum):
> > __values__ = 'cat dog'
>
> I would suggest moving the field names into the
Am 02.05.2013 23:57, schrieb Eli Bendersky:
>> Eli, it would be nice if you stopped with this claim.
>
>
> I'm not advocating "not having a convenience syntax", I'm advocating
> having a convenience syntax which is *class-based* rather than
> function-based.
>
> Debuggers are bes
On May 03, 2013, at 09:14 AM, Nick Coghlan wrote:
>> The other issue is your proposal to have a class-based convenience syntax
>akin to (correct me if I got this wrong):
>>
>> class Animal(Enum):
>> __values__ = 'cat dog'
>
>I would suggest moving the field names into the class header for a clas
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 Rossum (python.org/~guido)
__
On 3 May 2013 08:00, "Eli Bendersky" wrote:
>
> > Eli, it would be nice if you stopped with this claim.
>>
>>
>> I'm not advocating "not having a convenience syntax", I'm advocating
>> having a convenience syntax which is *class-based* rather than
>> function-based.
>>
>> Debuggers are beside the
On Thu, May 2, 2013 at 1:18 PM, fwierzbi...@gmail.com
wrote:
> On Thu, May 2, 2013 at 12:07 PM, Ethan Furman wrote:
>> In order for the Enum convenience function to be pickleable, we have this
>> line of code in the metaclass:
>>
>> enum_class.__module__ = sys._getframe(1).f_globals['__name__
> Eli, it would be nice if you stopped with this claim.
>
> I'm not advocating "not having a convenience syntax", I'm advocating
> having a convenience syntax which is *class-based* rather than
> function-based.
>
> Debuggers are beside the point: there are two kinds of "convenience
> syntax" on t
2013/5/2 Guido van Rossum
> On Thu, May 2, 2013 at 1:18 PM, fwierzbi...@gmail.com
> wrote:
> > On Thu, May 2, 2013 at 12:07 PM, Ethan Furman
> wrote:
> >> In order for the Enum convenience function to be pickleable, we have
> this
> >> line of code in the metaclass:
> >>
> >> enum_class.__m
On Thu, 2 May 2013 14:15:40 -0700
Eli Bendersky wrote:
>
> Sorry, but I do find the argument "let's not have a convenience syntax
> because enums created with such syntax won't pickle properly from within a
> debugger" not convincing enough :-)
Eli, it would be nice if you stopped with this clai
On Thu, 2 May 2013 14:16:34 -0700
Barry Warsaw wrote:
> On May 02, 2013, at 10:57 PM, Antoine Pitrou wrote:
>
> >On Thu, 2 May 2013 13:48:24 -0700
> >> The problem with (5) is this: you use some library that exports an
> >> enumeration, and you want to use pickling. Now you depend on the way the
2013/5/2 Eli Bendersky :
>
>
>
> On Thu, May 2, 2013 at 1:10 PM, Antoine Pitrou wrote:
>>
>> On Thu, 2 May 2013 15:48:14 -0400
>> Benjamin Peterson wrote:
>> > 2013/5/2 Ethan Furman :
>> > > In order for the Enum convenience function to be pickleable, we have
>> > > this
>> > > line of code in th
On May 02, 2013, at 10:57 PM, Antoine Pitrou wrote:
>On Thu, 2 May 2013 13:48:24 -0700
>> The problem with (5) is this: you use some library that exports an
>> enumeration, and you want to use pickling. Now you depend on the way the
>> library implemented - if it used the convenience API, you can'
On Thu, May 2, 2013 at 2:10 PM, Antoine Pitrou wrote:
> On Thu, 2 May 2013 13:52:29 -0700
> Eli Bendersky wrote:
> >
> > Back to my question from before, though - do we have a real technical
> > limitation of having something like inspect.what_module_am_i_now_in()
> > that's supposed to work for
On Thu, May 2, 2013 at 2:05 PM, Ethan Furman wrote:
> On 05/02/2013 01:52 PM, Eli Bendersky wrote:
>
>>
>> Back to my question from before, though - do we have a real technical
>> limitation of having something like
>> inspect.what_module_am_i_now_**in() that's supposed to work for all
>> Python
On Thu, 2 May 2013 13:52:29 -0700
Eli Bendersky wrote:
>
> Back to my question from before, though - do we have a real technical
> limitation of having something like inspect.what_module_am_i_now_in()
> that's supposed to work for all Python code?
I already gave an answer (e.g. the debugger case
On 05/02/2013 01:52 PM, Eli Bendersky wrote:
Back to my question from before, though - do we have a real technical
limitation of having something like
inspect.what_module_am_i_now_in() that's supposed to work for all Python code?
By which you really mean inspect.what_module_was_I_called_from(
> > > On Thu, 2 May 2013 13:15:00 -0700
> > > Eli Bendersky wrote:
> > > > > Two things that were suggested in private:
> > > > >
> > > > > 1) ask users to pass the module name to the convenience function
> > > > > explicitly (i.e. pass "seasonmodule.Season" instead of "Season" as
> the
> > > > >
On Thu, 2 May 2013 13:48:24 -0700
Eli Bendersky wrote:
> On Thu, May 2, 2013 at 1:39 PM, Barry Warsaw wrote:
>
> > On May 02, 2013, at 10:18 PM, Georg Brandl wrote:
> >
> > >5) accept that convenience-created enums have restrictions such as no
> > >picklability and point them out in the docs?
>
On Thu, May 2, 2013 at 1:39 PM, Guido van Rossum wrote:
> On Thu, May 2, 2013 at 1:18 PM, fwierzbi...@gmail.com
> wrote:
> > On Thu, May 2, 2013 at 12:07 PM, Ethan Furman
> wrote:
> >> In order for the Enum convenience function to be pickleable, we have
> this
> >> line of code in the metaclass
On Thu, May 2, 2013 at 1:39 PM, Barry Warsaw wrote:
> On May 02, 2013, at 10:18 PM, Georg Brandl wrote:
>
> >5) accept that convenience-created enums have restrictions such as no
> >picklability and point them out in the docs?
>
> That would work fine for me, but ultimately I'm with Guido. I jus
On Thu, May 2, 2013 at 9:07 PM, Ethan Furman wrote:
> In order for the Enum convenience function to be pickleable, we have this
> line of code in the metaclass:
>
> enum_class.__module__ = sys._getframe(1).f_globals['__name__']
>
> This works fine for Cpython, but what about the others?
It's
On Thu, 2 May 2013 13:33:21 -0700
Eli Bendersky wrote:
> On Thu, May 2, 2013 at 1:22 PM, Antoine Pitrou wrote:
>
> > On Thu, 2 May 2013 13:15:00 -0700
> > Eli Bendersky wrote:
> > > > Two things that were suggested in private:
> > > >
> > > > 1) ask users to pass the module name to the conveni
On Thu, May 2, 2013 at 1:18 PM, fwierzbi...@gmail.com
wrote:
> On Thu, May 2, 2013 at 12:07 PM, Ethan Furman wrote:
>> In order for the Enum convenience function to be pickleable, we have this
>> line of code in the metaclass:
>>
>> enum_class.__module__ = sys._getframe(1).f_globals['__name__
On May 02, 2013, at 10:18 PM, Georg Brandl wrote:
>5) accept that convenience-created enums have restrictions such as no
>picklability and point them out in the docs?
That would work fine for me, but ultimately I'm with Guido. I just don't want
to have to pass the module name in.
-Barry
___
On Thu, May 2, 2013 at 1:22 PM, Antoine Pitrou wrote:
> On Thu, 2 May 2013 13:15:00 -0700
> Eli Bendersky wrote:
> > > Two things that were suggested in private:
> > >
> > > 1) ask users to pass the module name to the convenience function
> > > explicitly (i.e. pass "seasonmodule.Season" instead
On Thu, May 2, 2013 at 12:07 PM, Ethan Furman wrote:
> In order for the Enum convenience function to be pickleable, we have this
> line of code in the metaclass:
>
> enum_class.__module__ = sys._getframe(1).f_globals['__name__']
>
> This works fine for Cpython, but what about the others?
This
On Thu, 2 May 2013 13:15:00 -0700
Eli Bendersky wrote:
> > Two things that were suggested in private:
> >
> > 1) ask users to pass the module name to the convenience function
> > explicitly (i.e. pass "seasonmodule.Season" instead of "Season" as the
> > class "name"). Guido doesn't like it :-)
> >
Am 02.05.2013 22:10, schrieb Antoine Pitrou:
> On Thu, 2 May 2013 15:48:14 -0400
> Benjamin Peterson wrote:
>> 2013/5/2 Ethan Furman :
>> > In order for the Enum convenience function to be pickleable, we have this
>> > line of code in the metaclass:
>> >
>> > enum_class.__module__ = sys._getfr
On Thu, May 2, 2013 at 1:10 PM, Antoine Pitrou wrote:
> On Thu, 2 May 2013 15:48:14 -0400
> Benjamin Peterson wrote:
> > 2013/5/2 Ethan Furman :
> > > In order for the Enum convenience function to be pickleable, we have
> this
> > > line of code in the metaclass:
> > >
> > > enum_class.__mod
On Thu, 2 May 2013 15:48:14 -0400
Benjamin Peterson wrote:
> 2013/5/2 Ethan Furman :
> > In order for the Enum convenience function to be pickleable, we have this
> > line of code in the metaclass:
> >
> > enum_class.__module__ = sys._getframe(1).f_globals['__name__']
> >
> > This works fine f
2013/5/2 Ethan Furman :
> In order for the Enum convenience function to be pickleable, we have this
> line of code in the metaclass:
>
> enum_class.__module__ = sys._getframe(1).f_globals['__name__']
>
> This works fine for Cpython, but what about the others?
Regardless of that, perhaps we sho
In order for the Enum convenience function to be pickleable, we have this line
of code in the metaclass:
enum_class.__module__ = sys._getframe(1).f_globals['__name__']
This works fine for Cpython, but what about the others?
--
~Ethan~
___
Python-
42 matches
Mail list logo