Re: [Python-Dev] bytes / unicode

2010-06-22 Thread Mike Klaas
On Tue, Jun 22, 2010 at 4:23 PM, Ian Bicking wrote: > This reminds me of the optimization ElementTree and lxml made in Python 2 > (not sure what they do in Python 3?) where they use str when a string is > ASCII to avoid the memory and performance overhead of unicode. An optimization that forces

Re: [Python-Dev] Fixing the GIL (with a BFS scheduler)

2010-05-18 Thread Mike Klaas
On Tue, May 18, 2010 at 2:50 PM, Antoine Pitrou wrote: > There's no chance for this since the patch relies on the new GIL. > (that's unless there's a rush to backport the new GIL in 2.7, of course) Thanks I missed that detail. > I think your "rare long delays" might be related to the old GIL's

Re: [Python-Dev] Fixing the GIL (with a BFS scheduler)

2010-05-18 Thread Mike Klaas
On Sun, May 16, 2010 at 1:07 PM, Nir Aides wrote: > Relevant Python issue: http://bugs.python.org/issue7946 Is there any chance Antoine's "gilinter" patch from that issue might be applied to python 2.7? I have been experiencing rare long delays in simple io operations in multithreaded python ap

Re: [Python-Dev] deprecated stuff in standard library

2010-02-19 Thread Mike Klaas
On Fri, Feb 19, 2010 at 9:03 AM, Sjoerd Mullender wrote: > The policy should also be, if someone decides (or rather, implements) a > deprecation of a module, they should do a grep to see where that module > is used and fix the code.  It's not rocket science. I'm not sure if you're aware of it, b

Re: [Python-Dev] patch to make list.pop(0) work in O(1) time

2010-01-25 Thread Mike Klaas
On Mon, Jan 25, 2010 at 11:32 AM, Daniel Stutzbach wrote: > On Mon, Jan 25, 2010 at 1:22 PM, Steve Howell wrote: >> >> I haven't completely worked out the best strategy to eventually release >> the memory taken up by the pointers of the unreleased elements, but the >> worst case scenario is that

Re: [Python-Dev] 2.7 Release? 2.7 == last of the 2.x line?

2009-11-03 Thread Mike Klaas
On Tue, Nov 3, 2009 at 10:42 AM, Georg Brandl wrote: > sstein...@gmail.com schrieb: > > > > On Nov 3, 2009, at 12:28 PM, Arc Riley wrote: > >> > >> The main thing holding back the community are lazy and/or obstinate > >> package maintainers. If they spent half the time they've put into > >> comp

Re: [Python-Dev] pthreads, fork, import, and execvp

2009-07-20 Thread Mike Klaas
On Thu, Jul 16, 2009 at 1:08 PM, Thomas Wouters wrote: > > Picking up a rather old discussion... We encountered this bug at Google and > I'm now "incentivized" to fix it. > > For a short recap: Python has an import lock that prevents more than one > thread from doing an import at any given time.

Re: [Python-Dev] PEP 383 and GUI libraries

2009-04-30 Thread Mike Klaas
On 30-Apr-09, at 7:39 AM, Guido van Rossum wrote: FWIW, I'm in agreement with this PEP (i.e. its status is now Accepted). Martin, you can update the PEP and start the implementation. +1 Kudos to Martin for seeing this through with (imo) considerable patience and dignity. -Mike __

Re: [Python-Dev] Rethinking intern() and its data structure

2009-04-09 Thread Mike Klaas
On 9-Apr-09, at 6:24 PM, John Arbash Meinel wrote: Greg Ewing wrote: John Arbash Meinel wrote: And the way intern is currently written, there is a third cost when the item doesn't exist yet, which is another lookup to insert the object. That's even rarer still, since it only happens the

Re: [Python-Dev] speeding up PyObject_GetItem

2009-03-24 Thread Mike Klaas
On 24-Mar-09, at 3:15 PM, Raymond Hettinger wrote: 4% on a micro-micro-benchmark is hardly compelling... I concur! This is utterly insignificant and certainly does not warrant removing the checks. -1 on these sort of fake optimizations. We should focus on algorithmic improvements and eli

[Python-Dev] a nicer looking dir()

2009-02-18 Thread Mike Klaas
Someone has implemented a version of dir() which is much nicer for human consumption. The difference is striking enough that I thought it would be bringing to python-dev's attention. http://github.com/inky/see/tree/master >>> pencil_case = [] >>> dir(pencil_case) ['__add__', '__class__', '_

Re: [Python-Dev] C API for appending to arrays

2009-02-03 Thread Mike Klaas
On 2-Feb-09, at 9:21 AM, Hrvoje Niksic wrote: It turns out that an even faster method of creating an array is by using the fromstring() method. fromstring() requires an actual string, not a buffer, so in C++ I created an std::vector with a contiguous array of doubles, passed that array t

Re: [Python-Dev] Partial function application 'from the right'

2009-01-30 Thread Mike Klaas
On 29-Jan-09, at 3:38 PM, Daniel Stutzbach wrote: On Thu, Jan 29, 2009 at 5:24 PM, Mike Klaas wrote: And yet, python isn't confined to mathematical notation. *, ** are both overloaded for use in argument lists to no-one's peril, AFAICT. Certainly, but there is no danger of conf

Re: [Python-Dev] Partial function application 'from the right'

2009-01-29 Thread Mike Klaas
On 29-Jan-09, at 3:21 PM, Daniel Stutzbach wrote: On Thu, Jan 29, 2009 at 4:04 PM, Antoine Pitrou wrote: Alexander Belopolsky gmail.com> writes: > By this analogy, partial(f, ..., *args) is right_partial with '...' > standing for any number of missing arguments. I you want to specify > exac

Re: [Python-Dev] Psyco for -OO or -O

2008-12-15 Thread Mike Klaas
On 13-Dec-08, at 5:28 AM, Michael Foord wrote: Lie Ryan wrote: I'm sure probably most of you knows about psyco[1], the optimizer. Python has an -O and -OO flag that is intended to be optimization flag, but we know that currently it doesn't do much. Why not add psyco as standard library an

Re: [Python-Dev] RELEASED Python 3.0 final

2008-12-05 Thread Mike Klaas
On 5-Dec-08, at 8:40 AM, A.M. Kuchling wrote: On Fri, Dec 05, 2008 at 05:40:46AM -, [EMAIL PROTECTED] wrote: For most users, especially new users who have yet to be impressed with Python's power, 2.x is much better. It's not like "library support" is one small check-box on the languag

Re: [Python-Dev] n.numbits: method or property?

2008-11-11 Thread Mike Klaas
On 11-Nov-08, at 4:16 PM, Mark Dickinson wrote: More generally, what are the guidelines for determining when it's appropriate to make something a property rather than a method? Both are awkward on numeric types in python, necessitating brackets or a space before the dot: (1).__doc__ 1 .__d

Re: [Python-Dev] PEP: Consolidating names and classes in the `unittest` module (updated 2008-07-15)

2008-07-15 Thread Mike Klaas
On 15-Jul-08, at 6:05 AM, Andrew Bennetts wrote: Ben Finney wrote: "Stephen J. Turnbull" <[EMAIL PROTECTED]> writes: That measured only usage of unittest *within the Python standard library*. Is that the only body of unittest-using code we need consider? Three more data points then: bzr: 13

Re: [Python-Dev] PEP 371: Additional Discussion

2008-06-03 Thread Mike Klaas
On 3-Jun-08, at 3:53 PM, Benjamin Peterson wrote: On Tue, Jun 3, 2008 at 5:08 PM, Jesse Noller <[EMAIL PROTECTED]> wrote: Also - we could leave in stubs to match the threading api - Guido, David Goodger and others really prefer not to continue the "broken" API of the threading API I agre

Re: [Python-Dev] Iterable String Redux (aka String ABC)

2008-05-28 Thread Mike Klaas
On 28-May-08, at 5:44 PM, Greg Ewing wrote: Mike Klaas wrote: In my perfect world, strings would be indicable and sliceable, but not iterable. An object that was indexable but not iterable would be a very strange thing. If it has __len__ and __getitem__, there's nothing to sto

Re: [Python-Dev] Iterable String Redux (aka String ABC)

2008-05-28 Thread Mike Klaas
On 28-May-08, at 2:33 PM, Bill Janssen wrote: From what's been discussed so far, I don't see any advantage of isinstance(o, String) over hasattr(o, 'encode') or somesuch. Look, even if there were *no* additional methods, it's worth adding the base class, just to differentiate the class from

Re: [Python-Dev] PEP 8: Discourage named lambdas?

2008-05-02 Thread Mike Klaas
On 2-May-08, at 11:23 PM, Scott David Daniels wrote: Mike Klaas wrote: ... A common pattern for me is to replace an instances method with a lambda to add monitoring hooks or disable certain functionality: inst.get_foo = lambda: FakeFoo() This is not replacable in one line with a def (or

Re: [Python-Dev] PEP 8: Discourage named lambdas?

2008-05-02 Thread Mike Klaas
On 2-May-08, at 4:03 PM, Terry Reedy wrote: Some people write somename = lambda args: expression instead of the more obvious (to most people) and, dare I say, standard def somename(args): return expression The difference in the result (the only one I know of) is that the code and funct

Re: [Python-Dev] socket recv on win32 can be extremly delayed (python bug?)

2008-04-22 Thread Mike Klaas
Hi, This is not a python-specific problem. See http://en.wikipedia.org/wiki/Nagle's_algorithm -Mike On 17-Apr-08, at 3:08 AM, Robert Hölzl wrote: hello, I tried to implement a simple python XMLRPC service on a win32 environment (client/server code inserted below). The profiler of the client

Re: [Python-Dev] Encoding detection in the standard library?

2008-04-22 Thread Mike Klaas
On 22-Apr-08, at 2:16 PM, Martin v. Löwis wrote: Any program that needs to examine the contents of documents/feeds/whatever on the web needs to deal with incorrectly-specified encodings That's not true. Most programs that need to examine the contents of a web page don't need to guess the enc

Re: [Python-Dev] Encoding detection in the standard library?

2008-04-22 Thread Mike Klaas
On 22-Apr-08, at 3:31 AM, M.-A. Lemburg wrote: I don't think that should be part of the standard library. People will mistake what it tells them for certain. +1 I also think that it's better to educate people to add (correct) encoding information to their text data, rather than give them a

Re: [Python-Dev] svnmerge and added files

2008-03-20 Thread Mike Klaas
On 20-Mar-08, at 2:32 PM, Christian Heimes wrote: > Martin v. Löwis schrieb: >> It seems that recently, a number of merges broke in the sense >> that files added to the trunk were not merged into the >> 3k branch. >> >> Is that a general problem with svnmerge? Should that be >> fixed to automatica

Re: [Python-Dev] 2.5.2 release coming up

2008-01-29 Thread Mike Klaas
On 22-Jan-08, at 8:47 PM, Guido van Rossum wrote: > While the exact release schedule for 2.5.2 is still up in the air, I > expect that it will be within a few weeks. This means that we need to > make sure that anything that should go into 2.5.2 goes in ASAP, > preferably this week. It also means t

Re: [Python-Dev] Contributing to Python

2008-01-04 Thread Mike Klaas
On 3-Jan-08, at 1:07 PM, Guido van Rossum wrote: > On Jan 3, 2008 11:49 AM, Fred Drake <[EMAIL PROTECTED]> wrote: >> >> Python 2.6 seems to be entirely targeted at people who really want to >> be on Python 3, but have code that will need to be ported. I >> certainly don't view it as interesting i

Re: [Python-Dev] Request for inclusion in 2.5.2 (5-for-1)

2007-11-02 Thread Mike Klaas
On 2-Nov-07, at 6:57 AM, Guido van Rossum wrote: > > Since people are already jumping on those bugs but nobody has voiced > an opinion on your own patch, let me say that I think it's a good > patch, and I want it in 2.6, but I'm reluctant to add it to 2.5.2 as > it goes well beyond a bugfix (addin

[Python-Dev] Request for inclusion in 2.5.2 (5-for-1)

2007-11-01 Thread Mike Klaas
Issue http://bugs.python.org/issue1663329 details an annoyance in the subprocess module that has affected several users, including me. Essentially, closing hundreds of thousands of file descriptors by round-tripping through the python exception machinery is very slow, taking hundreds of mi

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

2007-09-28 Thread Mike Klaas
On 28-Sep-07, at 10:45 AM, Raymond Hettinger wrote: > [Bruce Frederiksen] >>> 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. > > Any practical use cases or is this just a theoretical i

Re: [Python-Dev] Regular expressions, Unicode etc.

2007-08-08 Thread Mike Klaas
In 8-Aug-07, at 12:47 PM, Nick Maclaren wrote: > >>> The other approach, which is to stick to true regular expressions, >>> and wholly or partially convert to DFAs, has already been rendered >>> impossible by even the limited Perl/PCRE extensions that Python >>> has adopted. >> >> Impossible? Sur

Re: [Python-Dev] Regular expressions, Unicode etc.

2007-08-08 Thread Mike Klaas
On 8-Aug-07, at 2:28 AM, Nick Maclaren wrote: > I have needed to push my stack to teach REs (don't ask), and am > taking a look at the RE code. I may be able to extend it to support > RFE 694374 and (more importantly) atomic groups and possessive > quantifiers. While I regard such things as revo

Re: [Python-Dev] Fwd: [ python-Patches-1744382 ] Read Write lock

2007-07-06 Thread Mike Klaas
On 6-Jul-07, at 6:45 AM, Yaakov Nemoy wrote: > > I can do the other three parts, but I am wondering, how do I write a > deterministic test unit for my patch? How is it done with the > threading model in python in general? I don't know how it is done in general, but for reference, here are some

Re: [Python-Dev] Py2.6 buildouts to the set API

2007-05-18 Thread Mike Klaas
On 18-May-07, at 6:34 PM, Raymond Hettinger wrote: > Here some ideas that have been proposed for sets: > > * New method (proposed by Shane Holloway): s1.isdisjoint(s2). > Logically equivalent to "not s1.intersection(s2)" but has an early- > out if a common member is found. The speed-up is po

Re: [Python-Dev] Summary of Tracker Issues

2007-05-15 Thread Mike Klaas
On 15-May-07, at 12:32 AM, Georg Brandl wrote: > > There are two problems with this: > * The set of questions is limited, and bots can be programmed to > know them all. Sure, but if someone is customizing their bot to python's issue tracker, in all likelyhood they would have to be dealt with

Re: [Python-Dev] PEP 30XZ: Simplified Parsing

2007-05-04 Thread Mike Klaas
On 5/4/07, Baptiste Carvello <[EMAIL PROTECTED]> wrote: > maybe we could have a "dedent" literal that would remove the first newline and > all indentation so that you can just write: > > call_something( d''' > first part > second line > third line

Re: [Python-Dev] (no subject)

2007-04-30 Thread Mike Klaas
On 4/30/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > JOSHUA ABRAHAM wrote: > > I was hoping you guys would consider creating function in os.path or > > otherwise that would find the full path of a file when given only it's base > > name and nothing else.I have been made to understand that this is n

Re: [Python-Dev] possible urllib bug on Windows XP

2007-04-02 Thread Mike Klaas
On 4/2/07, Shane Geiger <[EMAIL PROTECTED]> wrote: > I have a curious situation which might be a bug in urllib (Python 2.5 > installed from a .msi file gotten from python.org) when running on > Windows XP. (This is running inside a Parallels virtual machine, but I > don't see how that matters, bec

Re: [Python-Dev] Italic text in the manual

2007-03-29 Thread Mike Klaas
On 3/29/07, Georg Brandl <[EMAIL PROTECTED]> wrote: > Collin Winter schrieb: > > The docs for atexit in py3k [1] are mostly (though not all) in > > italics; I can't figure out why, and I'd appreciate if anyone with > > stronger latex-foo could take a look. > > This is still the same error as in th

Re: [Python-Dev] regexp in Python

2007-03-23 Thread Mike Klaas
On 3/23/07, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Bartlomiej Wolowiec wrote: > > > For some time I'm interested in regular expressions and Finite State > > Machine. > > Recently, I saw that Python uses "Secret Labs' Regular Expression Engine", > > which very often works too slow. Its pesymist

Re: [Python-Dev] deprecate commands.getstatus()

2007-03-22 Thread Mike Klaas
On 3/22/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > Titus Brown wrote: > > > I could add in a 'system'-alike call easily enough; that was suggested. > > But I think > > > > returncode = subprocess.call("program") > > > > is pretty simple, isn't it? > > Something to keep in mind is that system

Re: [Python-Dev] Proposal to revert r54204 (splitext change)

2007-03-15 Thread Mike Klaas
On 3/15/07, Mike Krell <[EMAIL PROTECTED]> wrote: > Here is a point of confusion. Bear in mind I'm running this under > windows, so explorer happily reports that ".emacs" has a type of > "emacs". (In windows, file types are registered in the system based > on the extension -- all the characters

Re: [Python-Dev] Patch 1644818: Allow importing built-in submodules

2007-03-12 Thread Mike Klaas
On 3/12/07, Miguel Lobo <[EMAIL PROTECTED]> wrote: > > Yet, the same can be said for most other patches: they are all for the > > benefit of users running into the same respective problems. > > Agreed. What I mean is that this fasttrack system where the submitter has > to do some extra work seem

Re: [Python-Dev] locals(), closures, and IronPython...

2007-03-06 Thread Mike Klaas
On 3/6/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > Although you can get a similar effect now by doing > > def __init__(self, **kwds): > args = dict(prec=None, rounding=None, >traps=None, flags=None, >_rounding_decision=None, >

Re: [Python-Dev] bool conversion wart?

2007-02-22 Thread Mike Klaas
On 2/22/07, Neal Becker <[EMAIL PROTECTED]> wrote: > Except, all the numeric types do, including int, float, and complex. But > not bool. Oh? In [5]: str(complex(1, 2)) Out[5]: '(1+2j)' In [6]: complex(str(complex(1, 2)))

Re: [Python-Dev] bool conversion wart?

2007-02-22 Thread Mike Klaas
On 2/22/07, Neal Becker <[EMAIL PROTECTED]> wrote: > Well consider this: > >>>str (4) > '4' > >>>int(str (4)) > 4 > >>>str (False) > 'False' > > >>>bool(str(False)) > True > > Doesn't this seem a bit inconsisent? Virtually no python objects accept a stringified version of themselves in their cons

Re: [Python-Dev] Summary of "dynamic attribute access" discussion

2007-02-13 Thread Mike Klaas
On 2/13/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > Mike Klaas wrote: > > > As a comparison, enumerate (that I would have believed was much more > > frequent a priori), is used 67 times, and zip/izip 165 times. > > By that argument, we should be considering a spe

Re: [Python-Dev] Summary of "dynamic attribute access" discussion

2007-02-13 Thread Mike Klaas
On 2/13/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Mike> As a comparison, enumerate (that I would have believed was much > Mike> more frequent a priori), is used 67 times, and zip/izip 165 times. > > But (get|set|has)attr has been around much longer than enumerate. I'm > almost ce

Re: [Python-Dev] Summary of "dynamic attribute access" discussion

2007-02-13 Thread Mike Klaas
On 2/13/07, Josiah Carlson <[EMAIL PROTECTED]> wrote: > As for people who say, "but getattr, setattr, and delattr aren't used"; > please do some searches of the Python standard library. In a recent > source checkout of the trunk Lib, there are 100+ uses of setattr, 400+ > uses of getattr (perhaps

Re: [Python-Dev] Interning string subtype instances

2007-02-12 Thread Mike Klaas
On 2/12/07, Hrvoje Nikšić <[EMAIL PROTECTED]> wrote: > cause problems for other users of the interned string. I agree with the > reasoning, but propose a different solution: when interning an instance > of a string subtype, PyString_InternInPlace could simply intern a copy. Interning currently r

Re: [Python-Dev] Object creation hook

2007-01-23 Thread Mike Klaas
On 1/23/07, Kristján V. Jónsson <[EMAIL PROTECTED]> wrote: > Hello there. > > I am trying to insert a hook into python enabling a callback for all > just-created objects. The intention is to debug and find memory leaks, e.g. > by having the hook function insert the object into a WeakKeyDictionary

Re: [Python-Dev] The bytes type

2007-01-12 Thread Mike Klaas
On 1/12/07, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > [A.M. Kuchling] > > 2.6 wouldn't go changing existing APIs to begin requiring or returning > > the bytes type[*], of course, but extensions and new modules might use > > it. > > The premise is dubious. > > If I am currently maintaining a mo

Re: [Python-Dev] 2.5.1 plans

2007-01-04 Thread Mike Klaas
On 1/4/07, Ralf W. Grosse-Kunstleve <[EMAIL PROTECTED]> wrote: > It would be nice if this simple fix could be included (main branch and 2.5.1): > > https://sourceforge.net/tracker/?func=detail&aid=1598181&group_id=5470&atid=105470 > > [ 1598181 ] subprocess.py: O(N**2) bottleneck > > I submitted

Re: [Python-Dev] Non-blocking (asynchronous) timer without thread?

2006-12-22 Thread Mike Klaas
On 12/22/06, Evgeniy Khramtsov <[EMAIL PROTECTED]> wrote: > The question to python core developers: > Is there any plans to implement non-blocking timer like a > threading.Timer() but without thread? > Some interpreted languages (like Tcl or Erlang) have such functionality, > so I think it would be

Re: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects

2006-12-06 Thread Mike Klaas
On 12/6/06, Alastair Houghton <[EMAIL PROTECTED]> wrote: [from previous message]: >> Anyway, clearly what people will expect here (talking about the match >> object API) is that m[3:4] would give them a list (or some equivalent >> sequence object) containing groups 3 and 4. Why do you think someo

Re: [Python-Dev] Segfault in python 2.5

2006-10-18 Thread Mike Klaas
On 10/18/06, Tim Peters <[EMAIL PROTECTED]> wrote: > [Mike Klaas] > > Indeed. > > Note that I just attached a much simpler pure-Python script that fails > very quickly, on Windows, using a debug build. Read the new comment > to learn why both "Windows"

Re: [Python-Dev] Segfault in python 2.5

2006-10-18 Thread Mike Klaas
On 10/18/06, Michael Hudson <[EMAIL PROTECTED]> wrote: > "Mike Klaas" <[EMAIL PROTECTED]> writes: > I've been reading the bug report with interest, but unless I can > reproduce it it's mighty hard for me to debug, as I'm sure you know. Indeed. >

[Python-Dev] Segfault in python 2.5

2006-10-18 Thread Mike Klaas
[http://sourceforge.net/tracker/index.php?func=detail&aid=1579370&group_id=5470&atid=105470] Hello, I'm managed to provoke a segfault in python2.5 (occasionally it just a "invalid argument to internal function" error). I've posted a traceback and a general idea of what the code consists of in th