[Python-Dev] Deprecating builtin id (and moving it to sys())

2005-08-17 Thread Christian Robottom Reis
In Launchpad (mainly because SQLObject is used) we end up with quite a few locals named id. Apart from the fact that naturally clobbering builtins is a bad idea, we get quite a few warnings when linting throughout the codebase. I've fixed these as I've found them, but today Andrew pointed out to m

Re: [Python-Dev] Deprecating builtin id (and moving it to sys())

2005-08-17 Thread Raymond Hettinger
[Christian Robottom Reis] > I've done some searching through my code and id() isn't the most-used > builtin, so from my perspective the impact would be limited, but of > course others might think otherwise. > > Is it worth writing a PEP for this, or is it crack? FWIW, I use id() all the time and

Re: [Python-Dev] Deprecating builtin id (and moving it to sys())

2005-08-17 Thread Timothy Fitz
On 8/17/05, Christian Robottom Reis <[EMAIL PROTECTED]> wrote: > I've done some searching through my code and id() isn't the most-used > builtin, so from my perspective the impact would be limited, but of > course others might think otherwise. All of my primary uses of id would not show up in such

Re: [Python-Dev] Deprecating builtin id (and moving it to sys())

2005-08-17 Thread Jeremy Hylton
I'd like to see the builtin id() removed so that I can use it as a local variable name without clashing with the builtin name. I certainly use the id() function, but not as often as I have a local variable I'd like to name id. The sys module seems like a natural place to put id(), since it is exp

Re: [Python-Dev] Deprecating builtin id (and moving it to sys())

2005-08-17 Thread Reinhold Birkenfeld
Christian Robottom Reis wrote: > In Launchpad (mainly because SQLObject is used) we end up with quite a > few locals named id. Apart from the fact that naturally clobbering > builtins is a bad idea, we get quite a few warnings when linting > throughout the codebase. I've fixed these as I've found t

Re: [Python-Dev] Deprecating builtin id (and moving it to sys())

2005-08-17 Thread Samuele Pedroni
Jeremy Hylton wrote: > I'd like to see the builtin id() removed so that I can use it as a > local variable name without clashing with the builtin name. I > certainly use the id() function, but not as often as I have a local > variable I'd like to name id. The sys module seems like a natural > pla

Re: [Python-Dev] Deprecating builtin id (and moving it to sys())

2005-08-17 Thread Barry Warsaw
On Wed, 2005-08-17 at 12:37, Jeremy Hylton wrote: > I'd like to see the builtin id() removed so that I can use it as a > local variable name without clashing with the builtin name. I > certainly use the id() function, but not as often as I have a local > variable I'd like to name id. Same here.

Re: [Python-Dev] Deprecating builtin id (and moving it to sys())

2005-08-17 Thread Brett Cannon
On 8/17/05, Barry Warsaw <[EMAIL PROTECTED]> wrote: > On Wed, 2005-08-17 at 12:37, Jeremy Hylton wrote: > > I'd like to see the builtin id() removed so that I can use it as a > > local variable name without clashing with the builtin name. I > > certainly use the id() function, but not as often as

Re: [Python-Dev] Deprecating builtin id (and moving it to sys())

2005-08-17 Thread Neil Schemenauer
On Wed, Aug 17, 2005 at 06:37:11PM +0200, Reinhold Birkenfeld wrote: > As I can see, this is not going to happen before Py3k, as it is completely > breaking backwards compatibility. As such, a PEP would be unnecessary. We could add sys.id for 2.5 and remove __builtin__.id a some later time (e.g. f

Re: [Python-Dev] Deprecating builtin id (and moving it to sys())

2005-08-17 Thread Facundo Batista
On 8/17/05, Neil Schemenauer <[EMAIL PROTECTED]> wrote: > On Wed, Aug 17, 2005 at 06:37:11PM +0200, Reinhold Birkenfeld wrote: > > As I can see, this is not going to happen before Py3k, as it is completely > > breaking backwards compatibility. As such, a PEP would be unnecessary. > > We could add

Re: [Python-Dev] SWIG and rlcompleter

2005-08-17 Thread Timothy Fitz
On 8/16/05, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > -0 The behavior of dir() already a bit magical. Python is much simpler > to comprehend if we have direct relationships like dir() and vars() > corresponding as closely as possible to the object's dictionary. If > someone injects non-stri

Re: [Python-Dev] SWIG and rlcompleter

2005-08-17 Thread Guido van Rossum
On 8/17/05, Timothy Fitz <[EMAIL PROTECTED]> wrote: > On 8/16/05, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > -0 The behavior of dir() already a bit magical. Python is much simpler > > to comprehend if we have direct relationships like dir() and vars() > > corresponding as closely as possibl

Re: [Python-Dev] SWIG and rlcompleter

2005-08-17 Thread Raymond Hettinger
[Timothy Fitz] > It seems to > me that those who want dir to reflect __dict__ should just use > __dict__ in the first place. The dir() builtin does quite a bit more than obj.__dict__.keys(). >>> class A(list): x = 1 >>> dir(A) ['__add__', '__class__', '__contains__', '__delattr__', '__d

Re: [Python-Dev] SWIG and rlcompleter

2005-08-17 Thread Guido van Rossum
> [Timothy Fitz] > > It seems to > > me that those who want dir to reflect __dict__ should just use > > __dict__ in the first place. [Raymond] > The dir() builtin does quite a bit more than obj.__dict__.keys(). Well that's the whole point, right? We shouldn't conflate the two. I don't see this as

Re: [Python-Dev] SWIG and rlcompleter

2005-08-17 Thread Raymond Hettinger
> > [Timothy Fitz] > > > It seems to > > > me that those who want dir to reflect __dict__ should just use > > > __dict__ in the first place. > > [Raymond] > > The dir() builtin does quite a bit more than obj.__dict__.keys(). > > Well that's the whole point, right? Perhaps. I wasn't taking a po

Re: [Python-Dev] SWIG and rlcompleter

2005-08-17 Thread Guido van Rossum
[me] > > A more useful relationship is > > > > name in dir(x) <==> getattr(x, name) is valid [Raymond] > That would be a useful invariant. Well, the <== part can't really be guaranteed due to the existence of __getattr__ overriding (and all bets are off if __getattribute__ is overridden!), b

[Python-Dev] A testing challenge

2005-08-17 Thread Calvin Austin
When was the last time someone thanked you for writing a test? I tried to think of the last time it happened to me and I can't remember. Well at Spikesource we want to thank you not just for helping the Python community but for your testing efforts too and we are running a participatory testi

Re: [Python-Dev] Deprecating builtin id (and moving it to sys())

2005-08-17 Thread eric jones
Barry Warsaw wrote: >On Wed, 2005-08-17 at 12:37, Jeremy Hylton wrote: > > >>I'd like to see the builtin id() removed so that I can use it as a >>local variable name without clashing with the builtin name. I >>certainly use the id() function, but not as often as I have a local >>variable I'd li

Re: [Python-Dev] SWIG and rlcompleter

2005-08-17 Thread James Y Knight
On Aug 17, 2005, at 2:55 PM, Timothy Fitz wrote: > On 8/16/05, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > >> -0 The behavior of dir() already a bit magical. Python is much >> simpler >> to comprehend if we have direct relationships like dir() and vars() >> corresponding as closely as poss

Re: [Python-Dev] Deprecating builtin id (and moving it to, sys())

2005-08-17 Thread Paul F. Dubois
-1 for this proposal from me. I use id some and therefore the change would break some of my code. Breaking existing code without some overwhelming reason is a very bad idea, in my opinion. The reason cited here, that the name is so natural that one is tempted to use it, applies to many builtins

Re: [Python-Dev] Deprecating builtin id (and moving it to sys())

2005-08-17 Thread Anthony Baxter
On Thursday 18 August 2005 00:02, Christian Robottom Reis wrote: > I wonder: is moving id() to sys doable in the 2.5 cycle, with a > deprecation warning being raised for people using the builtin? We'd then > phase it out in one of the latter 2.x versions. I'm neutral on putting id() also into sys.