Re: [Python-3000] [Python-ideas] Namespaces are one honking great idea -- let's do more of those!

2008-02-06 Thread Nick Coghlan
Mike Meyer wrote: > On Wed, 06 Feb 2008 01:01:05 +1000 Nick Coghlan <[EMAIL PROTECTED]> wrote: >> While I'm +1 on the idea of making altinstall the default for setup.py >> and the Windows installer (forcing the administrator to explicitly >> request that the new Python version be made the default

Re: [Python-3000] Namespaces are one honking great idea -- let's do more of those!

2008-02-06 Thread Mike Meyer
On Wed, 06 Feb 2008 10:32:53 +0900 "Stephen J. Turnbull" <[EMAIL PROTECTED]> wrote: > Mike Meyer writes: > > On Tue, 05 Feb 2008 08:20:00 +0900 "Stephen J. Turnbull" <[EMAIL > PROTECTED]> wrote: > > > Mike Meyer writes: > > > > On Mon, 04 Feb 2008 20:22:04 +0900 "Stephen J. Turnbull" <[EMAIL

Re: [Python-3000] Namespaces are one honking great idea -- let's do more of those!

2008-02-06 Thread nathan binkert
This is very similar to the #! idea and is really just an extension. Python 2 clearly cannot execute python 3 code, but how hard would it be to require something like a __pyversion__ = 3 statement at the top of the file. If the line does not exist, the python3 binary would dlopen libpython2.x and

Re: [Python-3000] [Python-ideas] Namespaces are one honking great idea -- let's do more of those!

2008-02-06 Thread Christian Heimes
Phillip J. Eby wrote: > FYI, setuptools uses and supports #! lines on Windows, with the > executable path in quotes if it contains spaces. For a given script > "foo", it generates two files: > > foo.exe > foo-script.py > > And the .exe is just a standardized .exe file that looks in a

Re: [Python-3000] [Python-ideas] Namespaces are one honking great idea -- let's do more of those!

2008-02-06 Thread Christian Heimes
Phillip J. Eby wrote: > FYI, setuptools uses and supports #! lines on Windows, with the > executable path in quotes if it contains spaces. For a given script > "foo", it generates two files: > > foo.exe > foo-script.py > > And the .exe is just a standardized .exe file that looks in a

Re: [Python-3000] Free list for small longs

2008-02-06 Thread Martin v. Löwis
> My new > sys._compact_freelists() deallocates the float and int blocks which do > not contain a referenced object. I wonder whether such a thing should run as a side effect of a full garbage collection, also. GC has a chance to free up arenas for good, and allocated-but-unused blocks on arenas

Re: [Python-3000] [Python-ideas] Namespaces are one honking great idea -- let's do more of those!

2008-02-06 Thread Thomas Heller
Christian Heimes schrieb: > Phillip J. Eby wrote: >> FYI, setuptools uses and supports #! lines on Windows, with the >> executable path in quotes if it contains spaces. For a given script >> "foo", it generates two files: >> >> foo.exe >> foo-script.py >> >> And the .exe is just a st

Re: [Python-3000] [Python-ideas] Namespaces are one honking great idea -- let's do more of those!

2008-02-06 Thread Phillip J. Eby
At 07:38 PM 2/6/2008 +0100, Christian Heimes wrote: >The first line of the file is read and parsed. The line must start with >a shebang (#!). Contrary to your script it doesn't look for a complete >path but searches for pythonX.Y. "#!python2.5" or "#!/usr/bin/python2.5" >both work. > >Then the laun

Re: [Python-3000] Free list for small longs

2008-02-06 Thread Christian Heimes
Martin v. Löwis wrote: > I wonder whether such a thing should run as a side effect of a full > garbage collection, also. GC has a chance to free up arenas for good, > and allocated-but-unused blocks on arenas prevent Python from returning > them to the OS. Under which condition does a full garbag

[Python-3000] ABC method mismatch

2008-02-06 Thread Raymond Hettinger
The tuple class is registered to the collections.Sequence ABC, but it does not support count() and index() as required by the ABC. Do you want to drop those methods from the ABC or add them to tuple? Raymond ___ Python-3000 mailing list Python-3000@py

Re: [Python-3000] ABC method mismatch

2008-02-06 Thread Guido van Rossum
On Feb 6, 2008 2:29 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > The tuple class is registered to the collections.Sequence ABC, but it does > not support count() and index() as required by the ABC. Good catch! > Do you want to drop those methods from the ABC or add them to tuple? I'm not

Re: [Python-3000] ABC method mismatch

2008-02-06 Thread Raymond Hettinger
>> Do you want to drop those methods from the ABC or add them to tuple? > I'm not sure, but I'm tempted to add them to the ABC. > What's your hunch? My hunch is that adding count() and index() to tuple is at harmless at worst and sometimes helpful at best (I've occasionally needed them and felt m

Re: [Python-3000] ABC method mismatch

2008-02-06 Thread Fred Drake
On Feb 6, 2008 2:29 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > Do you want to drop those methods from the ABC or add them to tuple? On Feb 6, 2008, at 5:40 PM, Guido van Rossum wrote: > I'm not sure, but I'm tempted to add them to the ABC. What's your > Is Guido having a bad typing day?

Re: [Python-3000] ABC method mismatch

2008-02-06 Thread Guido van Rossum
On Feb 6, 2008 2:58 PM, Fred Drake <[EMAIL PROTECTED]> wrote: > On Feb 6, 2008 2:29 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > Do you want to drop those methods from the ABC or add them to tuple? > > > On Feb 6, 2008, at 5:40 PM, Guido van Rossum wrote: > > I'm not sure, but I'm tempted t

Re: [Python-3000] Free list for small longs

2008-02-06 Thread Martin v. Löwis
Christian Heimes wrote: > Martin v. Löwis wrote: >> I wonder whether such a thing should run as a side effect of a full >> garbage collection, also. GC has a chance to free up arenas for good, >> and allocated-but-unused blocks on arenas prevent Python from returning >> them to the OS. > > Under

Re: [Python-3000] ABC method mismatch

2008-02-06 Thread Raymond Hettinger
[Fred Drake] > I'd be happy seeing these methods added to tuple; there's > no reason that they would only be useful on mutable sequences. That reminds me, I've always thought Sequence.__contains__(). should always be accompanied by Sequence.index(). Their use cases are strongly related: Good n

Re: [Python-3000] Free list for small longs

2008-02-06 Thread Christian Heimes
Martin v. Löwis wrote: > Both. Let (a,b,c) equal gc.get_threshold(), then a full gc happens > after a*b*c object allocations (roughly; early object deallocations > are deducted from that number). Currently, this product is 7. I see. 70k is a large number. Do you have some real world experience

[Python-3000] Should ABCMeta.register() do validation and emit warnings

2008-02-06 Thread Raymond Hettinger
It's interesting that tuples could be registered as Sequences without having all the requisite methods. Should the register() method to some sort of validation that all public methods in the ABC are in the class/type being registered? Raymond ___ Py

Re: [Python-3000] ABC method mismatch

2008-02-06 Thread Aahz
On Wed, Feb 06, 2008, Guido van Rossum wrote: > On Feb 6, 2008 2:58 PM, Fred Drake <[EMAIL PROTECTED]> wrote: >> >> I'd be happy seeing these methods added to tuple; there's no reason >> that they would only be useful on mutable sequences. > > Sounds like this is the consensus. Go for it, Raymond

Re: [Python-3000] ABC method mismatch

2008-02-06 Thread Guido van Rossum
On Feb 6, 2008 5:21 PM, Aahz <[EMAIL PROTECTED]> wrote: > On Wed, Feb 06, 2008, Guido van Rossum wrote: > > On Feb 6, 2008 2:58 PM, Fred Drake <[EMAIL PROTECTED]> wrote: > >> > >> I'd be happy seeing these methods added to tuple; there's no reason > >> that they would only be useful on mutable sequ

Re: [Python-3000] Should ABCMeta.register() do validation and emit warnings

2008-02-06 Thread Guido van Rossum
On Feb 6, 2008 5:17 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > It's interesting that tuples could be registered as Sequences without having > all the requisite methods. Should the register() method to some sort of > validation that all public methods in the ABC are in the class/type bein

Re: [Python-3000] Should ABCMeta.register() do validation and emit warnings

2008-02-06 Thread Raymond Hettinger
> I think the Zope/Twisted interfaces have gone here before. > I believe they have a separate validation call which is > typically only invoked in unittests. +1 That seems like a good idea. Raymond ___ Python-3000 mailing list [email protected]

Re: [Python-3000] Namespaces are one honking great idea -- let's do more of those!

2008-02-06 Thread Stephen J. Turnbull
Mike Meyer writes: > Personally, I think *this* [proposal to link 2.x to 2.y for y < x] > is a crock. But if you're going to advocate that people lie about > what versions they have installed, If you insist on that interpretation, consider that it's no different from the common cc -> gcc link.

Re: [Python-3000] Free list for small longs

2008-02-06 Thread Martin v. Löwis
>> Both. Let (a,b,c) equal gc.get_threshold(), then a full gc happens >> after a*b*c object allocations (roughly; early object deallocations >> are deducted from that number). Currently, this product is 7. > > I see. 70k is a large number. Do you have some real world experience how > often a a

Re: [Python-3000] Free list for small longs

2008-02-06 Thread Martin v. Löwis
Not from a real world application, no. If you run the program below with And now for the program below... Regards, Martin import gc,sys,time gc.set_debug(gc.DEBUG_STATS) t=time.time() l = [] l.append(l) for i in range(10): l.append([]) del l print >>sys.stderr,"Done looping: final gen