Re: [Python-Dev] Memory management in the AST parser & compiler

2005-11-17 Thread Alex Martelli
On Nov 17, 2005, at 5:00 PM, Thomas Lee wrote: > Portability may also be an issue to take into consideration: Of course -- but so is anno domini... the eskimo.com FAQ is (C) 1995, and the neohapsis.com page just points to the eskimo.com one: > http://www.eskimo.com/~scs/C-faq/q7.32.html > htt

Re: [Python-Dev] Short-circuiting iterators

2005-11-30 Thread Alex Martelli
On 11/30/05, Matthew F. Barnes <[EMAIL PROTECTED]> wrote: ... > I'm curious if anything like this has been proposed in the past. If so, > could someone kindly point me to any relevant mailing list threads? PEP 342, already accepted and found at http://python.org/peps/pep-0342.html , covers rel

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread Alex Martelli
On 12/12/05, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > At 02:25 PM 12/12/2005 -0600, Ian Bicking wrote: > >That looks good to me. Well, I actually try not to use cls as the first > >argument to metaclass's __new__ method, because there's so many classes > >being tossed about at that point that I

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread Alex Martelli
On 12/12/05, Phillip J. Eby <[EMAIL PROTECTED]> wrote: ... > I'd rather see 'metaclass' fully spelled out than resort to 'mcl'; > metaclass code is tricky enough to write without figuring out > abbreviations. :) > > Indeed, the only reason I use 'cls' is because it was Pronounced the > standard

Re: [Python-Dev] Sharing expat instances

2005-12-14 Thread Alex Martelli
On 12/14/05, Chris Lambacher <[EMAIL PROTECTED]> wrote: > Py2exe manages to load .pyd files and dlls from zip. Apparently they have > written an alternate dll loader that does not need the file to be on the file > system. This is used for single file apps. > > I don't know if it is possible to wr

Re: [Python-Dev] Small any/all enhancement

2005-12-27 Thread Alex Martelli
On Dec 27, 2005, at 12:45 PM, Valentino Volonghi aka Dialtone wrote: ... > any(iterable, test=bool) and all(iterable, test=bool) ... > any(some_objects, test=operator.attrgetter('some_attribute')) Why would that be better than any(o.some_attribute for o in some_objects) ? > def zerop(x):

Re: [Python-Dev] Small any/all enhancement

2005-12-28 Thread Alex Martelli
On Dec 27, 2005, at 11:06 PM, Eric Nieuwland wrote: ... >>> def zerop(x): >>> return x==0 >>> >>> all(some_objects, zerop) >> >> and why would that be better than >> all(o==0 for o in some_objects) >> ? > > all() can be terminated at the first false element. For very long > sequences this

Re: [Python-Dev] deque alternative

2005-12-28 Thread Alex Martelli
On Dec 28, 2005, at 2:57 AM, Martin v. Löwis wrote: > Phillip J. Eby wrote: >> Since I routinely use 2-item tuples (twoples?) > > I've been using "pairs" to describe that datatype. Not sure > how common it is in English, but in German, "Zweitupel" > is often called "Paar". I use 'pair', too, adm

Re: [Python-Dev] a quit that actually quits

2005-12-28 Thread Alex Martelli
On Dec 28, 2005, at 3:24 AM, Michael Hudson wrote: > [EMAIL PROTECTED] writes: > >> Fredrik> a quit/exit command that actually quits, instead of >> printing a >> Fredrik> "you didn't say please!" message. >> >> I like Fredrik's idea more and more. > > The thing that bothers me about it

Re: [Python-Dev] a quit that actually quits

2005-12-28 Thread Alex Martelli
On 12/28/05, Walter Dörwald <[EMAIL PROTECTED]> wrote: ... > We have sys.displayhook and sys.excepthook. Why not add a sys.inputhook? Sure, particularly with Nick's suggestion for a default input hook it would be fine. > > sessions in which I want to perform some action repeatedly, and > > cur

Re: [Python-Dev] Birkenfeld's gone

2006-01-15 Thread Alex Martelli
On Jan 15, 2006, at 6:46 PM, Tim Peters wrote: ... > I hope that revealing my true name too, and outing Aahz, will inspire > everyone to reveal their secret powers and home planets too. I won't OK, there I go -- "Alessandro Ferruccio Raffaele Martelli-Fortini". Good thing it's spelled in

[Python-Dev] basenumber redux

2006-01-15 Thread Alex Martelli
For the last 2+ years I've been occasionally arguing for the introduction of a basenumber (and ideally a baseinteger, but that, to me, is a slightly lesser issue) analogous to basestring. Google search fo [basenumber site:python.org] for several messages on the subject, by me and others; i

Re: [Python-Dev] basenumber redux

2006-01-16 Thread Alex Martelli
On Jan 16, 2006, at 7:53 AM, Guido van Rossum wrote: > On 1/15/06, Alex Martelli <[EMAIL PROTECTED]> wrote: >> Now, today, I have _again_ been bit by the lack of basenumber (by a >> bug of mine, fixed by adding decimal.Decimal to a long tuple of >> classes to be passed

Re: [Python-Dev] basenumber redux

2006-01-16 Thread Alex Martelli
On Jan 16, 2006, at 2:01 PM, Martin v. Löwis wrote: > Alex Martelli wrote: >> I can't find a PEP describing this restriction of basestring, and I >> don't see why a coder who needs to implement another kind of >> character string shouldn't subclass basestring

[Python-Dev] str with base

2006-01-16 Thread Alex Martelli
Is it finally time in Python 2.5 to allow the "obvious" use of, say, str(5,2) to give '101', just the converse of the way int('101',1) gives 5? I'm not sure why str has never allowed this obvious use -- any bright beginner assumes it's there and it's awkward to explain why it's not!-). I'

Re: [Python-Dev] str with base

2006-01-16 Thread Alex Martelli
On Jan 16, 2006, at 8:03 PM, Jeremy Hylton wrote: > It never occured to me that str() would behave like int() for this > case. It makes complete sense to me that a factory for numbers would > ask about the base of the number. What would the base of a string be, > except in a few limited cases?

Re: [Python-Dev] str with base

2006-01-17 Thread Alex Martelli
On 1/16/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 1/16/06, Alex Martelli <[EMAIL PROTECTED]> wrote: > > Is it finally time in Python 2.5 to allow the "obvious" use of, say, > > str(5,2) to give '101', just the converse of the way int(&#

Re: [Python-Dev] basenumber redux

2006-01-17 Thread Alex Martelli
On 1/17/06, M.-A. Lemburg <[EMAIL PROTECTED]> wrote: > Alex, I think you're missing a point here: what you are looking > for is an interface, not a base class - simply because the I expect numbers to support arithmetic operators, &c -- no need for basenumber to "spell this out", i.e., "be an itner

Re: [Python-Dev] str with base

2006-01-18 Thread Alex Martelli
On Jan 18, 2006, at 11:09 AM, Brett Cannon wrote: > On 1/18/06, Raymond Hettinger <[EMAIL PROTECTED]> wrote: I'd propose bin() to stay in line with the short abbreviated names. >>> >>> There has been some previous discussion about removing hex()/oct() >> from >>> builtins for Python 3.0, IIRC

Re: [Python-Dev] Building on OS X 10.4 fails

2006-01-18 Thread Alex Martelli
On Jan 18, 2006, at 8:47 PM, James Y Knight wrote: > On Jan 18, 2006, at 11:40 PM, Aahz wrote: > >> On Wed, Jan 18, 2006, Guido van Rossum wrote: >>> >>> Can we just all agree that RMS is an asshole now? Bah. >> >> "Citing RMS's insanity is a great way to get my blood steaming." -- >> GvR > > Ya

Re: [Python-Dev] yield back-and-forth?

2006-01-20 Thread Alex Martelli
On Jan 20, 2006, at 1:39 PM, Phillip J. Eby wrote: > At 11:19 AM 01/20/2006 -0800, Guido van Rossum wrote: >> (There *are*other uses besides the trampoline, >> right? :-) > > It's easy to come up with use cases where you feed data *into* a > generator > (parsers and pipelines, for example). I

Re: [Python-Dev] syntactic support for sets

2006-02-02 Thread Alex Martelli
On 2/1/06, Greg Wilson <[EMAIL PROTECTED]> wrote: > > Generator expressions make syntactic support irrelevant: > > Not when you're teaching the language to undergraduates: I haven't > actually done the study yet (though I may this summer), but I'm willing to > bet that allowing "math" notation for

[Python-Dev] any support for a methodcaller HOF?

2006-02-02 Thread Alex Martelli
I was recently reviewing a lot of the Python 2.4 code I have written, and I've noticed one thing: thanks to the attrgetter and itemgetter functions in module operator, I've been using (or been tempted to use) far fewer lambdas, particularly but not exclusively in key= arguments to sort and sorted.

Re: [Python-Dev] any support for a methodcaller HOF?

2006-02-03 Thread Alex Martelli
On Feb 3, 2006, at 1:36 AM, Michael Hudson wrote: > Alex Martelli <[EMAIL PROTECTED]> writes: > >> I was recently reviewing a lot of the Python 2.4 code I have written, >> and I've noticed one thing: thanks to the attrgetter and itemgetter >> functions in module

Re: [Python-Dev] any support for a methodcaller HOF?

2006-02-03 Thread Alex Martelli
On Feb 3, 2006, at 6:47 AM, Giovanni Bajo wrote: ... > use itemgetter and friends but the "correct" way of doing a > defferred "x[1]" > *should* let you write "x[1]" in the code. This is my main > opposition to > partial/itemgetter/attrgetter/methodcaller: they allow deferred > execution

[Python-Dev] math.areclose ...?

2006-02-05 Thread Alex Martelli
When teaching some programming to total newbies, a common frustration is how to explain why a==b is False when a and b are floats computed by different routes which ``should'' give the same results (if arithmetic had infinite precision). Decimals can help, but another approach I've found u

Re: [Python-Dev] syntactic support for sets

2006-02-06 Thread Alex Martelli
On 2/6/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 2/6/06, Donovan Baarda <[EMAIL PROTECTED]> wrote: > > yeah... the problem is differentiating the empty set from an empty dict. > > The only alternative that occured to me was the not-so-nice and > > not-backwards-compatible "{:}" for an em

Re: [Python-Dev] Octal literals

2006-02-06 Thread Alex Martelli
On 2/6/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: ... > What we should do in 3.0 is not entirely clear to me. It would be nice > if there was only a single type (named 'int', of course) with two > run-time representations, one similar to the current int and one > similar to the current long

Re: [Python-Dev] math.areclose ...?

2006-02-06 Thread Alex Martelli
On 2/6/06, Aahz <[EMAIL PROTECTED]> wrote: ... > > def areclose(x, y, relative_err = 1.e-5, absolute_err=1.e-8): > > diff = abs(x - y) > > ave = (abs(x) + abs(y))/2 > > return diff < absolute_err or diff/ave < relative_err > > > > Also, separating the two terms with 'or' rather than '+' ma

Re: [Python-Dev] threadsafe patch for asynchat

2006-02-07 Thread Alex Martelli
On 2/7/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: ... > what other reactive socket framework is there that would fit well into > the standard library ? is twisted really simple enough ? Twisted is wonderful, powerful, rich, and very large. Perhaps a small subset could be carefully extracted

Re: [Python-Dev] PEP for adding an sq_index slot so that any object, a or b, can be used in X[a:b] notation

2006-02-09 Thread Alex Martelli
On 2/9/06, Travis E. Oliphant <[EMAIL PROTECTED]> wrote: ... > The patch adds a new API function int PyObject_AsIndex(obj). > > This was not specifically in the PEP but probably should be. The name > could also be PyNumber_AsIndex(obj) but I was following the nb_nonzero > slot example to help

Re: [Python-Dev] release plan for 2.5 ?

2006-02-10 Thread Alex Martelli
On 2/10/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: ... > Next, the schedule. Neal's draft of the schedule has us releasing 2.5 > in October. That feels late -- nearly two years after 2.4 (which was > released on Nov 30, 2004). Do people think it's reasonable to strive > for a more aggressiv

[Python-Dev] PEP 351

2006-02-11 Thread Alex Martelli
On Feb 10, 2006, at 1:05 PM, Raymond Hettinger wrote: > [Guido van Rossum] >> PEP 351 - freeze protocol. I'm personally -1; I don't like the >> idea of >> freezing arbitrary mutable data structures. Are there champions who >> want to argue this? > > It has at least one anti-champion. I think i

[Python-Dev] Re: Preventing Unicode-related gotchas (Was: pre-PEP: Unicode Security Considerations for Python)

2021-11-14 Thread Alex Martelli via Python-Dev
Indeed, normative annex https://www.unicode.org/reports/tr31/tr31-35.html section 5 says: "if the programming language has case-sensitive identifiers, then Normalization Form C is appropriate" (vs NFKC for a language with case-insensitive identifiers) so to follow the standard we should have used N

<    1   2   3