[Python-ideas] PEP 526: why ClassVar instead of ClassAttr?

2017-05-16 Thread Steven D'Aprano
Since PEP 526 is already provisionally accepted, it may be too late to 
bring this up, but I have a question and suggestion about the name 
ClassVar. I've read the PEP but didn't see an answer or rejection to 
this.

https://www.python.org/dev/peps/pep-0526/

Why choose ClassVar over ClassAttr when the usual terminology used in 
the Python community is class and instance *attributes* rather than 
"variables"?

I understand that, in a sense, attributes are variables (unless they're 
constants *wink*) but the term "class variable" sounds very Java-esque 
rather than Pythonic. And it is an uncomfortable fit with a language 
like Python where classes are first class values like ints, strings, 
floats etc:

- we talk about a string variable meaning a variable holding a string;
- a float variable is a variable holding a float;
- a list variable is a variable holding a list;
- so a class variable ought to be a variable holding a class.

I get the intention: we have local, global, instance and class 
variables. But I feel that grouping instance/class with local/global is 
too abstract and "computer sciencey": in practice, instance/class vars 
are used in ways which are different enough from global/local vars that 
they deserve a different name: attributes, members or properties are 
common choices.

(Python of course uses attributes, and properties for a particular kind 
of computed attribute.)

This introduces split terminology: we now talk about annotating class 
attributes with ClassVar. Since there's no GlobalVar, NonLocalVar or 
LocalVar, there doesn't seem to be any good reason to stick with the 
FooVar naming system.

Can we change the annotation to ClassAttr instead?



-- 
Steve
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


Re: [Python-ideas] JavaScript-Style Object Creation in Python (using a constructor function instead of a class to create objects)

2017-05-16 Thread Guido van Rossum
Stephen,

What features of attrs specifically solve your use cases?

--Guido

On Tue, May 16, 2017 at 12:18 PM, Stephan Houben 
wrote:

> Hi all,
>
> Thanks to this thread I learned about the "attrs" library. I am a
> heavy namedtuple (ab)user but I think
> I will be using attrs going forward.
>
> If something like attrs would made it in the standard library it would
> be awesome.
>
> Thanks,
>
> Stephan
>
> 2017-05-16 20:08 GMT+02:00 Brett Cannon :
> > Maybe we can bring this up as a lightning talk at the language summit to
> see
> > who in the room has the appropriate background knowledge? And obviously
> > someone can talk to Hynek to see if he wants to provide input based on
> > community feedback for attrs and lessons learned.
> >
> > On Tue, 16 May 2017 at 08:11 Guido van Rossum 
> wrote:
> >>
> >> Maybe Lukasz is interested?
> >>
> >> On May 16, 2017 8:00 AM, "Chris Angelico"  wrote:
> >>>
> >>> On Wed, May 17, 2017 at 12:53 AM, Guido van Rossum 
> >>> wrote:
> >>> > I could also try this myself in my spare time at PyCon
> (surprisingly, I
> >>> > have
> >>> > some!). It sounds kind of interesting. However I've never used the
> >>> > 'attrs'
> >>> > package...
> >>>
> >>> Me neither, so I'm not really an ideal person to head this up. Is
> >>> there anyone who (a) knows what is and isn't Pythonic, (b) has used
> >>> 'attrs', and (c) has spare time? It's not an easy trifecta but we can
> >>> hope!
> >>>
> >>> ChrisA
> >>> ___
> >>> Python-ideas mailing list
> >>> Python-ideas@python.org
> >>> https://mail.python.org/mailman/listinfo/python-ideas
> >>> Code of Conduct: http://python.org/psf/codeofconduct/
> >>
> >> ___
> >> Python-ideas mailing list
> >> Python-ideas@python.org
> >> https://mail.python.org/mailman/listinfo/python-ideas
> >> Code of Conduct: http://python.org/psf/codeofconduct/
> >
> >
> > ___
> > Python-ideas mailing list
> > Python-ideas@python.org
> > https://mail.python.org/mailman/listinfo/python-ideas
> > Code of Conduct: http://python.org/psf/codeofconduct/
> >
>



-- 
--Guido van Rossum (python.org/~guido)
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


Re: [Python-ideas] JavaScript-Style Object Creation in Python (using a constructor function instead of a class to create objects)

2017-05-16 Thread Brett Cannon
Maybe we can bring this up as a lightning talk at the language summit to
see who in the room has the appropriate background knowledge? And obviously
someone can talk to Hynek to see if he wants to provide input based on
community feedback for attrs and lessons learned.

On Tue, 16 May 2017 at 08:11 Guido van Rossum  wrote:

> Maybe Lukasz is interested?
>
> On May 16, 2017 8:00 AM, "Chris Angelico"  wrote:
>
>> On Wed, May 17, 2017 at 12:53 AM, Guido van Rossum 
>> wrote:
>> > I could also try this myself in my spare time at PyCon (surprisingly, I
>> have
>> > some!). It sounds kind of interesting. However I've never used the
>> 'attrs'
>> > package...
>>
>> Me neither, so I'm not really an ideal person to head this up. Is
>> there anyone who (a) knows what is and isn't Pythonic, (b) has used
>> 'attrs', and (c) has spare time? It's not an easy trifecta but we can
>> hope!
>>
>> ChrisA
>> ___
>> Python-ideas mailing list
>> Python-ideas@python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
> ___
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


Re: [Python-ideas] Python-ideas Digest, Vol 126, Issue 35

2017-05-16 Thread Brett Cannon
I'm sure at least Hynek will be told about this so he can provide input
based on his experience (but I also know my rough approximation of this
idea somewhat horrified him so I don't know he supportive he will be either
:) .

On Tue, 16 May 2017 at 09:58 Tin Tvrtković  wrote:

> I have it on good authority both Hynek (the author of attrs) and Glyph
> will be attending PyCon. I think it'd be a shame if they weren't involved
> with this effort somehow.
>
>
>> Message: 2
>> Date: Tue, 16 May 2017 07:53:50 -0700
>> From: Guido van Rossum 
>> To: Ivan Levkivskyi 
>> Cc: ? , "python-ideas@python.org"
>> 
>> Subject: Re: [Python-ideas] JavaScript-Style Object Creation in Python
>> (using a constructor function instead of a class to create
>> objects)
>> Message-ID:
>> <
>> cap7+vjjynk+mqtjfvxavxxo5qnbe2su0mrxhjzwepkmcd7h...@mail.gmail.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>> I could also try this myself in my spare time at PyCon (surprisingly, I
>> have some!). It sounds kind of interesting. However I've never used the
>> 'attrs' package...
>>
>> On Tue, May 16, 2017 at 7:52 AM, Ivan Levkivskyi 
>> wrote:
>>
>> > On 15 May 2017 at 18:22, Guido van Rossum  wrote:
>> >
>> >> I expect that we will need someone with a really good sensibility for
>> >> Pythonic language/API design to lead the PEP writing.
>> >>
>> >
>> > I probably don't have good sensibility for Pythonic API design yet (and
>> I
>> > am more focused on PEP 544) so I cannot lead this,
>> > but I would like to actively participate in writing.
>> >
>> > --
>> > Ivan
>> >
>> >
>> >
>>
>>
>> --
>> --Guido van Rossum (python.org/~guido)
>>
>
> ___
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


Re: [Python-ideas] Python-ideas Digest, Vol 126, Issue 35

2017-05-16 Thread Tin Tvrtković
I have it on good authority both Hynek (the author of attrs) and Glyph will
be attending PyCon. I think it'd be a shame if they weren't involved with
this effort somehow.


> Message: 2
> Date: Tue, 16 May 2017 07:53:50 -0700
> From: Guido van Rossum 
> To: Ivan Levkivskyi 
> Cc: ? , "python-ideas@python.org"
> 
> Subject: Re: [Python-ideas] JavaScript-Style Object Creation in Python
> (using a constructor function instead of a class to create objects)
> Message-ID:
>  kmcd7h...@mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> I could also try this myself in my spare time at PyCon (surprisingly, I
> have some!). It sounds kind of interesting. However I've never used the
> 'attrs' package...
>
> On Tue, May 16, 2017 at 7:52 AM, Ivan Levkivskyi 
> wrote:
>
> > On 15 May 2017 at 18:22, Guido van Rossum  wrote:
> >
> >> I expect that we will need someone with a really good sensibility for
> >> Pythonic language/API design to lead the PEP writing.
> >>
> >
> > I probably don't have good sensibility for Pythonic API design yet (and I
> > am more focused on PEP 544) so I cannot lead this,
> > but I would like to actively participate in writing.
> >
> > --
> > Ivan
> >
> >
> >
>
>
> --
> --Guido van Rossum (python.org/~guido)
>
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


Re: [Python-ideas] JavaScript-Style Object Creation in Python (using a constructor function instead of a class to create objects)

2017-05-16 Thread Chris Angelico
On Wed, May 17, 2017 at 12:53 AM, Guido van Rossum  wrote:
> I could also try this myself in my spare time at PyCon (surprisingly, I have
> some!). It sounds kind of interesting. However I've never used the 'attrs'
> package...

Me neither, so I'm not really an ideal person to head this up. Is
there anyone who (a) knows what is and isn't Pythonic, (b) has used
'attrs', and (c) has spare time? It's not an easy trifecta but we can
hope!

ChrisA
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


Re: [Python-ideas] JavaScript-Style Object Creation in Python (using a constructor function instead of a class to create objects)

2017-05-16 Thread Guido van Rossum
I could also try this myself in my spare time at PyCon (surprisingly, I
have some!). It sounds kind of interesting. However I've never used the
'attrs' package...

On Tue, May 16, 2017 at 7:52 AM, Ivan Levkivskyi 
wrote:

> On 15 May 2017 at 18:22, Guido van Rossum  wrote:
>
>> I expect that we will need someone with a really good sensibility for
>> Pythonic language/API design to lead the PEP writing.
>>
>
> I probably don't have good sensibility for Pythonic API design yet (and I
> am more focused on PEP 544) so I cannot lead this,
> but I would like to actively participate in writing.
>
> --
> Ivan
>
>
>


-- 
--Guido van Rossum (python.org/~guido)
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/