[Python-Dev] Things to Know About Super

2008-08-24 Thread [EMAIL PROTECTED]
Recently I have opened a blog on Artima and I am publishing a few Python-related essays I had in store. In particular a trilogy of papers about super. From the foreword: In 2004 I decided to write a comprehensive paper documenting ``super`` pitfalls and traps, with the goal of publishing it on

Re: [Python-Dev] Cycle collection enhancement idea

2008-06-29 Thread [EMAIL PROTECTED]
On Jun 28, 6:21 pm, Nick Coghlan [EMAIL PROTECTED] wrote: Eyal Lotem wrote: Example: import os class RunningFile(object):     filename = '/tmp/running'     def __init__(self):         open(self.filename, 'wb')     def __del__(self):         os.unlink(self.filename) running_file

Re: [Python-Dev] Cycle collection enhancement idea

2008-06-29 Thread [EMAIL PROTECTED]
On Jun 28, 6:32 pm, Martin v. Löwis [EMAIL PROTECTED] wrote: Example: import os class RunningFile(object):     filename = '/tmp/running'     def __init__(self):         open(self.filename, 'wb')     def __del__(self):         os.unlink(self.filename) running_file = RunningFile

Re: [Python-Dev] Cycle collection enhancement idea

2008-06-29 Thread [EMAIL PROTECTED]
On Jun 29, 7:52 am, Guido van Rossum [EMAIL PROTECTED] wrote: On Sat, Jun 28, 2008 at 5:39 PM, Greg Ewing [EMAIL PROTECTED] wrote: Nick Coghlan wrote: It's a fact of Python development: __del__ methods cannot safely reference module globals, because those globals may be gone by the time

Re: [Python-Dev] Cycle collection enhancement idea

2008-06-29 Thread [EMAIL PROTECTED]
On Jun 29, 3:04 pm, Antoine Pitrou [EMAIL PROTECTED] wrote: eyal.lotem+pyutils at gmail.com eyal.lotem at gmail.com writes: This is exactly what my post tried to address. I assumed it was clear that module clearing is the wrong solution, and that it was also clear that due to the cycles I

Re: [Python-Dev] Cycle collection enhancement idea

2008-06-29 Thread [EMAIL PROTECTED]
On Jun 29, 3:36 pm, Antoine Pitrou [EMAIL PROTECTED] wrote: eyal.lotem+pyutils at gmail.com eyal.lotem at gmail.com writes: That would be no worse than what happens now - but its still not perfect (__del__ ordering issues). Also, you would need to temporarily revive the cycles

Re: [Python-Dev] Cycle collection enhancement idea

2008-06-29 Thread [EMAIL PROTECTED]
On Jun 29, 5:12 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Jun 29, 3:36 pm, Antoine Pitrou [EMAIL PROTECTED] wrote: eyal.lotem+pyutils at gmail.com eyal.lotem at gmail.com writes: That would be no worse than what happens now - but its still not perfect (__del__ ordering issues

Re: [Python-Dev] Status of Issue 2331 - Backport parameter annotations

2008-06-21 Thread [EMAIL PROTECTED]
Does it bother you that you need ()s to make instances elsewhere? That you have to type int('123') instead of int, '123'? Not at all...Python never supported this. Cheers, David ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] C API for gc.enable() and gc.disable()

2008-06-21 Thread Kevin Jacobs [EMAIL PROTECTED]
On Sat, Jun 21, 2008 at 4:33 AM, Martin v. Löwis [EMAIL PROTECTED] wrote: I don't think expecting people to tweak gc parameters when they witness performance problems is reasonable. What follows from that? To me, the natural conclusion is people who witness performance problems just need

Re: [Python-Dev] C API for gc.enable() and gc.disable()

2008-06-21 Thread Kevin Jacobs [EMAIL PROTECTED]
On Sat, Jun 21, 2008 at 11:20 AM, Martin v. Löwis [EMAIL PROTECTED] wrote: In general, any solution of the do GC less often needs to deal with cases where lots of garbage gets produced in a short amount of time (e.g. in a tight loop), and which run out of memory when GC is done less often

Re: [Python-Dev] C API for gc.enable() and gc.disable()

2008-06-20 Thread Kevin Jacobs [EMAIL PROTECTED]
+1 on a C API for enabling and disabling GC. I have several instances where I create a large number of objects non-cyclic objects where I see huge GC overhead (30+ seconds with gc enabled, 0.15 seconds when disabled). +1000 to fixing the garbage collector to be smart enough to self-regulate

Re: [Python-Dev] C API for gc.enable() and gc.disable()

2008-06-20 Thread Kevin Jacobs [EMAIL PROTECTED]
On Fri, Jun 20, 2008 at 10:25 AM, Antoine Pitrou [EMAIL PROTECTED] wrote: Kevin Jacobs jacobs at bioinformed.com bioinformed at gmail.com writes: +1 on a C API for enabling and disabling GC. I have several instances where I create a large number of objects non-cyclic objects where I see

Re: [Python-Dev] Status of Issue 2331 - Backport parameter annotations

2008-06-20 Thread [EMAIL PROTECTED]
I can help. I don't have a patch against the trunk but my first revisions of the patch for annotations did handle things like tuple parameters which are relevant to 2.6. Ah yes, I forgot about nested parameters. I see that 53170 still has nested parameters, but they were removed at some later

Re: [Python-Dev] Status of Issue 2331 - Backport parameter annotations

2008-06-19 Thread [EMAIL PROTECTED]
On Jun 19, 4:16 pm, Guido van Rossum [EMAIL PROTECTED] wrote: complex change to the syntax and code generator. Your motivation is also suspect: 2.6 is supposed to be a stepping stone towards 3.0, not a safe haven for people who don't like certain 3.0 features. Just get Guilty as charged :) I

Re: [Python-Dev] Proposal: add odict to collections

2008-06-16 Thread [EMAIL PROTECTED]
It is possible to get both ordered dict and sorted dict semantics in the same type if you replace (key, value) pairs for dictionary entries with (key,value,order) triples. The third component is a value that indicates the place of the entry relative to the other entries. To get an ordered dict,

Re: [Python-Dev] Proposal: add odict to collections

2008-06-15 Thread [EMAIL PROTECTED]
On Jun 14, 4:39 pm, Armin Ronacher [EMAIL PROTECTED] wrote: - in XML/HTML processing it's often desired to keep the attributes of an tag ordered during processing. So that input ordering is the same as the output ordering. Munging XML is a niche. - Form data transmitted via

Re: [Python-Dev] Problems with the new super()

2008-05-11 Thread [EMAIL PROTECTED]
On May 2, 7:54 am, Greg Ewing [EMAIL PROTECTED] wrote: I can only speak from my own experience, which is that whenever I've had a problem involving multiple inheritance, super() didn't solve it. What did solve it was either refactoring so that the classes being mixed were more independent

Re: [Python-Dev] PEP: per user site-packages directory

2008-01-15 Thread Kevin Jacobs [EMAIL PROTECTED]
On Jan 15, 2008 6:24 AM, Oleg Broytmann [EMAIL PROTECTED] wrote: On Mon, Jan 14, 2008 at 11:41:47PM +, Jon Ribbens wrote: It makes sense, but personally I have never heard before of ~/.local. Whereas ~/bin is something I am quite familiar with. Me too. python-dev is the only place I

[Python-Dev] Changing PyAPI_DATA(type) into PyAPI_DATA(type, variablename)?

2008-01-09 Thread [EMAIL PROTECTED]
Hello, python-dev! One-liner summary: Would it be possible to change PyAPI_DATA(type) into PyAPI_DATA(type, variablename) to help portability to funny platforms? We've been working on porting the Python 2.5.1 core to the Symbian S60 smartphone platform. Unlike the previous 2.2.2 port, this time

Re: [Python-Dev] PATCH: attribute lookup caching for 2.6

2007-12-06 Thread Kevin Jacobs [EMAIL PROTECTED]
On Dec 6, 2007 1:35 AM, Neil Toronto [EMAIL PROTECTED] wrote: So I've applied Armin's patch to 2.6 (it was nearly clean) and am playing with it. cls.name lookups are 15-20% faster than mine, and inst.name lookups are 5-10% faster. His is also winning on hasattr calls (succeeding and failing

Re: [Python-Dev] PATCH: attribute lookup caching for 2.6

2007-12-05 Thread Kevin Jacobs [EMAIL PROTECTED]
On Dec 5, 2007 5:50 PM, Phillip J. Eby [EMAIL PROTECTED] wrote: At 10:48 PM 12/5/2007 +0100, Georg Brandl wrote: Neil Toronto schrieb: So Jim and PJE finally convinced me to do it the right way. :) Thanks guys - it turned out very nice. How does this relate to Armin Rigo's method cache

Re: [Python-Dev] Python developers are in demand

2007-10-25 Thread Kevin Jacobs [EMAIL PROTECTED]
Just to chime in from the other side of the coin. I'm actively trying to hire qualified scientific programmers with strong Python experience. Unfortunately, I've had little success finding candidates with actual Python knowledge, resorting mainly to hiring those who've seen it and can readily

Re: [Python-Dev] Adding concat function to itertools

2007-09-28 Thread Kevin Jacobs [EMAIL PROTECTED]
On 9/22/07, Bruce Frederiksen [EMAIL PROTECTED] wrote: I've added a new function to itertools called 'concat'. This function is much like *chain*, but takes all of the iterables as a single argument. I've needed this once or twice, though my implementation was called 'starchain', in line

Re: [Python-Dev] make iter() return an empty iterator?

2007-08-03 Thread Kevin Jacobs [EMAIL PROTECTED]
On 8/3/07, Facundo Batista [EMAIL PROTECTED] wrote: 2007/8/3, Andrew Bennetts [EMAIL PROTECTED]: I don't really think there's much reason to make iter() work. As you say, What bad thing could happen if we make iter() work? If nothing, we should ask ourselves: which is the more intuitive

Re: [Python-Dev] itertools addition: getitem()

2007-07-08 Thread Kevin Jacobs [EMAIL PROTECTED]
On 7/8/07, Guido van Rossum [EMAIL PROTECTED] wrote: Ahem. I hope you have a better use case for getitem() than that (regardless of the default issue). I find it clearer to write that as try: compid = root[ns.company_id].next() except StopIteration: compid = None else: compid = int

Re: [Python-Dev] Instance variable access and descriptors

2007-06-09 Thread Kevin Jacobs [EMAIL PROTECTED]
there with no apparent activity. So if the overhead of mro lookups is that bothersome, it may be well worth your time to review the patch. URL: http://sourceforge.net/tracker/index.php?func=detailaid=1700288group_id=5470atid=305470 -Kevin On 6/9/07, Phillip J. Eby [EMAIL PROTECTED] wrote: At 12:23

Re: [Python-Dev] gzip Patch

2007-04-24 Thread Kevin Jacobs [EMAIL PROTECTED]
I've tested the patch and it works as advertised for me. On 4/23/07, Florian Festi [EMAIL PROTECTED] wrote: Hi! I posted patch 1675951 a while ago that fixes a performance problem for small reads in the gzip stdlib module. It also removes the necessity for seeking while reading gzip files

Re: [Python-Dev] function for counting items in a sequence

2007-04-07 Thread Kevin Jacobs [EMAIL PROTECTED]
On 4/7/07, Guido van Rossum [EMAIL PROTECTED] wrote: On 4/7/07, Adam Olsen [EMAIL PROTECTED] wrote: On 4/7/07, Steven Bethard [EMAIL PROTECTED] wrote: Here's a patch implementing collections.counts() as suggested above: The name doesn't make it obvious to me what's going on. Maybe

Re: [Python-Dev] 2.5 status

2006-08-07 Thread [EMAIL PROTECTED]
Neal Norwitz [EMAIL PROTECTED] wrote: Things are getting better, but we still have some really important outstanding issues. PLEASE CONTINUE TESTING AS MUCH AS POSSIBLE. I've run into a problem with a big application that I wasn't able to reproduce with a small example. I've submitted a bug

Re: [Python-Dev] FW: Bug? Certainly a new *behavior* from subprocess in 2.5 on Win32

2006-07-21 Thread Kevin Jacobs [EMAIL PROTECTED]
On 7/21/06, Nick Coghlan [EMAIL PROTECTED] wrote: Delaney, Timothy (Tim) wrote: Looks like there's a bug in Popen.__del__ in 2.5. I'm not in a position to have a look right now.For those not watching python-checkins, a check for is not None has been added before the offending line in Popen.__del__

Re: [Python-Dev] FW: Bug? Certainly a new *behavior* from subprocess in 2.5 on Win32

2006-07-21 Thread Kevin Jacobs [EMAIL PROTECTED]
That'll teach me to fire off emails while running out the door. Thanks.-KevinOn 7/21/06, John Benediktsson [EMAIL PROTECTED] wrote: The is _active check, unless it intendeds to check for either empty or None, should probably be revised to: def __del__(self): # In case the child hasn't been

Re: [Python-Dev] first draft of bug guidelines for www.python.org/dev/

2006-07-21 Thread Kevin Jacobs [EMAIL PROTECTED]
On 7/21/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Brett Sure.It can also wait until we begin discussing the transitionBrett to our next bug tracker.Would be kinda nice if the new bug tracker allowed submitters to enter afollowup email address without formally logging in.(Of course, email

Re: [Python-Dev] FW: Bug? Certainly a new *behavior* from subprocess in 2.5 on Win32

2006-07-20 Thread Kevin Jacobs [EMAIL PROTECTED]
Reported to the list about a week ago, with analysis. Didn't get a response. Won't use sourceforge. Sorry about the top post.-KevinOn 7/20/06, Delaney, Timothy (Tim) [EMAIL PROTECTED] wrote:Larry Hastings wrote: I run the following script: -- from subprocess import * Popen(ls -l) -- (yeah, I

[Python-Dev] Behavior change in subprocess.py

2006-07-12 Thread Kevin Jacobs [EMAIL PROTECTED]
During my testing of Python 2.5b2, I've found something that may be worthy of discussion. I suspect that recent GC and finalization changes have altered the behavior of the Popen object in subprocess.py. I am now getting many many many finalization warnings in my code like: Exception

Re: [Python-Dev] Explicit Lexical Scoping (pre-PEP?)

2006-07-06 Thread Kevin Jacobs [EMAIL PROTECTED]
On 7/6/06, Evan Simpson [EMAIL PROTECTED] wrote: Talin wrote: I propose to create a new type of scoping rule, which I will call explicit lexical scoping, that will co-exist with the current implicit scoping rule that exists in Python today. I'd like to toss one more variant into the mix.If we

Re: [Python-Dev] Numerical robustness, IEEE etc.

2006-06-24 Thread Kevin Jacobs [EMAIL PROTECTED]
On 6/23/06, Nick Maclaren [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Unfortunately, that doesn't help, because it is not where the issues are.What I don't know is how much you know about numerical models, IEEE 754 in particular, and C99.You weren't active on the SC22WG14 reflector

Re: [Python-Dev] Numerical robustness, IEEE etc.

2006-06-23 Thread Kevin Jacobs [EMAIL PROTECTED]
On 6/22/06, Nick Maclaren [EMAIL PROTECTED] wrote: Not a lot.Annex F in itself is only numerically insane.You need to know the rest of the standard, including that which is documented only in SC22WG14 messages, to realise the full horror. [...]Unfortunately, that doesn't help, because

Re: [Python-Dev] Segmentation fault in collections.defaultdict

2006-06-18 Thread Kevin Jacobs [EMAIL PROTECTED]
On 6/11/06, Nick Coghlan [EMAIL PROTECTED] wrote: Kevin Jacobs [EMAIL PROTECTED] wrote: Try this at home: import collections d=collections.defaultdict(int) d.iterkeys().next()# Seg fault d.iteritems().next() # Seg fault d.itervalues().next() # Fine and dandyThis all worked fine for me in rev

[Python-Dev] Segmentation fault in collections.defaultdict

2006-06-10 Thread Kevin Jacobs [EMAIL PROTECTED]
An aside before I report this bug:_I_HATE_SOURCEFORGE_. If it doesn't bloody accept anonymous bug reports then it bloody well shouldn't let you type in a nice, detailed, well through-out report and then toss it in the toilet when you hit Submit, and also not allow one dive in after it by using the

Re: [Python-Dev] Replacement for print in Python 3.0

2005-09-06 Thread [EMAIL PROTECTED]
Guido van Rossum [EMAIL PROTECTED] wrote: What do you think of the trick (that I wasn't aware of before) used in Java and .net of putting an optional position specifier in the format, and using positional arguments? It would be a little less verbose and with sensible defaults wouldn't quite

Re: [Python-Dev] string.Template format enhancements (Re: Replacement for print in Python 3.0)

2005-09-06 Thread [EMAIL PROTECTED]
Nick Coghlan [EMAIL PROTECTED] wrote: With the above changes, the following would work: $1: $2.format(Number of bees, 0.5) And produce: Number of bees: 0.5 When pre-compiling string.Templates, the keyword method is significantly clearer, but if the syntax was accessible through

Re: [Python-Dev] Replacement for print in Python 3.0

2005-09-06 Thread [EMAIL PROTECTED]
Guido van Rossum [EMAIL PROTECTED] wrote : On 9/5/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Whenever the template definition and its use are not directly adjacent, the template is that much harder to understand (i.e., This `i.e.` should have read `e.g.` :-( in the context

Re: [Python-Dev] PEP, take 2: Exception Reorganization for Python 3.0

2005-08-05 Thread [EMAIL PROTECTED]
James Y Knight [EMAIL PROTECTED] wrote: OK, I'm changing my mind again about the names again. Exception as the root and StandardError can stay; the only new proposal would then be to make bare 'except:' call StandardError. I don't see how that can work. Any solution that is expected

Re: [Python-Dev] PEP 343 - next steps

2005-06-11 Thread [EMAIL PROTECTED]
Andrew Koenig [EMAIL PROTECTED] wrote: Of course, this usage shows that the syntax is unnecessary in this context, but what I care about is def f(x as (a, b)): # ... which has the advantage over the alternative def f(x): (a, b) = x