[Python-Dev] Documenting the Py3k coercion rules (was Re: Getting values stored inside sets)

2009-04-03 Thread Nick Coghlan
Raymond Hettinger wrote: > > [Nick Coghlan] >> It doesn't quite work the way RDM desribed it - he missed a step. > > Thanks for the clarification. We ought to write-out the process > somewhere in a FAQ. The closest we currently have to that is the write-up of the coercion rules in 2.x: http://

Re: [Python-Dev] core python tests

2009-04-03 Thread Nick Coghlan
C. Titus Brown wrote: > I vote for a separate mailing list -- 'python-tests'? -- but I don't > know exactly how splintered to make the conversation. It probably > belongs at python.org but if you want me to host it, I can. If too many things get moved off to SIGs there won't be anything left for

Re: [Python-Dev] Should the io-c modules be put in their own directory?

2009-04-03 Thread Martin v. Löwis
> I think Benjamin is right. While most of the C source is indeed > exactly one level below the root, there's plenty of code that isn't, > e.g. _ctypes, cjkcodecs, expat, _multiprocessing, zlib. And even > Objects/stringlib. It's fine with me either way. Martin __

Re: [Python-Dev] Going "offline" for three months

2009-04-03 Thread Brett Cannon
On Fri, Apr 3, 2009 at 19:51, Michael Foord wrote: > Brett Cannon wrote: > >> In order to hunker down and get my thesis proposal done by its due date, I >> am disabling mail delivery for myself for all mail.python.org < >> http://mail.python.org> mailing lists for three months (sans >> python-comm

[Python-Dev] core python tests (was: Re: PyDict_SetItem hook)

2009-04-03 Thread C. Titus Brown
On Fri, Apr 03, 2009 at 07:00:43PM +0100, Michael Foord wrote: -> Collin Winter wrote: -> >On Fri, Apr 3, 2009 at 10:28 AM, Michael Foord -> > wrote: -> > -> >>Collin Winter wrote: -> >> -> >>>As part of the common standard library and test suite that we agreed -> >>>on at the PyCon language

Re: [Python-Dev] Going "offline" for three months

2009-04-03 Thread Michael Foord
Brett Cannon wrote: In order to hunker down and get my thesis proposal done by its due date, I am disabling mail delivery for myself for all mail.python.org mailing lists for three months (sans python-committers so I don't accidentally commit when I shouldn't). If some

Re: [Python-Dev] Getting values stored inside sets

2009-04-03 Thread Raymond Hettinger
[Nick Coghlan] It doesn't quite work the way RDM desribed it - he missed a step. Thanks for the clarification. We ought to write-out the process somewhere in a FAQ. It may also be instructive to step through the recipe that answers the OP's original request, http://code.activestate.com/reci

Re: [Python-Dev] Going "offline" for three months

2009-04-03 Thread Ben Finney
Brett Cannon writes: > See you all on July 1. Here is to hoping I don't suffer any > withdrawal. Ouch. Best of luck to you! -- \ “Giving every man a vote has no more made men wise and free | `\ than Christianity has made them good.” —Henry L. Mencken | _o__)

Re: [Python-Dev] Integrate BeautifulSoup into stdlib?

2009-04-03 Thread Martin v. Löwis
> That's not entirely true; Cygwin comes with a package management tool > that probably could be used to set up a repository of python packages > for native Windows: Ah, ok. It has the big disadvantage of not being Microsoft-endorsed, though. In t

Re: [Python-Dev] issue5578 - explanation

2009-04-03 Thread Martin v. Löwis
Alexandre Vassalotti wrote: > On Tue, Mar 31, 2009 at 11:25 PM, Guido van Rossum wrote: >> Well hold on for a minute, I remember we used to have an exec >> statement in a class body in the standard library, to define some file >> methods in socket.py IIRC. > > FYI, collections.namedtuple is also

Re: [Python-Dev] Getting values stored inside sets

2009-04-03 Thread Nick Coghlan
Paul Moore wrote: > 2009/4/3 R. David Murray : >> a == b >> >> So, python calls a.__eq__(b) >> >> Now, that function does: >> >> a.key == b >> >> Since b is an object with an __eq__ method, python calls >> b.__eq__(a.key). > > That's the bit I can't actually find documented anywhere. It doesn't q

[Python-Dev] Going "offline" for three months

2009-04-03 Thread Brett Cannon
In order to hunker down and get my thesis proposal done by its due date, I am disabling mail delivery for myself for all mail.python.org mailing lists for three months (sans python-committers so I don't accidentally commit when I shouldn't). If something comes up I should know about you can always

Re: [Python-Dev] Should the io-c modules be put in their own directory?

2009-04-03 Thread Alexandre Vassalotti
On Fri, Apr 3, 2009 at 5:12 PM, Benjamin Peterson wrote: > I'm +.2. This is the layout I would suggest: > > Modules/ >  _io/ >     _io.c >     stringio.c >     textio.c >     etc > That seems good to me. I opened an issue on the tracker and included a patch. http://bugs.python.org/issue5682

Re: [Python-Dev] And the winner is...

2009-04-03 Thread Jan Claeys
Op maandag 30-03-2009 om 21:54 uur [tijdzone -0500], schreef Guido van Rossum: > But is his humility enough to cancel out Linus's attitude? I hope not, or the /.-crowd would become desperate... ;-) -- Jan Claeys ___ Python-Dev mailing list Python-D

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-03 Thread Brett Cannon
On Fri, Apr 3, 2009 at 13:15, "Martin v. Löwis" wrote: > > Note that there is no such thing as a "defining namespace package" -- > > namespace package contents are symmetrical peers. > > With the PEP, a "defining package" becomes possible - at most one > portion can define an __init__.py. > > I k

Re: [Python-Dev] Getting values stored inside sets

2009-04-03 Thread Leif Walsh
On Fri, Apr 3, 2009 at 8:07 AM, Hrvoje Niksic wrote: > But I can't seem to find a way to retrieve the element corresponding to > 'foo', at least not without iterating over the entire set.  Is this an > oversight or an intentional feature?  Or am I just missing an obvious way to > do this? >>> que

Re: [Python-Dev] issue5578 - explanation

2009-04-03 Thread Alexandre Vassalotti
On Tue, Mar 31, 2009 at 11:25 PM, Guido van Rossum wrote: > Well hold on for a minute, I remember we used to have an exec > statement in a class body in the standard library, to define some file > methods in socket.py IIRC. FYI, collections.namedtuple is also implemented using exec. - Alexandre

Re: [Python-Dev] Integrate BeautifulSoup into stdlib?

2009-04-03 Thread Jan Claeys
Op dinsdag 24-03-2009 om 20:51 uur [tijdzone +0100], schreef "Martin v. Löwis": > The Windows story is indeed sad, as none of the Windows packaging > formats provides support for dependencies That's not entirely true; Cygwin comes with a package management tool that probably could be used to set u

Re: [Python-Dev] Should the io-c modules be put in their own directory?

2009-04-03 Thread Guido van Rossum
On Fri, Apr 3, 2009 at 2:15 PM, Benjamin Peterson wrote: > 2009/4/3 "Martin v. Löwis" : I just noticed that the new io-c modules were merged in the py3k branch (I know, I am kind late on the news—blame school work). Anyway, I am just wondering if it would be a good idea to put the i

Re: [Python-Dev] issue5578 - explanation

2009-04-03 Thread Benjamin Peterson
2009/4/3 Chris Withers : > Guido van Rossum wrote: But anyways this is moot, the bug was only about exec in a class body *nested inside a function*. >>> >>> Indeed, I just hate seeing execs and it was an interesting mental >>> exercise >>> to try and get rid of the above one ;-) >>>

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-03 Thread P.J. Eby
At 10:15 PM 4/3/2009 +0200, Martin v. Löwis wrote: I should make it clear that this is not the case. I envision it to work this way: import zope - searches sys.path, until finding either a directory zope, or a file zope.{py,pyc,pyd,...} - if it is a directory, it checks for .pkg files. If it fi

Re: [Python-Dev] Should the io-c modules be put in their own directory?

2009-04-03 Thread Benjamin Peterson
2009/4/3 "Martin v. Löwis" : >>> I just noticed that the new io-c modules were merged in the py3k >>> branch (I know, I am kind late on the news—blame school work). Anyway, >>> I am just wondering if it would be a good idea to put the io-c modules >>> in a sub-directory (like sqlite), instead of sc

Re: [Python-Dev] Should the io-c modules be put in their own directory?

2009-04-03 Thread Benjamin Peterson
2009/4/3 Antoine Pitrou : > Alexandre Vassalotti peadrop.com> writes: >> >> I just noticed that the new io-c modules were merged in the py3k >> branch (I know, I am kind late on the news—blame school work). Anyway, >> I am just wondering if it would be a good idea to put the io-c modules >> in a s

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-03 Thread glyph
On 08:15 pm, mar...@v.loewis.de wrote: Note that there is no such thing as a "defining namespace package" -- namespace package contents are symmetrical peers. With the PEP, a "defining package" becomes possible - at most one portion can define an __init__.py. For what it's worth, this is a _s

Re: [Python-Dev] PyDict_SetItem hook

2009-04-03 Thread Jeffrey Yasskin
On Thu, Apr 2, 2009 at 5:57 PM, Guido van Rossum wrote: > On Thu, Apr 2, 2009 at 3:07 PM, Raymond Hettinger wrote: >>> Wow. Can you possibly be more negative? >> >> I think it's worse to give the poor guy the run around > > Mind your words please. > >> by making him run lots of random benchmarks.

Re: [Python-Dev] PyDict_SetItem hook

2009-04-03 Thread Jeffrey Yasskin
On Fri, Apr 3, 2009 at 12:28 PM, Michael Foord wrote: > Collin Winter wrote: >> >> On Fri, Apr 3, 2009 at 2:27 AM, Antoine Pitrou >> wrote: >> >>> >>> Thomas Wouters python.org> writes: >>> Pystone is pretty much a useless benchmark. If it measures anything, it's the >>> >>>

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-03 Thread Martin v. Löwis
> Note that there is no such thing as a "defining namespace package" -- > namespace package contents are symmetrical peers. With the PEP, a "defining package" becomes possible - at most one portion can define an __init__.py. I know that the current mechanisms don't support it, and it might not be

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-03 Thread Martin v. Löwis
> I'd like to extend the proposal to Python 2.7 and later. I don't object, but I also don't want to propose this, so I added it to the discussion. My (and perhaps other people's) concern is that 2.7 might well be the last release of the 2.x series. If so, adding this feature to it would make 2.7

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-03 Thread Martin v. Löwis
Chris Withers wrote: > Martin v. Löwis wrote: >> I propose the following PEP for inclusion to Python 3.1. >> Please comment. > > Would this support the following case: > > I have a package called mortar, which defines useful stuff: > > from mortar import content, ... > > I now want to distribut

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-03 Thread Martin v. Löwis
> Perhaps we could add something like a sys.namespace_packages that would > be updated by this mechanism? Then, pkg_resources could check both that > and its internal registry to be both backward and forward compatible. I could see no problem with that, so I have added this to the PEP. Thanks fo

Re: [Python-Dev] issue5578 - explanation

2009-04-03 Thread Steve Holden
Chris Withers wrote: > Guido van Rossum wrote: But anyways this is moot, the bug was only about exec in a class body *nested inside a function*. >>> Indeed, I just hate seeing execs and it was an interesting mental >>> exercise >>> to try and get rid of the above one ;-) >>> >>> Assuming

Re: [Python-Dev] PyDict_SetItem hook

2009-04-03 Thread Collin Winter
On Fri, Apr 3, 2009 at 10:50 AM, Antoine Pitrou wrote: > Collin Winter gmail.com> writes: >> >> - I wish PyBench actually did more isolation. >> Call.py:ComplexPythonFunctionCalls is on my mind right now; I wish it >> didn't put keyword arguments and **kwargs in the same microbenchmark. > > Well,

Re: [Python-Dev] PyDict_SetItem hook

2009-04-03 Thread Michael Foord
Collin Winter wrote: On Fri, Apr 3, 2009 at 10:28 AM, Michael Foord wrote: Collin Winter wrote: As part of the common standard library and test suite that we agreed on at the PyCon language summit last week, we're going to include a common benchmark suite that all Python implementation

Re: [Python-Dev] Getting values stored inside sets

2009-04-03 Thread Paul Moore
2009/4/3 R. David Murray : > a == b > > So, python calls a.__eq__(b) > > Now, that function does: > > a.key == b > > Since b is an object with an __eq__ method, python calls > b.__eq__(a.key). That's the bit I can't actually find documented anywhere. Ah, looking again I see that I misread the sec

Re: [Python-Dev] PyDict_SetItem hook

2009-04-03 Thread Antoine Pitrou
Collin Winter gmail.com> writes: > > - I wish PyBench actually did more isolation. > Call.py:ComplexPythonFunctionCalls is on my mind right now; I wish it > didn't put keyword arguments and **kwargs in the same microbenchmark. Well, there is a balance to be found between having more subtests and

Re: [Python-Dev] PyDict_SetItem hook

2009-04-03 Thread Collin Winter
On Fri, Apr 3, 2009 at 10:28 AM, Michael Foord wrote: > Collin Winter wrote: >> As part of the common standard library and test suite that we agreed >> on at the PyCon language summit last week, we're going to include a >> common benchmark suite that all Python implementations can share. This >> i

Re: [Python-Dev] Getting values stored inside sets

2009-04-03 Thread R. David Murray
On Fri, 3 Apr 2009 at 17:57, Paul Moore wrote: In fact, Python seems to be doing something I don't understand: class Element(object): ...def __init__(self, key, id): ...self.key = key ...self.id = id ...def __eq__(self, other): ...print "Calling __eq__ for %s" %

Re: [Python-Dev] PyDict_SetItem hook

2009-04-03 Thread Michael Foord
Collin Winter wrote: On Fri, Apr 3, 2009 at 2:27 AM, Antoine Pitrou wrote: Thomas Wouters python.org> writes: Pystone is pretty much a useless benchmark. If it measures anything, it's the speed of the bytecode dispatcher (and it doesn't measure it particularly well.) PyBench i

Re: [Python-Dev] PyDict_SetItem hook

2009-04-03 Thread Collin Winter
On Fri, Apr 3, 2009 at 9:43 AM, Antoine Pitrou wrote: > Thomas Wouters python.org> writes: >> >> Really? Have you tried it? I get at least 5% noise between runs without any > changes. I have gotten results that include *negative* run times. > > That's an implementation problem, not an issue with

Re: [Python-Dev] Getting values stored inside sets

2009-04-03 Thread Alexander Belopolsky
I just want to add a link to a 2.5 year old discussion on this issue: . In that discussion I disagreed with Martin and argued that "interning is a set operation and it is unfortunate that set API does not support it directly." On Fri, Apr 3, 2009 at 12:43 PM

Re: [Python-Dev] Getting values stored inside sets

2009-04-03 Thread Raymond Hettinger
Hrvoje Niksic wrote: I've stumbled upon an oddity using sets. It's trivial to test if a value is in the set, but it appears to be impossible to retrieve a stored value, See: http://code.activestate.com/recipes/499299/ Raymond ___ Python-Dev ma

Re: [Python-Dev] Package Management - thoughts from the peanut gallery

2009-04-03 Thread Michael Foord
Chris Withers wrote: Olemis Lang wrote: On Fri, Apr 3, 2009 at 11:20 AM, Chris Withers wrote: Tarek Ziadé wrote: - PyPI mirroring (PEP 381) I don't see why PyPI isn't just ported to GAE with an S3 data storage bit and be done with it... Offline mirrors for people behind firewalls already

Re: [Python-Dev] Package Management - thoughts from the peanut gallery

2009-04-03 Thread Tarek Ziadé
On Fri, Apr 3, 2009 at 6:20 PM, Chris Withers wrote: > Tarek Ziadé wrote: >> >> I have taken the commitment to lead these tasks and synchronize the people >> that are willing to help on this. > > Good, I'm one of those people, Great ! > sadly my only help may be to ask "how is this > bit going

Re: [Python-Dev] PyDict_SetItem hook

2009-04-03 Thread M.-A. Lemburg
On 2009-04-03 18:06, Thomas Wouters wrote: > On Fri, Apr 3, 2009 at 11:27, Antoine Pitrou wrote: > >> Thomas Wouters python.org> writes: >>> >>> Pystone is pretty much a useless benchmark. If it measures anything, it's >> the >> speed of the bytecode dispatcher (and it doesn't measure it particu

Re: [Python-Dev] Getting values stored inside sets

2009-04-03 Thread Paul Moore
2009/4/3 Steven D'Aprano : > Python does not promise that if x == y, you can use y anywhere you can > use x. Nor should it. Paul's declaration of abuse of __eq__ is > unfounded. Sorry, I was trying to simplify what I was saying, and simplified it to the point where it didn't make sense :-) Martin

Re: [Python-Dev] Package Management - thoughts from the peanut gallery

2009-04-03 Thread Chris Withers
Olemis Lang wrote: On Fri, Apr 3, 2009 at 11:20 AM, Chris Withers wrote: Tarek Ziadé wrote: - PyPI mirroring (PEP 381) I don't see why PyPI isn't just ported to GAE with an S3 data storage bit and be done with it... Offline mirrors for people behind firewalls already have solutions out there

Re: [Python-Dev] PyDict_SetItem hook

2009-04-03 Thread John Ehresman
Just want to reply quickly because I'm traveling -- I appreciate the feedback from Raymond and others. Part of the reason I created an issue with a proof of concept patch is to get this kind of feedback. I also agree that this shouldn't go in if it slows things down noticeably. I will do som

Re: [Python-Dev] PyDict_SetItem hook

2009-04-03 Thread Antoine Pitrou
Thomas Wouters python.org> writes: > > Really? Have you tried it? I get at least 5% noise between runs without any changes. I have gotten results that include *negative* run times. That's an implementation problem, not an issue with the tests themselves. Perhaps a better timing mechanism could b

Re: [Python-Dev] Getting values stored inside sets

2009-04-03 Thread Martin v. Löwis
> I've stumbled upon an oddity using sets. It's trivial to test if a > value is in the set, but it appears to be impossible to retrieve a > stored value, other than by iterating over the whole set. Of course it is. That's why it is called a set: it's an unordered collection of objects, keyed by

[Python-Dev] Package Management - thoughts from the peanut gallery

2009-04-03 Thread Olemis Lang
On Fri, Apr 3, 2009 at 11:20 AM, Chris Withers wrote: > Tarek Ziadé wrote: > >> - PyPI mirroring (PEP 381) > > I don't see why PyPI isn't just ported to GAE with an S3 data storage bit > and be done with it... Offline mirrors for people behind firewalls already > have solutions out there... > -1

Re: [Python-Dev] Should the io-c modules be put in their own directory?

2009-04-03 Thread Martin v. Löwis
>> I just noticed that the new io-c modules were merged in the py3k >> branch (I know, I am kind late on the news—blame school work). Anyway, >> I am just wondering if it would be a good idea to put the io-c modules >> in a sub-directory (like sqlite), instead of scattering them around in >> the Mo

Re: [Python-Dev] PyDict_SetItem hook

2009-04-03 Thread Martin v. Löwis
> I think it's worse to give the poor guy the run around > by making him run lots of random benchmarks. "the poor guy" works for Wingware (a company you may have heard of) and has contributed to Python at several occasions. His name is John Ehresmann. > In the end, someone will run a timeit or ha

Re: [Python-Dev] Package Management - thoughts from the peanut gallery

2009-04-03 Thread Chris Withers
Tarek Ziadé wrote: I have taken the commitment to lead these tasks and synchronize the people that are willing to help on this. Good, I'm one of those people, sadly my only help may be to ask "how is this bit going to be done?". The tasks discussed so far are: - version definition (http://

Re: [Python-Dev] PyDict_SetItem hook

2009-04-03 Thread Collin Winter
On Fri, Apr 3, 2009 at 2:27 AM, Antoine Pitrou wrote: > Thomas Wouters python.org> writes: >> >> >> Pystone is pretty much a useless benchmark. If it measures anything, it's the > speed of the bytecode dispatcher (and it doesn't measure it particularly > well.) > PyBench isn't any better, in my

Re: [Python-Dev] Package Management - thoughts from the peanut gallery

2009-04-03 Thread Olemis Lang
On Fri, Apr 3, 2009 at 8:36 AM, Tarek Ziadé wrote: > On Fri, Apr 3, 2009 at 2:56 PM, Olemis Lang wrote: >> >> BTW ... I see nothing about removing dist_* commands from distutils ... >> >> Q: Am I wrong or it seems they will remain in stdlib ? > > This is roughly what Guido was talking about when

Re: [Python-Dev] issue5578 - explanation

2009-04-03 Thread Chris Withers
Guido van Rossum wrote: But anyways this is moot, the bug was only about exec in a class body *nested inside a function*. Indeed, I just hate seeing execs and it was an interesting mental exercise to try and get rid of the above one ;-) Assuming it breaks no tests, would there be objection to m

Re: [Python-Dev] Getting values stored inside sets

2009-04-03 Thread Amaury Forgeot d'Arc
Hi, On Fri, Apr 3, 2009 at 17:45, Sebastian Rittau wrote: > I am missing a simple way to retrieve the "first" element of any > iterable in python that matches a certain condition anyway. Something > like this: > >  def first(iter, cb): >      for el in iter: >          if cb(el): >              r

Re: [Python-Dev] PyDict_SetItem hook

2009-04-03 Thread Thomas Wouters
On Fri, Apr 3, 2009 at 11:27, Antoine Pitrou wrote: > Thomas Wouters python.org> writes: > > > > > > Pystone is pretty much a useless benchmark. If it measures anything, it's > the > speed of the bytecode dispatcher (and it doesn't measure it particularly > well.) > PyBench isn't any better, in

Re: [Python-Dev] Getting values stored inside sets

2009-04-03 Thread Sebastian Rittau
Hello, On Fri, Apr 03, 2009 at 02:07:02PM +0200, Hrvoje Niksic wrote: > But I can't seem to find a way to retrieve the element corresponding to > 'foo', at least not without iterating over the entire set. Is this an > oversight or an intentional feature? Or am I just missing an obvious >

Re: [Python-Dev] Getting values stored inside sets

2009-04-03 Thread Steven D'Aprano
On Sat, 4 Apr 2009 02:07:28 am Antoine Pitrou wrote: > Your example is wrong: Of course it is. The perils of posting at 2am, sorry. Nevertheless, the principle still holds. There's nothing in Python that prohibits two objects from being equal, but without them being interchangeable. As poorly

Re: [Python-Dev] Getting values stored inside sets

2009-04-03 Thread Antoine Pitrou
Steven D'Aprano pearwood.info> writes: > > That's hardly unusual in Python. > > >>> alist = [0, 1, 2, 3, 4] > >>> 3.0 in alist > True > >>> alist[3.0] > Traceback (most recent call last): > File "", line 1, in > TypeError: list indices must be integers Your example is wrong: >>> alist = [0,

Re: [Python-Dev] Getting values stored inside sets

2009-04-03 Thread Steven D'Aprano
On Fri, 3 Apr 2009 11:22:02 pm Paul Moore wrote: > I'd say that you're abusing __eq__ here. If you can say "x in s" > and then can't use x as if it were the actual item inserted into > s, then are they really "equal"? That's hardly unusual in Python. >>> alist = [0, 1, 2, 3, 4] >>> 3.0 in ali

Re: [Python-Dev] Package Management - thoughts from the peanut gallery

2009-04-03 Thread Tarek Ziadé
On Fri, Apr 3, 2009 at 2:56 PM, Olemis Lang wrote: > > BTW ... I see nothing about removing dist_* commands from distutils ... > > Q: Am I wrong or it seems they will remain in stdlib ? Ok, beware that what I am writing here is for the long term. There are no plans yet to remove things right now.

Re: [Python-Dev] Package Management - thoughts from the peanut gallery

2009-04-03 Thread Olemis Lang
2009/4/3 Tarek Ziadé : > Guys, > > The tasks discussed so far are: > > - version definition (http://wiki.python.org/moin/DistutilsVersionFight) > - egg.info standardification (PEP 376) > - metadata enhancement (rewrite PEP 345) > - static metadata definition work  (*) Looks fine ... and very usefu

Re: [Python-Dev] unittest package

2009-04-03 Thread Olemis Lang
On Thu, Apr 2, 2009 at 6:07 PM, Barry Warsaw wrote: > On Apr 2, 2009, at 4:58 PM, Michael Foord wrote: > >> The unittest module is around 1500 lines of code now, and the tests are >> 3000 lines. >> >> It would be much easier to maintain as a package rather than a module. >> Shall I work on a sugge

Re: [Python-Dev] Getting values stored inside sets

2009-04-03 Thread Terry Reedy
Hrvoje Niksic wrote: I've stumbled upon an oddity using sets. It's trivial to test if a value is in the set, but it appears to be impossible to retrieve a stored value, Set elements, by definition, do not have keys or position by which to grab. When they do, use a dict or list. other tha

Re: [Python-Dev] Getting values stored inside sets

2009-04-03 Thread Paul Moore
2009/4/3 Hrvoje Niksic : > I've stumbled upon an oddity using sets.  It's trivial to test if a value is > in the set, but it appears to be impossible to retrieve a stored value, > other than by iterating over the whole set.  Let me describe a concrete use > case. > > Imagine a set of objects identi

[Python-Dev] Getting values stored inside sets

2009-04-03 Thread Hrvoje Niksic
I've stumbled upon an oddity using sets. It's trivial to test if a value is in the set, but it appears to be impossible to retrieve a stored value, other than by iterating over the whole set. Let me describe a concrete use case. Imagine a set of objects identified by some piece of informatio

Re: [Python-Dev] sequence slice that wraps, bug or intention?

2009-04-03 Thread Paul Moore
2009/4/3 Ulrich Eckhardt : > Hi! > > I just stumbled across something in Python 2.6 where I'm not sure if it is by > design or a fault: > > x = 'abdc' > x[-3:-3] -> '' > x[-3:-2] -> 'b' > x[-3:-1] -> 'bc' > x[-3: 0] -> '' > > The one that actually bothers me here is the last one, I would have expec

Re: [Python-Dev] Let's update CObject API so it is safe and regular!

2009-04-03 Thread Kristján Valur Jónsson
Here's one from EVE, where the DB module creates raw data, for our Crowsets, and then hands it over to another module for consumption (actual creation of the CRow and CrowDescriptor objects: BluePy raw(PyCObject_FromVoidPtr(&mColumnList, 0)); if (!raw) return 0;

[Python-Dev] sequence slice that wraps, bug or intention?

2009-04-03 Thread Ulrich Eckhardt
Hi! I just stumbled across something in Python 2.6 where I'm not sure if it is by design or a fault: x = 'abdc' x[-3:-3] -> '' x[-3:-2] -> 'b' x[-3:-1] -> 'bc' x[-3: 0] -> '' The one that actually bothers me here is the last one, I would have expected it to yield 'bcd' instead, because otherwi

Re: [Python-Dev] PyDict_SetItem hook

2009-04-03 Thread Antoine Pitrou
Thomas Wouters python.org> writes: > > > Pystone is pretty much a useless benchmark. If it measures anything, it's the speed of the bytecode dispatcher (and it doesn't measure it particularly well.) PyBench isn't any better, in my experience. I don't think pybench is useless. It gives a lot of

Re: [Python-Dev] Should the io-c modules be put in their own directory?

2009-04-03 Thread Antoine Pitrou
Alexandre Vassalotti peadrop.com> writes: > > I just noticed that the new io-c modules were merged in the py3k > branch (I know, I am kind late on the news—blame school work). Anyway, > I am just wondering if it would be a good idea to put the io-c modules > in a sub-directory (like sqlite), inst

Re: [Python-Dev] UnicodeDecodeError bug in distutils

2009-04-03 Thread Tarek Ziadé
On Fri, Apr 3, 2009 at 2:25 AM, Ben Finney wrote: > "Phillip J. Eby" writes: > >> However, there's currently no standard, as far as I know, for what >> encoding the PKG-INFO file should use. > > Who would define such a standard? PEP 376 where we can explain that all files in egg-info should be i

Re: [Python-Dev] Package Management - thoughts from the peanut gallery

2009-04-03 Thread Tarek Ziadé
Guys, I have taken the commitment to lead these tasks and synchronize the people that are willing to help on this. We are working on several tasks and PEPS to make things happen since the summit. There's no public roadmap yet on when things will be done (because there's no 100% certitude yet on

Re: [Python-Dev] Let's update CObject API so it is safe and regular!

2009-04-03 Thread Hrvoje Niksic
Larry Hastings wrote: If we're adding type information, then please make it a Python object rather than a C string. That way the creator and the consumer can use a richer API to query the "type", such as by calling its methods or by inspecting it in some other way. I'm not writing my patch t