Re: [Python-Dev] Use an empty def as a lambda

2013-09-19 Thread Steven D'Aprano
On Thu, Sep 19, 2013 at 01:54:08PM -0700, Ben Gift wrote: > I think the lambda keyword is difficult to understand for many people. It > would be more pythonic to use an empty def call instead. Hi Ben, and welcome! Is this your first post? I'm afraid I don't recognise your name. I think this disc

Re: [Python-Dev] Use an empty def as a lambda

2013-09-19 Thread Ryan Gonzalez
Nice idea, BUT... Not sure how a parser addition that supports it would go. Imagine this: if you did a one-line function: def test(x): print(x) Python could interpret it two ways: `def` `name` `lparen` `name` `rparen` `colon`... OR, it could see it as a lambda-like thingamajig and throw a synt

Re: [Python-Dev] Use an empty def as a lambda

2013-09-19 Thread Alexander Belopolsky
On Thu, Sep 19, 2013 at 4:54 PM, Ben Gift wrote: > It would be more pythonic to use an empty def call instead. No, it won't. Python draws a very strong distinction between expressions and statements. This line has been blurred somewhat with the advent of comprehensions and the if-else expres

Re: [Python-Dev] Use an empty def as a lambda

2013-09-19 Thread Joe Pinsonault
I think it's a great idea personally. It's explicit and obvious. "lamda" is too computer sciencey On Sep 19, 2013 1:55 PM, "Ben Gift" wrote: > I think the lambda keyword is difficult to understand for many people. It > would be more pythonic to use an empty def call instead. > > For instance this

[Python-Dev] Use an empty def as a lambda

2013-09-19 Thread Ben Gift
I think the lambda keyword is difficult to understand for many people. It would be more pythonic to use an empty def call instead. For instance this: words.sort(key = lambda x: x[2]) could look like this: words.sort(key = def (x): x[2]) It's obvious and explicit that we're creating an

Re: [Python-Dev] Use an empty def as a lambda

2013-09-19 Thread Nick Coghlan
On 20 Sep 2013 07:04, "Joe Pinsonault" wrote: > > I think it's a great idea personally. It's explicit and obvious. "lamda" is too computer sciencey This suggestion has been made many times, occasionally with the associated "must be contained in parentheses when used as an expression" caveat that

Re: [Python-Dev] Use an empty def as a lambda

2013-09-19 Thread Xavier Morel
On 2013-09-19, at 23:17 , Nick Coghlan wrote: > On 20 Sep 2013 07:04, "Joe Pinsonault" wrote: >> >> I think it's a great idea personally. It's explicit and obvious. "lamda" > is too computer sciencey > > This suggestion has been made many times, occasionally with the associated > "must be conta

Re: [Python-Dev] PEP 447: add type.__locallookup__

2013-09-19 Thread Eric Snow
On Thu, Sep 19, 2013 at 3:49 AM, Ronald Oussoren wrote: > On 14 Sep, 2013, at 8:30, Nick Coghlan wrote: > > However, I agree the current wording only conveys that to the handful > > of people that already know exactly when in the attribute lookup > > sequence that step occurs, which is a rather n

Re: [Python-Dev] PEP 447: add type.__locallookup__

2013-09-19 Thread Eric Snow
On Thu, Sep 19, 2013 at 4:12 AM, Nick Coghlan wrote: > On 19 Sep 2013 20:00, "Paul Moore" wrote: > > > > On 19 September 2013 10:32, Ronald Oussoren > wrote: > > > The first time a method is called the bridge looks for an Objective-C > selector > > > with the same name and adds that to the clas

Re: [Python-Dev] PEP 447: add type.__locallookup__

2013-09-19 Thread Eric Snow
On Thu, Sep 19, 2013 at 4:04 AM, Ronald Oussoren wrote: > The C code uses PyDict_GetItem and AFAIK that doesn't look for a > __getitem__ > implementation in a subclass. > Yeah, the PyDict_* API is definitely not subclass friendly. :( -eric ___ Python-D

Re: [Python-Dev] PEP 453 Round 4 - Explicit bootstrapping of pip in Python installations

2013-09-19 Thread Paul Tagliamonte
On Thu, Sep 19, 2013 at 11:48:49PM +1000, Nick Coghlan wrote: > That's OK, especially if running "pip" recommends installing "python-pip" and > "pyvenv" and "extractpip" are also separated out so that running "pyvenv" > recommends installing a suitable package that depends on both Python and > "pyt

Re: [Python-Dev] PEP 453 Round 4 - Explicit bootstrapping of pip in Python installations

2013-09-19 Thread Paul Tagliamonte
On Thu, Sep 19, 2013 at 09:27:24AM -0400, Donald Stufft wrote: > Rationale > = > > Currently, on systems without a platform package manager and repository, > installing a third-party Python package into a freshly installed Python > requires first identifying an appropriate package manager

Re: [Python-Dev] PEP 453 Round 4 - Explicit bootstrapping of pip in Python installations

2013-09-19 Thread Donald Stufft
I've updated the PEP to include the solution for Debian that Nick mentioned and to clarify the behavior in the upgrade case. Online: http://hg.python.org/peps/rev/6c1b658bc16c diff -r 2899ba3bcef1 pep-0453.txt --- a/pep-0453.txt Thu Sep 19 09:23:03 2013 -0400 +++ b/pep-0453.txt Thu Sep

Re: [Python-Dev] PEP 453 Round 4 - Explicit bootstrapping of pip in Python installations

2013-09-19 Thread Nick Coghlan
On 19 Sep 2013 23:53, "Antoine Pitrou" wrote: > > Le Thu, 19 Sep 2013 09:27:24 -0400, > Donald Stufft a écrit : > > We've updated PEP453 based on some of the early feedback we've gotten > > from -dev and Martin. > > > > Major changes: > > > > * Removal of the option to fetch pip from PyPI in orde

Re: [Python-Dev] PEP 453 Round 4 - Explicit bootstrapping of pip in Python installations

2013-09-19 Thread Nick Coghlan
On 19 Sep 2013 23:43, "Paul Moore" wrote: > > On 19 September 2013 14:27, Donald Stufft wrote: > > Major changes: > > > > * Removal of the option to fetch pip from PyPI in order not to modify the trust model of the Python installers > > * Consequently rename the model from ``getpip`` to ``extract

Re: [Python-Dev] PEP 453 Round 4 - Explicit bootstrapping of pip in Python installations

2013-09-19 Thread Donald Stufft
On Sep 19, 2013, at 9:50 AM, Paul Tagliamonte wrote: > On Thu, Sep 19, 2013 at 11:48:49PM +1000, Nick Coghlan wrote: >> That's OK, especially if running "pip" recommends installing "python-pip" and >> "pyvenv" and "extractpip" are also separated out so that running "pyvenv" >> recommends install

Re: [Python-Dev] PEP 453 Round 4 - Explicit bootstrapping of pip in Python installations

2013-09-19 Thread Donald Stufft
On Sep 19, 2013, at 9:50 AM, Antoine Pitrou wrote: > Le Thu, 19 Sep 2013 09:27:24 -0400, > Donald Stufft a écrit : >> We've updated PEP453 based on some of the early feedback we've gotten >> from -dev and Martin. >> >> Major changes: >> >> * Removal of the option to fetch pip from PyPI in ord

Re: [Python-Dev] PEP 453 Round 4 - Explicit bootstrapping of pip in Python installations

2013-09-19 Thread Antoine Pitrou
Le Thu, 19 Sep 2013 09:27:24 -0400, Donald Stufft a écrit : > We've updated PEP453 based on some of the early feedback we've gotten > from -dev and Martin. > > Major changes: > > * Removal of the option to fetch pip from PyPI in order not to modify > the trust model of the Python installers > *

Re: [Python-Dev] PEP 453 Round 4 - Explicit bootstrapping of pip in Python installations

2013-09-19 Thread Donald Stufft
On Sep 19, 2013, at 9:43 AM, Paul Moore wrote: > On 19 September 2013 14:27, Donald Stufft wrote: >> Major changes: >> >> * Removal of the option to fetch pip from PyPI in order not to modify the >> trust model of the Python installers >> * Consequently rename the model from ``getpip`` to ``e

Re: [Python-Dev] PEP 453 Round 4 - Explicit bootstrapping of pip in Python installations

2013-09-19 Thread Nick Coghlan
On 19 Sep 2013 23:37, "Paul Tagliamonte" wrote: > > On Thu, Sep 19, 2013 at 09:27:24AM -0400, Donald Stufft wrote: > > Rationale > > = > > > > Currently, on systems without a platform package manager and repository, > > installing a third-party Python package into a freshly installed Pytho

Re: [Python-Dev] PEP 453 Round 4 - Explicit bootstrapping of pip in Python installations

2013-09-19 Thread Donald Stufft
On Sep 19, 2013, at 9:36 AM, Paul Tagliamonte wrote: > On Thu, Sep 19, 2013 at 09:27:24AM -0400, Donald Stufft wrote: >> Rationale >> = >> >> Currently, on systems without a platform package manager and repository, >> installing a third-party Python package into a freshly installed Pyth

Re: [Python-Dev] PEP 453 Round 4 - Explicit bootstrapping of pip in Python installations

2013-09-19 Thread Paul Moore
On 19 September 2013 14:27, Donald Stufft wrote: > Major changes: > > * Removal of the option to fetch pip from PyPI in order not to modify the > trust model of the Python installers > * Consequently rename the model from ``getpip`` to ``extractpip`` If extractpip (I agree, I don't like the name

Re: [Python-Dev] PEP 453 Round 4 - Explicit bootstrapping of pip in Python installations

2013-09-19 Thread Nick Coghlan
On 19 Sep 2013 23:30, "Donald Stufft" wrote: > > > On Sep 19, 2013, at 9:27 AM, Donald Stufft wrote: > > > We've updated PEP453 based on some of the early feedback we've gotten from -dev and Martin. > > > > Major changes: > > > > * Removal of the option to fetch pip from PyPI in order not to modi

Re: [Python-Dev] PEP 453 Round 4 - Explicit bootstrapping of pip in Python installations

2013-09-19 Thread Donald Stufft
On Sep 19, 2013, at 9:27 AM, Donald Stufft wrote: > We've updated PEP453 based on some of the early feedback we've gotten from > -dev and Martin. > > Major changes: > > * Removal of the option to fetch pip from PyPI in order not to modify the > trust model of the Python installers > * Conseq

[Python-Dev] PEP 453 Round 4 - Explicit bootstrapping of pip in Python installations

2013-09-19 Thread Donald Stufft
We've updated PEP453 based on some of the early feedback we've gotten from -dev and Martin. Major changes: * Removal of the option to fetch pip from PyPI in order not to modify the trust model of the Python installers * Consequently rename the model from ``getpip`` to ``extractpip`` Also avai

Re: [Python-Dev] PEP 447: add type.__locallookup__

2013-09-19 Thread Ronald Oussoren
On 14 Sep, 2013, at 8:30, Nick Coghlan wrote: > > >>> but the *primary* purpose is to >>> customise the retrieval of objects that will be checked to see if they're >>> descriptors. >> >> If that's the case, the PEP should make that clear. > > Technically, that's what "Currently object.__geta

Re: [Python-Dev] PEP 447: add type.__locallookup__

2013-09-19 Thread Ronald Oussoren
On 19 Sep, 2013, at 12:12, Nick Coghlan wrote: > > On 19 Sep 2013 20:00, "Paul Moore" wrote: > > > > On 19 September 2013 10:32, Ronald Oussoren wrote: > > > The first time a method is called the bridge looks for an Objective-C > > > selector > > > with the same name and adds that to the cla

Re: [Python-Dev] PEP 447: add type.__locallookup__

2013-09-19 Thread Nick Coghlan
On 19 Sep 2013 20:00, "Paul Moore" wrote: > > On 19 September 2013 10:32, Ronald Oussoren wrote: > > The first time a method is called the bridge looks for an Objective-C selector > > with the same name and adds that to the class dictionary. This works fine for normal > > method lookups, by overr

Re: [Python-Dev] PEP 447: add type.__locallookup__

2013-09-19 Thread Ronald Oussoren
On 19 Sep, 2013, at 12:00, Paul Moore wrote: > On 19 September 2013 10:32, Ronald Oussoren wrote: >> The first time a method is called the bridge looks for an Objective-C >> selector >> with the same name and adds that to the class dictionary. This works fine >> for normal >> method lookups,

Re: [Python-Dev] PEP 447: add type.__locallookup__

2013-09-19 Thread Paul Moore
On 19 September 2013 10:32, Ronald Oussoren wrote: > The first time a method is called the bridge looks for an Objective-C selector > with the same name and adds that to the class dictionary. This works fine for > normal > method lookups, by overriding __getattribute__, but causes problems with

Re: [Python-Dev] PEP 447: add type.__locallookup__

2013-09-19 Thread Ronald Oussoren
On 14 Sep, 2013, at 8:30, Nick Coghlan wrote: [... interesting text that I'll respond to later ...] > > So my proposed name is based on the idea that what Ronald is after > with the PEP is a hook that *only* gets invoked when the interpreter > is doing this hunt for descriptors, but *not* for

Re: [Python-Dev] PEP 447: add type.__locallookup__

2013-09-19 Thread Ronald Oussoren
On 13 Sep, 2013, at 18:19, Steve Dower wrote: > From: Steven D'Aprano >> On Fri, Sep 13, 2013 at 04:26:06AM +, Steve Dower wrote: >> >>> Last I checked, looking up in the instance dict us exactly what it >>> does. Even the example you posted is doing that. >> >> The example from the PEP sh

Re: [Python-Dev] PEP 447: add type.__locallookup__

2013-09-19 Thread Ronald Oussoren
On 13 Sep, 2013, at 14:23, Steven D'Aprano wrote: > On Fri, Sep 13, 2013 at 08:42:46PM +1000, Nick Coghlan wrote: >> Perhaps "__getdescriptor__" would work as the method name? Yes, it can >> technically return a non-descriptor, > > So technically that name is, um, what's the term... oh yes, "a

Re: [Python-Dev] PEP 447: add type.__locallookup__

2013-09-19 Thread Ronald Oussoren
On 13 Sep, 2013, at 12:42, Nick Coghlan wrote: > Perhaps "__getdescriptor__" would work as the method name? Yes, it can > technically return a non-descriptor, but the *primary* purpose is to > customise the retrieval of objects that will be checked to see if they're > descriptors. It *won't*