Re: getattr and __mro__ (was Re: [Python-Dev] PEP 246, redux)

2005-01-12 Thread Alex Martelli
oesn't getattr search the __dict__'s along the __mro__ list? Yes, but getattr(obj, ... ALSO searches obj itself, which is what we're trying to avoid here. getattr(type(obj), ... OTOH has a DIFFERENT problem -- it ALSO searches type(type(obj)), t

Re: [Python-Dev] PEP 246, redux

2005-01-12 Thread Alex Martelli
quot;obvious once thought of" idea, and thanks, Guido, for providing it. Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] PEP 246, redux

2005-01-12 Thread Alex Martelli
k that by the time we actually implement PEP 246 in the Python core, this part of the semantics should be specified (at least the default behavior, even if there are hooks to change this). Very good point -- thanks Phillip and Guido jointly for pointing this out. Alex

Re: [Python-Dev] PEP 246, redux

2005-01-12 Thread Alex Martelli
On 2005 Jan 12, at 17:40, Phillip J. Eby wrote: At 04:36 PM 1/12/05 +0100, Alex Martelli wrote: I already know -- you told us so -- that if I had transitivity as you wish it (uncontrollable, unstoppable, always-on) I could not any more write and register a perfectly reasonable adapter which

Re: [Python-Dev] PEP 246, redux

2005-01-12 Thread Alex Martelli
Needing to be explicit and therefore to typechecking/typeswitching to pick which adapter to apply is just what I don't *WANT* to do, what I don't want *ANYBODY* to have to do EVER, and the very reason I'm spending time and energy on PEP 246. So, how would you propose I know wh

Re: [Python-Dev] PEP 246, redux

2005-01-12 Thread Alex Martelli
On 2005 Jan 12, at 19:16, Guido van Rossum wrote: ... [Alex] Hm? I meant if there were multiple A's. For every Ai that has an Ai->B you would also have to register a trivial Ai->C. And if there were multiple C's (B->C1, B->C2, ...) then the number of extra adaptors to

Re: [Python-Dev] PEP 246, redux

2005-01-12 Thread Alex Martelli
e were more important than that, then other ``costs'' besides the extreme NO_ADAPTER_NEEDED [[0 cost]] and DOES_NOT_SUPPORT [[infinite cost]] should be accepted, and the minimal-cost path ensured -- I do not think any such complication is warranted)). I think maybe this gets us a

Re: [Python-Dev] PEP 246, redux

2005-01-12 Thread Alex Martelli
OES want to assert that it's perfectly / losslessly / etc substitutable for the one being inherited. Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] PEP 246, redux

2005-01-12 Thread Alex Martelli
for IBas as well as inheriting (widening) of it; when that is not possible, the Java programmer, although surprised, will most likely be better off for having to be a tad more explicit. Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] Re: PEP 246: LiskovViolation as a name

2005-01-13 Thread Alex Martelli
the right thing via special descriptors, that I must spell everything out, or, what else...? If anybody has advice or feedback on these points, it will be welcome! Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman

Re: [Python-Dev] Son of PEP 246, redux

2005-01-13 Thread Alex Martelli
On 2005 Jan 13, at 03:57, Phillip J. Eby wrote: Okay, I'm really out of time now. Hate to dump this in as a possible spoiler on PEP 246, because I was just as excited as Alex about the possibility of it going in. But this whole debate has made me even less enamored of adaptation, and

Re: getting special from type, not instance (was Re: [Python-Dev] copy confusion)

2005-01-13 Thread Alex Martelli
On 2005 Jan 12, at 18:59, Guido van Rossum wrote: ... [Alex] Armin's fix was to change: ... [And then proceeds to propose a new API to improve the situation] I wonder if the following solution wouldn't be more useful (since less code will have to be changed). The descriptor for _

Re: [Python-Dev] PEP 246, redux

2005-01-13 Thread Alex Martelli
tside of the canonical, widespread approach to OOP). Anyway -- I'm pointing out that what to put in a rewrite of PEP 246 as a result of all this is anything but obvious at this point, at least to me. Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] PEP 246, redux

2005-01-13 Thread Alex Martelli
s | this harm PEP 246? I'm not sure. Well, PEP 246 should be edited, IMHO, to assert that all 'implicit' adaptions are out-of-scope, and if they are supported should be done so under the direct control of the application developer. So, are you willing to do that round of editing to P

Re: [Python-Dev] PEP 246, redux

2005-01-13 Thread Alex Martelli
l this is anything but obvious at this point, at least to me. LOL. Me either! ...so let's hope Clark has clearer ideas, as it appears he does: as per a previous msg, I've asked him if he could be the one doing the next round of edits, instead of me... Alex __

Re: [Python-Dev] PEP 246, redux

2005-01-13 Thread Alex Martelli
from the Model) it must still record some few presentation-only details locally, such as, say, the font to use? I'm not sure I'm all that enthusiastic about this crucial aspect of PJE's new "more pythonic than Python" [r]evolution, if it's being presented correctly

Re: getting special from type, not instance (was Re: [Python-Dev] copy confusion)

2005-01-13 Thread Alex Martelli
nd 2.4. Sure -- what way, though? The way I proposed in my last post about it? Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] PEP 246, redux

2005-01-13 Thread Alex Martelli
we should specify only one for PEP 246 too. | So, are you willing to do that round of editing to PEP 246...? I'll | then to the NEXT one which will still undoubtedly be needed... I could make a wack at it this weekend. Great! I assume you have copies of all relevant mails since

Re: [Python-Dev] PEP 246, redux

2005-01-13 Thread Alex Martelli
On 2005 Jan 13, at 22:43, Paramjit Oberoi wrote: On Thu, 13 Jan 2005 20:40:56 +0100, Alex Martelli <[EMAIL PROTECTED]> wrote: So please explain what's imperfect in wrapping a str into a StringIO? If I understand Philip's argument correctly, the problem is this: def print_n

Re: getting special from type, not instance (was Re: [Python-Dev] copy confusion)

2005-01-13 Thread Alex Martelli
be enriched to make sure they catch the bug (no doc change needed, it seems to me). I can do it this weekend if the general approach is OK, since Clark has kindly agreed to do the next rewrite of PEP 246;-). Alex ___ Python-Dev mailing list Python-D

Re: [Python-Dev] PEP 246, redux

2005-01-13 Thread Alex Martelli
On 2005 Jan 14, at 04:08, David Ascher wrote: Alex Martelli wrote: Yes, there is (lato sensu) "non-determinism" involved, just like in, say: for k in d: print k Wow, it took more than the average amount of googling to figure out that lato sensu means "broadly s

Re: [Python-Dev] redux: fractional seconds in strptime

2005-01-14 Thread Alex Martelli
, but maybe strftime should make available whatever formatting item[s] strptime may grow to support fractions of a second; and one such item (distinct from %S for guaranteed backwards compatibility) should be "seconds and fraction, with [[presumably, locale-specific]] decimal point inside"

Re: [Python-Dev] redux: fractional seconds in strptime

2005-01-14 Thread Alex Martelli
s an ATTRIBUTE of a struct_time, not an ITEM (==iteration on a struct_time will keep working just line now). Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] PEP 246: lossless and stateless

2005-01-14 Thread Alex Martelli
, and has many other differences. Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] PEP 246: lossless and stateless

2005-01-15 Thread Alex Martelli
cause by then it is definitely too late to do anything about it. Fair enough, but for Guido's suggested syntax of "def f(X:Y):..." meaning X=adapt(X,Y) at function entry, the issue is how that particular "default/implicit" adaptation should behave -- is it always allowed

Re: [Python-Dev] PEP 246: lossless and stateless

2005-01-15 Thread Alex Martelli
morphic to making every object weakly referenceable, wouldn't it? Or am I missing something...? Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman

Re: [Python-Dev] PEP 246: lossless and stateless

2005-01-16 Thread Alex Martelli
was in 2.2 suffered that problem, but it was a design problem, and is now fixed. Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

[Python-Dev] how to test behavior wrt an extension type?

2005-01-16 Thread Alex Martelli
y case deals with 2.3 and 2.4 maintenance and he's release manager for both, but, of course, everybody's welcome to help!). Surely this can't be the first case in which a bug got triggered only by a certain behavior in an extension type, but I couldn't

Re: [Python-Dev] Exceptions *must*? be old-style classes?

2005-01-16 Thread Alex Martelli
made very normally and strings are grandfathered in, we ARE down to exoteric breakage cases (potentially fixable by those new magic descriptors as above for specialmethods). Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.or

Re: [Python-Dev] Exceptions *must*? be old-style classes?

2005-01-16 Thread Alex Martelli
. Without inheritance you might similarly say: class AnotherOne(Exception): __metaclass__ = type ... This, in itself, could break existing code. Not necessarily, see my previous post. But anyway, PJE's proposal is less invasive than making Exception itself

Re: [Python-Dev] how to test behavior wrt an extension type?

2005-01-16 Thread Alex Martelli
On 2005 Jan 16, at 11:17, Raymond Hettinger wrote: [Alex] So, as per discussion here, I have prepared a patch (to the maintenance branch of 2.3, to start with) which adds unit tests to highlight these issues, and fixes them in copy.py. This patch should go in the maintenance of 2.3 and 2.4, but

Re: [Python-Dev] Re: how to test behavior wrt an extension type?

2005-01-16 Thread Alex Martelli
On 2005 Jan 16, at 12:03, Fredrik Lundh wrote: Alex Martelli wrote: Problem: to write unit tests showing that the current copy.py misbehaves with a classic extension type, I need a classic extension type which defines __copy__ and __deepcopy__ just like /F's cElementTree does. So, I made o

Re: [Python-Dev] Re: how to test behavior wrt an extension type?

2005-01-17 Thread Alex Martelli
testing blissfully well. I haven't even made the compilation of the part of Modules/_testcapi.c which hold the new type conditional upon anything, because I don't think that having it there unconditionally can possibly break anything anyway... _testcapi IS only used for testing, aft

Re: [Python-Dev] __str__ vs. __unicode__

2005-01-19 Thread Alex Martelli
x27;s surely possible, but if so it seems it should be possible to explain this in terms of particular properties of type unicode. Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: htt

Re: [Python-Dev] Re: Unix line endings required for PyRun* breakingembedded Python

2005-01-19 Thread Alex Martelli
think). of course it's possible: that's what the interpreter does when it loads a script or module, after all... or in other words, print repr(""" """) always prints "\n" (at least on Unix (\n) and Windows (\r\n)). Mac, too (but then, th

Re: [Python-Dev] Re: Zen of Python

2005-01-20 Thread Alex Martelli
elf.attr. Good point: this is also known as "Law of Demeter" and relevant summaries and links are for example at http://www.ccs.neu.edu/home/lieber/LoD.html . Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.

Re: [Python-Dev] PEP 246 - concrete assistance to developers of new adapter classes

2005-01-21 Thread Alex Martelli
nyone else (particularly those with PEAK and Zope interface experience) think such a class would be beneficial in encouraging good practices? Yes, there was something just like that in Nevow (pre-move to the zope interfaces) and it sure didn't hurt. Alex ___

Re: [Python-Dev] 2.3.5 and 2.4.1 release plans

2005-02-05 Thread Alex Martelli
._deepcopy_dispatch, AND doesn't have an __mro__? Even the _testcapi.Copyable type magically grows an __mro__; I'm not sure how to MAKE a type w/o one... Thanks, Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.

Re: [Python-Dev] Re: [Python-checkins] python/dist/src/Python future.c, 2.14, 2.15

2005-02-05 Thread Alex Martelli
.4.1 but not in 2.3.5 -- exactly for the reasons Jeremy is giving. Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] 2.3.5 and 2.4.1 release plans

2005-02-06 Thread Alex Martelli
xed. (H, is it only me, or is sourceforce bug browsing broken for bugs with 7-digits numbers? This one was 1114776 -- first one w/a 7-digit number I had yet seen -- and in no way could I get the browser to list it, it kept listing only 6-digit ones...). Alex

Re: [Python-Dev] RE: [Python-checkins] python/dist/src/Lib/test test_copy.py, 1.11.8.1, 1.11.8.2

2005-02-07 Thread Alex Martelli
ts broken makes my teeth grit). I do admit that this kind of issue makes a good case for more formalized interfaces...;-) Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mai

Re: [Python-Dev] Requesting that a class be a new-style class

2005-02-18 Thread Alex Martelli
read the task of explaining / teaching about the rationale for this somewhat kludgy transitional solution [[empty parentheses may be written OR omitted, with large difference in meaning, not very related to other cases of such parentheses]], even though I think you're rig

Re: [Python-Dev] Requesting that a class be a new-style class

2005-02-20 Thread Alex Martelli
his: in this latter construct, Python's mechanisms determine ClassType as the metaclass (it's the metaclass of the first base class), but then ClassType in turn sniffs around for another metaclass to delegate to, among the supplied bases, and having found one washes its hands of the w

Re: [Python-Dev] UserString

2005-02-20 Thread Alex Martelli
more updates" perhaps some indication of deprecation would be warranted. ((In any case, I do think the mixins would be useful)). Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubs

Re: [Python-Dev] UserString

2005-02-20 Thread Alex Martelli
On 2005 Feb 20, at 17:06, Guido van Rossum wrote: [Alex] I did have some issues w/UserString at a client's, but that was connected to some code doing type-checking (and was fixed by injecting basestring as a base of the client's subclass of UserString and ensuring the type-checking a

Re: [Python-Dev] UserString

2005-02-20 Thread Alex Martelli
r type, for example. Also, strings might be recognizable by other means, e.g. the presence of a lower() method or some other characteristic method that doesn't apply to sequence in general. Sure, there would many possibilities. (To Alex: leaving transform() out of the string interface seems to m

Re: [Python-Dev] Adding any() and all()

2005-03-11 Thread Alex Martelli
te one) should ideally be available. An optional use_partials keyword argument defaulting to False, for example, might allow that... (again, I've hopefully clarified the issues in another 2nd ed Cookbook recipe, I guess I can post that if it helps). Alex __

Re: [Python-Dev] Adding any() and all()

2005-03-11 Thread Alex Martelli
;'.join is that it proves SOMEbody considered it important to deal with a list of either str or unicode in the joining context... why not in the sorting context then?). Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/m

Re: [Python-Dev] sum()

2005-03-11 Thread Alex Martelli
On Mar 11, 2005, at 19:39, Raymond Hettinger wrote: [Alex] If you're considering revisions to sum's design, my suggestion would be to find a way to let the user tell sum to use a more accurate approach when summing floats. FWIW, when accuracy is an issue, I use: sum(sorted(dat

Re: [Python-Dev] Open issues for 2.4.1

2005-03-12 Thread Alex Martelli
ms to meet this criterion). Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] Rationale for sum()'s design?

2005-03-13 Thread Alex Martelli
searching on the month's archives by subject. Reading the whole thread will help with the pro's and con's, but the conclusions are mostly in Guido's post http://mail.python.org/pipermail/python-dev/2003-April/034853.html and my concurring reply http://ma

Re: [Python-Dev] comprehension abbreviation (was: Adding any() and all())

2005-03-14 Thread Alex Martelli
n't 2.5 "supposed to be" mostly about standard library reorganizations, enhancements, etc? Were there some MAJOR gains to be had in syntax additions, guess that could be bent, but snipping the [ for ...] leading part seems just such a tiny issue. (If the discussion is about 3.0, and

Re: [Python-Dev] Rationale for sum()'s design?

2005-03-14 Thread Alex Martelli
isinstance(value, basestring): return value + ''.join(itr) for item in itr: value += item return value ...? This doesn't break bw compat since currently when value's a string sum would raise an exception... Alex ___ Pyth

Re: [Python-Dev] Rationale for sum()'s design?

2005-03-15 Thread Alex Martelli
ve used sum in production code DOES come under the general concept of "numbers", in particular X+0 == X. Unfortunately, this equation doesn't hold when X is a timedelta, as X+0 raises an exception then. Alex ___ Python-Dev mailing list Py

Re: [Python-Dev] Re: comprehension abbreviation (was: Adding any() andall())

2005-03-29 Thread Alex Martelli
sequence bound to 'x' after making the copy, how is the above different from list(seq)? Well, it's less concise, and over an order of magnitude slower: Nimue:~/pypy alex$ python2.4 -mtimeit -s'seq=range(1000)' '[x for x in seq]' 1000 loops, best of 3: 312 us

Re: [Python-Dev] Developer list update

2005-04-07 Thread Alex Martelli
Manheimer Moshe Zadka Moshe was at Pycon (sorry I didn't think of introducing you to each other!) so I do assume he's still active. Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscr

Re: [Python-Dev] Re: marshal / unmarshal

2005-04-10 Thread Alex Martelli
hines are so much more powerful than VAXen, they have much more influence over Python development. The latest ads I've seen from Cray were touting AMD-64 processors anyway...;-) Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.pyth

Re: [Python-Dev] anonymous blocks

2005-04-19 Thread Alex Martelli
the block take keyword arguments to tweak its namespace (but assignments within the block should still affect its _surrounding_ namespace, it seems to me...). Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/pyt

Re: [Python-Dev] PEP 310 and exceptions

2005-04-22 Thread Alex Martelli
...whatever block.. in each and every otherwise-duplicated-logic case... now THAT is progress!!! IOW, +1 ... ! Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/ma

Re: [Python-Dev] Developer list update

2005-04-30 Thread Alex Martelli
UK), so it seems far from unlikely to me that he might be back to active contributions soon. Anyway, you can ask him directly. Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: ht

Re: [Python-Dev] PEP 340: Breaking out.

2005-05-04 Thread Alex Martelli
hole file reading (which can be Looking for a file with a certain magicnumber in its 1st two bytes...? for name in filenames: opening(name) as f: if f.read(2) == 0xFEB0: break This does seem to make real-life sense to me... Alex

Re: [Python-Dev] Merging PEP 310 and PEP 340-redux?

2005-05-10 Thread Alex Martelli
and so on. (Note the absence of a try/finally block in the generator > -- the try/finally is guaranteed by the with-statement but not by the > generator framework.) I must be thick this morning, because this relatively straightforward decorator isn't immediately obvious to me -- car

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-13 Thread Alex Martelli
ary to call it more elegantly on your behalf]. This doesn't neessarily argue that index should be in the built-ins module, of course, but I thought there was a sentiment towards having it in either the operator or math modules. Alex ___ Python-D

Re: [Python-Dev] str object going in Py3K

2006-02-14 Thread Alex Martelli
ppened and suggest the addition of an explicit 'rb' or 'wb' argument. This unending chore, in particular, makes me very wary of forever keeping open to mean "open this _text_ file". Alex ___ Python-Dev mailing list Pytho

Re: [Python-Dev] str object going in Py3K

2006-02-15 Thread Alex Martelli
hen in doubt, resist the temptation to guess" strongly suggests not having 'open' as a built-in at all. (And namemangling into openthis and openthat seems less Pythonic to me than exploiting namespaces by making structured names, either this.open and that.open or open.this and open.

Re: [Python-Dev] Proposal: defaultdict

2006-02-17 Thread Alex Martelli
ht start out populated, but would always start with some default factory, such as lambda:None I guess. I think the first alternative (autodict always starts empty, but with a specifically chosen factory [including *a, **k]) is more useful. Alex ___ Pyth

Re: [Python-Dev] The decorator(s) module

2006-02-17 Thread Alex Martelli
tever!' >>> Maybe we could fix that by having property(getfunc) use getfunc.__doc__ as the __doc__ of the resulting property object (easily overridable in more normal property usage by the doc= argument, which, I feel, should almost invariably be there). Alex ___

Re: [Python-Dev] The decorator(s) module

2006-02-18 Thread Alex Martelli
4, property(fset=acallable) does work (maybe silly, but it does make a write-only property) -- with the patch as given, it would stop working (due to attempts to get __doc__ from the None value of fget); I think we should ensure it keeps working (and add a unit test to th

Re: [Python-Dev] defaultdict proposal round three

2006-02-20 Thread Alex Martelli
more convenience. From my POV, either or both of these additions would be an improvement wrt 2.4 (as would most of the other alternatives debated here), but I'm keen to have _some_ alternative get in, rather than all being blocked out of 2.5 by "analysis paralysis". Alex _

Re: [Python-Dev] defaultdict proposal round three

2006-02-20 Thread Alex Martelli
an unending stream of confused beginners (in addition to those confused by mutable objects as default values for function arguments, but those can't be avoided). I presume you consider the "one obvious way" is to use default_value for immutables and default_factory for mut

Re: [Python-Dev] defaultdict proposal round three

2006-02-20 Thread Alex Martelli
een one more k than I had seen before". Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] Proposal: defaultdict

2006-02-20 Thread Alex Martelli
emind me what this means. Roughly the same (save for method/function difference) as: def getorset(d, key, func): if key not in d: d[key] = func() return d[key] Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailm

Re: [Python-Dev] defaultdict proposal round three

2006-02-20 Thread Alex Martelli
T, and say that M>N is the len(dir(...)) for instances of S. Well, then, math.sqrt(N-len(dir(o2))) is well defined -- but change o2 into o1, and since N-M is <0, you'll get an exception. If you can give an introspection-free example showing how Liskov

Re: [Python-Dev] defaultdict proposal round three

2006-02-20 Thread Alex Martelli
On Feb 20, 2006, at 5:05 PM, Raymond Hettinger wrote: > [Alex] >>> I see d[k]+=1 as a substantial improvement -- conceptually more >>> direct, "I've now seen one more k than I had seen before". > > [Guido] >> Yes, I now agree. This means tha

Re: [Python-Dev] Memory Error the right error for coding cookie promise violation?

2006-02-20 Thread Alex Martelli
ck (most recent call last): >File "", line 1, in ? > MemoryError Definitely looks like a bug, please open a bug report for it. Thanks, Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/pyth

Re: [Python-Dev] defaultdict proposal round three

2006-02-21 Thread Alex Martelli
to fit. This leaves it open to the reader's imagination to choose whether to think of the value as "initial" or "default" -- it's the *auto* (automatic) value. Alex ___ Python-Dev mailing list Python-Dev@python.org http:

Re: [Python-Dev] defaultdict proposal round three

2006-02-22 Thread Alex Martelli
e called, only overridden) a "private name" we're meeting enough of your and /F's concerns to let _on_missing remain. Its existence does simplify the implementation of defaultdict (and some other dict subclasses), and "if the implementation is easy to explain, it may

Re: [Python-Dev] OT: T-Shirts

2006-02-23 Thread Alex Martelli
mbers of Python: > > Guido van Rossum > Alex Martelli T-shirts? I'm an absolute fan of T-shirts...!-) > The point is that I don't know some of you, so please grab my shoulder > here in PyCon. And if you're not coming to the conference but somebody >

Re: [Python-Dev] defaultdict and on_missing()

2006-02-24 Thread Alex Martelli
x27;len' internally calls foo.__len__()]] be just as friendly etc? No biggie either way, but that would seem to be more aligned with Python's usual approach. Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] Translating docs

2006-02-25 Thread Alex Martelli
is translated at http://www.python.it/doc/Python-Docs/html/ (the C-API and Extending and Embedding aren't translated, though), but it's 2.3.4- vintage docs. There's no real mechanism or process to ensure updates. Alex ___ Pytho

Re: [Python-Dev] Using and binding relative names (was Re: PEP forBetter Control of Nested Lexical Scopes)

2006-02-26 Thread Alex Martelli
x;x=23), and I'd detest a similar 'outer' just as intensely (again, what I'd like instead is a decent namespace) -- so I might well be sympathetic to your POV, if I could but understand it;-). Alex ___ Python-Dev mailing list

Re: [Python-Dev] Using and binding relative names (was Re: PEP forBetter Control of Nested Lexical Scopes)

2006-02-26 Thread Alex Martelli
about Python closures being meant for use like Haskell ones, hm?-) But, of course, they do want to have their closure and rebind names too... Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] Using and binding relative names (was Re: PEP forBetter Control of Nested Lexical Scopes)

2006-02-26 Thread Alex Martelli
ences in details since they developed these concepts independently. Hey, what more do you need?-) Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mail

Re: [Python-Dev] Switch to MS VC++ 2005 ?!

2006-02-27 Thread Alex Martelli
> it's possible that .NET 2.0 would become a requirement. You mean, to RUN vc8-compiled Python?! That would be perhaps the first C compiler ever unable to produce "native", stand-alone code, wouldn't it? Alex ___ Python-Dev mai

Re: [Python-Dev] collections.idset and collections.iddict?

2006-03-06 Thread Alex Martelli
n the case where I needed a dict, I inherited from DictMixin and delegated some methods (with id(key) instead of key) to a self.somedict -- if a dict could be built with a key function, the solution would be both simpler and faster. Alex ___ Python

Re: [Python-Dev] [Python-checkins] Python humor

2006-03-06 Thread Alex Martelli
st > of Sunday, with dry cough and high fever. Or that's just a normal > outcome of sprinting :-) I got vaccinated against flu in Oct last year, and as a result haven't had to take ANY sick day so far (darn, I'm wasting Google's policy of g

Re: [Python-Dev] conditional expressions - add parens?

2006-03-06 Thread Alex Martelli
ecause I can't give it +3.1415926...!!!). *Mandatory* parentheses make this form MUCH more readable. Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman

Re: [Python-Dev] "as" mania

2006-03-07 Thread Alex Martelli
-expression of the condition, rather than the whole condition. E.g., in C, while ( (x=next_x()) < threshold ) ... being able to capture (by `as') only the whole (true or false) condition meets a minority of the use cases, so I'm unenthusiastic about it. Alex __

Re: [Python-Dev] conditional expressions - add parens?

2006-03-07 Thread Alex Martelli
ew toy and agree with Jim that mandatory parentheses around the whole (X if Y else Z) construct would ameliorate legibility a bit. Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] decorator module patch

2006-03-12 Thread Alex Martelli
need a mixed module with something in C and something in Python, we can do it the usual way, func.py wrapping _func.pyd (or .so or whatever)... Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/pyth

Re: [Python-Dev] Why are so many built-in types inheritable?

2006-03-13 Thread Alex Martelli
v is strictly for developers of Python itself, so please re- post your issues to comp.lang.python. Thanks, Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/ma

Re: [Python-Dev] Topic suggestions from the PyCon feedback

2006-03-13 Thread Alex Martelli
On Mar 13, 2006, at 7:22 PM, A.M. Kuchling wrote: ... > Design Patterns in Python (3) > Anything Alex Martelli wants to talk about.(3) ... > Language howtos (I really enjoyed Alex Martelli's talk last year on > itertools) (1) Wow, I'm blushing;-). I promise

Re: [Python-Dev] Py3k: Except clause syntax

2006-03-16 Thread Alex Martelli
'd make a lot of people pining for 'assignment as an expression' very happy, wouldn't we...? Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] All green!

2006-03-17 Thread Alex Martelli
Can't think of a more Pythonic way to celebrate St Patrick's day!-) Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-d

Re: [Python-Dev] Py3k: Except clause syntax

2006-03-19 Thread Alex Martelli
reasonably, IMHO) [(x,y) for y,x in whatever] was mandated instead. Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] PySet API

2006-03-25 Thread Alex Martelli
nce regarding the specific issue of PySet_Next. So, having carefully staked out a position smack in the middle, I cheerfully now expect to be fired upon from both sides!-) Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.or

Re: [Python-Dev] PySet API

2006-03-26 Thread Alex Martelli
lar cases, and why couldn't PySet_Next behave similarly? (Yes, I could/should look it up myself, but I'm supposed to be working on the 2nd Ed of the Nutshell, whose deadline is getting worryingly close...;-). Alex ___ Python-

Re: [Python-Dev] pysqlite for 2.5?

2006-03-29 Thread Alex Martelli
he volunteering I've seen that should be feasible. I just hope we get a BDFL +1 soon so I can add the good news to the 2nd ed of "Python in a Nutshell", which is due to go "printers-wards" about 8-9 days from now (in order to be ready for OSCON -- the times from final te

Re: [Python-Dev] PySet API

2006-03-29 Thread Alex Martelli
ers" don't get hurt -- that's how we added the ability to raise exceptions in different threads, in particular. Not sure if this is the best solution here, but I'm just pointing out that it's definitely not "unthinkable", procedurally speaking. Alex

[Python-Dev] tally (and other accumulators)

2006-04-04 Thread Alex Martelli
locate tally if it were to be a function. defaultdict.tally would be logically quite similar to dict.fromkeys, except that keys happening repeatedly get counted (and so each associated to a value of 1 and upwards) rather than "collapsed". Alex ___

<    1   2   3   4   >