[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

Re: [Python-Dev] Retrieve an arbitrary element from a set without removing it

2009-10-24 Thread Alex Martelli
Next(s) would seem good... Alex Sent from my iPhone On Oct 24, 2009, at 6:47 PM, John Arbash Meinel john.mei...@canonical.com wrote: Adam Olsen wrote: On Fri, Oct 23, 2009 at 11:04, Vitor Bosshard algor...@gmail.com wrote: I see this as being useful for frozensets as well, where you

Re: [Python-Dev] (try-except) conditional expression similar to (if-else) conditional (PEP 308)

2009-08-07 Thread Alex Martelli
2009/8/7 Kristján Valur Jónsson krist...@ccpgames.com: Unless I am very much mistaken, this is the approach Ruby takes. Everything is an expression.  For example, the value of a block is the value of The last expression in the block. I've never understood the need to have a distinction

Re: [Python-Dev] multi-with statement

2009-05-02 Thread Alex Martelli
FWIW, I prefer Fredrik's wish too. Alex On Sat, May 2, 2009 at 12:26 PM, Fredrik Johansson fredrik.johans...@gmail.com wrote: On Sat, May 2, 2009 at 9:01 PM, Georg Brandl g.bra...@gmx.net wrote: Hi, this is just a short notice that Mattias Brändström and I have finished a patch to

Re: [Python-Dev] Python3 and arm-linux

2009-04-23 Thread Alex Martelli
On Thu, Apr 23, 2009 at 11:21 AM, cyberGn0m cy6erg...@gmail.com wrote: Somebody knowns, is python3 works on arm-linux. Is it possible to build it? Where to find related discussions? Maybe some special patches already available? Should i try to get sources from svn or get known version

Re: [Python-Dev] Possible py3k io wierdness

2009-04-05 Thread Alex Martelli
On Sun, Apr 5, 2009 at 3:54 PM, Nick Coghlan ncogh...@gmail.com wrote: Antoine Pitrou wrote: James Y Knight foom at fuhm.net writes: It seems that a separate method _internal_close should've been defined to do the actual closing of the file, and the close() method should've been defined

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

2009-03-31 Thread Alex Martelli
On Tue, Mar 31, 2009 at 5:42 PM, Tres Seaver tsea...@palladion.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Stephen J. Turnbull wrote: I also just wrote a long post about the comparison of bzr to hg responding to a comment on baz...@canonical.com. I won't recap it here but

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

2009-03-31 Thread Alex Martelli
On Tue, Mar 31, 2009 at 5:42 PM, Tres Seaver tsea...@palladion.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Stephen J. Turnbull wrote: I also just wrote a long post about the comparison of bzr to hg responding to a comment on baz...@canonical.com. I won't recap it here but

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

2009-03-31 Thread Alex Martelli
On Tue, Mar 31, 2009 at 6:33 PM, Alexandre Vassalotti alexan...@peadrop.com wrote: ... html https://lists.ubuntu.com/archives/bazaar/2009q1/055850.html https://lists.ubuntu.com/archives/bazaar/2009q1/055872.html Perfect, thanks! Alex ___

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

2009-03-31 Thread Alex Martelli
On Tue, Mar 31, 2009 at 6:33 PM, Alexandre Vassalotti alexan...@peadrop.com wrote: ... html https://lists.ubuntu.com/archives/bazaar/2009q1/055850.html https://lists.ubuntu.com/archives/bazaar/2009q1/055872.html Perfect, thanks! Alex ___

Re: [Python-Dev] OS X Installer for 3.0.1 and supported versions

2009-02-14 Thread Alex Martelli
On Sat, Feb 14, 2009 at 3:22 AM, Ned Deily n...@acm.org wrote: ... have done complete and thorough testing. (In particular, I have no access to a G5 for 64-bit PPC testing.) I have a PowerMac G5 at home and I'll be glad to run tests if it helps. (It runs 10.5: family pack licenses are

Re: [Python-Dev] Attribute error: providing type name

2008-12-01 Thread Alex Martelli
I wonder if there's some desiderata left for future Python versions to make this standard behavior easier (for C-coded, Python-coded, and Cython-coded classes, ones made by SWIG, etc) without too much black magic... Alex On Mon, Dec 1, 2008 at 1:30 AM, Filip Gruszczyński [EMAIL PROTECTED] wrote:

Re: [Python-Dev] Attribute error: providing type name

2008-11-30 Thread Alex Martelli
On Sun, Nov 30, 2008 at 2:02 PM, Filip Gruszczyński [EMAIL PROTECTED] wrote: Yeah, any time someone implements their own attribute lookup process for a class (be it via __getattr__, __getattribute__ or the C equivalents), it is up to the reimplementation to appropriately format their error

Re: [Python-Dev] __import__ problems

2008-11-28 Thread Alex Martelli
On Fri, Nov 28, 2008 at 9:47 AM, Steven D'Aprano [EMAIL PROTECTED] wrote: On Sat, 29 Nov 2008 03:30:49 am Christian Heimes wrote: ... May I point you to the two leading underscores? The name '__import__' clearly suggests that the function is part of Python's internals. By definition all

Re: [Python-Dev] My patches

2008-11-02 Thread Alex Martelli
On Sun, Nov 2, 2008 at 5:42 AM, Barry Warsaw [EMAIL PROTECTED] wrote: ... A dvcs means that people can publish their branches in a wide variety of ways. Trusted developers can push their branches to code.python.org. Non-core developers can use one of the free public dvcs branch hosting

Re: [Python-Dev] json decoder speedups, any time left for 2.6?

2008-09-24 Thread Alex Martelli
Meanwhile, can you please release (wherever you normally release things;-) the pure-Python version as well? I'd like to play around with it in Google App Engine opensource sandboxes (e.g., cfr. gae-json-rest -- I'll be delighted to add you to that project if you want of course;-) and that

Re: [Python-Dev] FreeBSD 7 amd64 and large memory tests

2008-09-17 Thread Alex Martelli
Unbelievable as this may seem, this crazy over-committing malloc behavior is by now a classic -- I first fought against it in 1990, when IBM released AIX 3 for its then-new RS/6000 line of workstations; in a later minor release they did provide a way to optionally switch this off, but, like on

Re: [Python-Dev] Things to Know About Super

2008-08-27 Thread Alex Martelli
On Tue, Aug 26, 2008 at 10:24 PM, Michele Simionato [EMAIL PROTECTED] wrote: ... .. code-block:: python def include_mixin(mixin, cls): # could be extended to use more mixins # traits as in Squeak take the precedence over the base class dic = vars(mixin).copy() # could be extended

Re: [Python-Dev] fileobj.read(float): warning or error?

2008-07-21 Thread Alex Martelli
I thought that's what we had __index__ for -- reject arguments that don't SMOOTHLY turn into integers when an integer is actually required! Alex On Mon, Jul 21, 2008 at 10:01 PM, Martin v. Löwis [EMAIL PROTECTED] wrote: Well, the real problem is os.urandom(4.2) which goes to an unlimited loop:

Re: [Python-Dev] assertRaises

2008-07-17 Thread Alex Martelli
On Thu, Jul 17, 2008 at 2:54 AM, Antoine Pitrou [EMAIL PROTECTED] wrote: I said: Let's just make assertRaises return the exception instance, it seems like it feels the need correctly. and I meant fills, not feels, obviously... +1 : enriching the existing method in a way that's perfectly

Re: [Python-Dev] [Python-checkins] r64424 - inpython/trunk:Include/object.h Lib/test/test_sys.pyMisc/NEWSObjects/intobject.c Objects/longobject.cObjects/typeobject.cPython/bltinmodule.c

2008-06-28 Thread Alex Martelli
On Sat, Jun 28, 2008 at 4:46 PM, Raymond Hettinger [EMAIL PROTECTED] wrote: From: Mark Dickinson [EMAIL PROTECTED] There's one other major difference between the C99 notation and the current patch: the C99 notation includes a (hexa)decimal point. The advantages of this include: - the

Re: [Python-Dev] Python FAQ: Why doesn't Python have a with statement?

2008-06-18 Thread Alex Martelli
On Wed, Jun 18, 2008 at 9:58 PM, Cesare Di Mauro [EMAIL PROTECTED] wrote: Very very, interesting. Thanks. :) Somebody thinks that Python is unsuitable to implement a DSL: IMO your example prove the contrary. :D As long as you're willing to do the DSL within the strictures of Python syntax,

Re: [Python-Dev] Python FAQ: Why doesn't Python have a with statement?

2008-06-15 Thread Alex Martelli
+1 on updating the FAQ. Maybe we could even have it notice that a read-only version of the desired semantic for 'with' is easily hacked with the *current* semantic of 'with'...: @contextlib.contextmanager def readonly(anobj): caller_globals = sys._getframe(2).f_globals saved_globals =

Re: [Python-Dev] Python FAQ: Why doesn't Python have a with statement?

2008-06-14 Thread Alex Martelli
On Sat, Jun 14, 2008 at 1:24 PM, Simon Cross [EMAIL PROTECTED] wrote: On Sat, Jun 14, 2008 at 10:19 PM, Cesare Di Mauro [EMAIL PROTECTED] wrote: from Tkinter import * I discourage this too. :) And so do I, every single time I teach Python (which is pretty often, even though many of those

Re: [Python-Dev] Assignment to None

2008-06-09 Thread Alex Martelli
The problem is more general: what if a member (of some external object we're proxying one way or another) is named print (in Python 3), or class, or...? To allow foo.print or bar.class would require pretty big changes to Python's parser -- I have vague memories that the issue was discussed ages

Re: [Python-Dev] Mini-Pep: Simplifying the Integral ABC

2008-06-06 Thread Alex Martelli
On Fri, Jun 6, 2008 at 11:01 AM, Guido van Rossum [EMAIL PROTECTED] wrote: On Thu, Jun 5, 2008 at 8:45 PM, Raymond Hettinger [EMAIL PROTECTED] wrote: Does anyone actually need an int lookalike with binary methods but cannot just inherit from int? Does anyone actually need an int lookalike

Re: [Python-Dev] Addition of pyprocessing module to standard lib.

2008-05-21 Thread Alex Martelli
On Wed, May 21, 2008 at 1:53 PM, Raymond Hettinger [EMAIL PROTECTED] wrote: This thread has diverged a bit from the original topic. I suggest going ahead and adding pyprocessing to the library. IMO, its functionality is going to be an essential capability as more and more computers ship with

Re: [Python-Dev] Conditional For Statements

2008-05-19 Thread Alex Martelli
On Mon, May 19, 2008 at 5:33 AM, Steven D'Aprano [EMAIL PROTECTED] wrote: ... import this The Zen of Python, by Tim Peters ... There should be one-- and preferably only one --obvious way to do it. There should be ONE OBVIOUS way to do it, not only one way. The only one way phrasing is in

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

2008-05-04 Thread Alex Martelli
On Sun, May 4, 2008 at 3:31 AM, Raymond Hettinger [EMAIL PROTECTED] wrote: ... for k,g in groupby(iterable, key=lambda r: (r[0].lower(), r[5].lower())): ... lastname_firstname = lambda r: (r[0].lower(), r[5].lower()) for k, g in groupby(iterable, key=lastname_firstname): ... That

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

2008-05-03 Thread Alex Martelli
On Fri, May 2, 2008 at 11:32 PM, Mike Klaas [EMAIL PROTECTED] wrote: ... Sorry, that was a bad example. It is obviously silly if the return value of the function is callable. ...and yet it's *exactly* what keeps happening to lambda-happy programmers -- in production code as well as

Re: [Python-Dev] [Python-3000] Invitation to try out open source code review tool

2008-05-03 Thread Alex Martelli
On Sat, May 3, 2008 at 2:28 PM, Brett Cannon [EMAIL PROTECTED] wrote: ... I'd be great to integrate this with the bug tracker so that all submitted patches automagically show up in codereview with links to one another. Yeah, or a simple button to move it over there. Either way some

Re: [Python-Dev] Decimal(unicode)

2008-03-25 Thread Alex Martelli
On Tue, Mar 25, 2008 at 9:43 AM, Nick Coghlan [EMAIL PROTECTED] wrote: ... Since we have some strong use cases at least for the bytes-int case, consistency then suggests that the other numeric types should all accept bytes as well (interpreting them as ASCII encoded strings). +1 -- it

Re: [Python-Dev] Improved thread switching

2008-03-19 Thread Alex Martelli
Hmmm, sorry if I'm missing something obvious, but, if the occasional background computations are sufficiently heavy -- why not fork, do said computations in the child thread, and return the results via any of the various available IPC approaches? I've recently (at Pycon, mostly) been playing

Re: [Python-Dev] PEP Proposal: Revised slice objects lists use slice objects as indexes

2008-03-10 Thread Alex Martelli
On Mon, Mar 10, 2008 at 3:57 AM, Forrest Voight [EMAIL PROTECTED] wrote: I am not sure what you are trying to propose here. The slice object isn't special, it's just a regular built-in type. The idea is to have slice objects be generators. You could make a slice like 1:10:2 , and

Re: [Python-Dev] RQST: Master Thesis

2008-03-09 Thread Alex Martelli
Depending on which implementation[s] you want to target, Michal, you should also check out PyPy at http://codespeak.net/pypy/, IronPython at http://www.codeplex.com/IronPython, and Jython at http://www.jython.org/ -- Jython's currently a tad behind the other three, but Sun Microsystems has just

Re: [Python-Dev] C-API status of Python 3?

2008-03-02 Thread Alex Martelli
On Sun, Mar 2, 2008 at 10:39 AM, Gregory P. Smith [EMAIL PROTECTED] wrote: On 3/2/08, Christian Heimes [EMAIL PROTECTED] wrote: Alex Martelli wrote: Yep, but please do keep the PyUnicode for str and PyString for bytes (as macros/synonnyms of PyStr and PyBytes if you want!-) to help

Re: [Python-Dev] [Python-3000] No releases tonight

2008-03-01 Thread Alex Martelli
On Sat, Mar 1, 2008 at 11:11 AM, Barry Warsaw [EMAIL PROTECTED] wrote: ... I also propose translations of the shorter text to important languages like French, German, Japanese, Portuguese and Spanish. I'm willing to help with the German translation. Cool, thanks. I'd like to

Re: [Python-Dev] C-API status of Python 3?

2008-03-01 Thread Alex Martelli
On Sat, Mar 1, 2008 at 12:14 PM, Christian Heimes [EMAIL PROTECTED] wrote: ... The 3.0 API isn't stable yet. I plan to rename some of the functions before the first beta is released. Currently the naming schema is too confusing: PyUnicode - str PyString - bytes PyBytes - bytearray

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

2007-10-24 Thread Alex Martelli
On 10/12/07, Martin v. Löwis [EMAIL PROTECTED] wrote: The problem may be related to the fact that Python is rarely teached at school or university. I know no school or university in Germany that is teaching Python. I teach Python to the first semester, at the Hasso-Plattner-Institut in

Re: [Python-Dev] weakref enhancements

2006-09-28 Thread Alex Martelli
On 9/28/06, tomer filiba [EMAIL PROTECTED] wrote: I'm sceptical that these would find use in practice. [..] Also, I question the utility of maintaining a weakref to a method or attribute instead of holding one for the object or class. As long as the enclosing object or class lives, so

Re: [Python-Dev] Can LOAD_GLOBAL be optimized to a simple array lookup?

2006-08-23 Thread Alex Martelli
On Aug 23, 2006, at 2:22 PM, K.S.Sreeram wrote: Hi all, I noticed in Python/ceval.c that LOAD_GLOBAL uses a dictionary lookup, and was wondering if that can be optimized to a simple array lookup. If i'm right there are 3 kinds of name lookups: locals, outer scopes(closures), and globals.

Re: [Python-Dev] [Python-checkins] r51525 - in python/trunk: Lib/test/test_float.py Objects/floatobject.c

2006-08-23 Thread Alex Martelli
On Aug 23, 2006, at 3:29 PM, Thomas Wouters wrote: Since Alex isn't on python-dev, forwarding this for his convenience (he said he wanted to reply.) Thanks! I _am_ on Python-Dev (otherwise couldn't read what you're forwarding here), but not on Python-Checkins (where the discussion was

Re: [Python-Dev] [Python-checkins] r51525 - in python/trunk:Lib/test/test_float.py Objects/floatobject.c

2006-08-23 Thread Alex Martelli
On Aug 23, 2006, at 3:13 PM, [EMAIL PROTECTED] wrote: Zitat von Tim Peters [EMAIL PROTECTED]: Huh. It's been a (mildly controversial, but intentional all the same) feature that Python tries to raise raise OverflowError on overflowing libm operations. Doesn't work all that well, since

Re: [Python-Dev] ctypes and win64

2006-08-20 Thread Alex Martelli
On Aug 19, 2006, at 3:28 AM, Steve Holden wrote: ... It's going to be very interesting to see what comes out of the Google sprints. I am sure the 64-bitters will be out in force, so there'll be Hmmm, we'll be working on our laptops, as is typical of sprints, so I'm not sure how many

Re: [Python-Dev] Time-out in URL Open

2006-07-05 Thread Alex Martelli
What about doing it with a per-thread-timeout in TLS (overriding the global one if a thread does have it set in its TLS)? Not as clean, but perhaps far easier to implement than patching dozens of modules/functions/classes to provide timeout= options everywhere... Alex On 7/5/06, Guido van

Re: [Python-Dev] Import semantics

2006-07-05 Thread Alex Martelli
In Italian that would be DBAV (Dittatore benevolo a vita)...;-) Alex On 7/5/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Frank That said, I still regard Samuele Pedroni as the ultimate Frank authority on Jython and give him pretty much full veto power. He Frank fortunately

Re: [Python-Dev] Switch statement

2006-06-23 Thread Alex Martelli
On 6/22/06, Guido van Rossum [EMAIL PROTECTED] wrote: ... (1) An expression of the form 'static' atom has the semantics of evaluating the atom at the same time as the nearest surrounding function definition. If there is no surrounding function definition, 'static' is a no-op and the

[Python-Dev] a note in random.shuffle.__doc__ ...

2006-06-10 Thread Alex Martelli
...claims: Note that for even rather small len(x), the total number of permutations of x is larger than the period of most random number generators; this implies that most permutations of a long sequence can never be generated. Now -- why would the behavior of most random number generators be

Re: [Python-Dev] a note in random.shuffle.__doc__ ...

2006-06-10 Thread Alex Martelli
On Jun 10, 2006, at 1:08 PM, Josiah Carlson wrote: Josiah Carlson [EMAIL PROTECTED] wrote: Alex Martelli [EMAIL PROTECTED] wrote: ...claims: Note that for even rather small len(x), the total number of permutations of x is larger than the period of most random number generators

Re: [Python-Dev] epoll implementation

2006-05-26 Thread Alex Martelli
On May 26, 2006, at 6:27 PM, Steve Holden wrote: Greg Ewing wrote: Fredrik Lundh wrote: roughly speaking, epoll is kqueue for linux. There are many different select-like things around now (select, poll, epoll, kqueue -- are there others?) and random combinations of them seem to be

Re: [Python-Dev] Visual studio 2005 express now free

2006-04-24 Thread Alex Martelli
already downloaded it, or it's acceptable for someone else to host it, there's once again no way to build Python with free tools :-( [...] Actually, it's apparently still there, just at a different URL. Somebody posted the new URL on c.l.py a day or two back (Alex Martelli started

Re: [Python-Dev] Visual studio 2005 express now free

2006-04-24 Thread Alex Martelli
On Apr 24, 2006, at 12:19 AM, Martin v. Löwis wrote: Martin v. Löwis wrote: - Paul Moore has contributed a Python build procedure for the free version of the 2003 compiler. This one is without IDE, but still, it should allow people without a VS 2003 license to work on Python itself;

Re: [Python-Dev] Visual studio 2005 express now free

2006-04-24 Thread Alex Martelli
On Apr 24, 2006, at 12:48 AM, Neil Hodgson wrote: Martin v. Löwis: Apparently, the status of this changed right now: it seems that the 2003 compiler is not available anymore; the page now says that it was replaced with the 2005 compiler. Should we reconsider? I expect Microsoft means

Re: [Python-Dev] Visual studio 2005 express now free

2006-04-24 Thread Alex Martelli
On Apr 24, 2006, at 1:24 AM, Paul Moore wrote: On 4/24/06, Neil Hodgson [EMAIL PROTECTED] wrote: Martin v. Löwis: Apparently, the status of this changed right now: it seems that the 2003 compiler is not available anymore; the page now says that it was replaced with the 2005 compiler.

Re: [Python-Dev] Google Summer of Code proposal: improvement of long int and adding new types/modules.

2006-04-21 Thread Alex Martelli
On Apr 21, 2006, at 7:46 AM, Aahz wrote: On Fri, Apr 21, 2006, Mateusz Rukowicz wrote: Next thing I would add is multi precision floating point type to the core and fraction type, which in some cases highly improves operations, which would have to be done using floating point instead. Of

Re: [Python-Dev] Google Summer of Code proposal: improvement of long int and adding new types/modules.

2006-04-21 Thread Alex Martelli
On 4/21/06, Mateusz Rukowicz [EMAIL PROTECTED] wrote: ... So I think the most valuable of my ideas would be improving long int + coding decimal in C. Anyway, I think it would be possible to add other ideas later. I see redo Decimal in C (possibly with the addition of some fast elementary

[Python-Dev] 2.5 post-alpha1 broken on mac-intel machines

2006-04-16 Thread Alex Martelli
Back from vacation, just did an svn up and make, and...: ... gcc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes Parser/acceler.o Parser/grammar1.o Parser/listnode.o Parser/node.o Parser/parser.o Parser/parsetok.o Parser/bitset.o Parser/metagrammar.o Parser/ firstsets.o Parser/grammar.o

Re: [Python-Dev] The i string-prefix: I18n'ed strings

2006-04-06 Thread Alex Martelli
On 4/6/06, Martin Blais [EMAIL PROTECTED] wrote: ... So I had the following idea: would it not be nice if there existed a string-prefix 'i' -- a string prefix like for the raw (r'...') and unicode (u'...') strings -- that would mark the string as being for i18n? Something like this

Re: [Python-Dev] tally (and other accumulators)

2006-04-05 Thread Alex Martelli
On Apr 4, 2006, at 10:53 PM, Jess Austin wrote: Alex wrote: import collections def tally(seq): d = collections.defaultdict(int) for item in seq: d[item] += 1 return dict(d) I'll stop lurking and submit the following: def tally(seq): return dict((group[0],

Re: [Python-Dev] elementtree in stdlib

2006-04-05 Thread Alex Martelli
On Apr 5, 2006, at 8:30 PM, Greg Ewing wrote: A while ago there was some discussion about including elementtree in the std lib. I can't remember what the conclusion about that was, but if it does go ahead, I'd like to suggest that it be reorganised a bit. I've just started playing with it,

[Python-Dev] tally (and other accumulators)

2006-04-04 Thread Alex Martelli
It's a bit late for 2.5, of course, but, I thought I'd propose it anyway -- I noticed it on c.l.py. In 2.3/2.4 we have many ways to generate and process iterators but few accumulators -- functions that accept an iterable and produce some kind of summary result from it. sum, min, max, for

Re: [Python-Dev] tally (and other accumulators)

2006-04-04 Thread Alex Martelli
On Apr 4, 2006, at 8:01 AM, Jeremy Hylton wrote: On 4/4/06, Alex Martelli [EMAIL PROTECTED] wrote: import collections def tally(seq): d = collections.defaultdict(int) for item in seq: d[item] += 1 return dict(d) ... Putting it somewhere in collections seems

Re: [Python-Dev] tally (and other accumulators)

2006-04-04 Thread Alex Martelli
On 4/4/06, Raymond Hettinger [EMAIL PROTECTED] wrote: [Alex] This is quite general and simple at the same time: for example, it was proposed originally to answer some complaint about any and all giving no indication of the count of true/false items: tally(bool(x) for x in seq) would

Re: [Python-Dev] PySet API

2006-03-29 Thread Alex Martelli
On Mar 27, 2006, at 7:20 AM, Raymond Hettinger wrote: Why don't we expose _PySet_Next() for Barry and leave it out of the public API for everyone else. There are precedents for adding some functionality to the C API but not documenting it to ensure non advanced users don't get hurt --

Re: [Python-Dev] PySet API

2006-03-26 Thread Alex Martelli
On Mar 26, 2006, at 8:43 AM, Raymond Hettinger wrote: [Aahz] Speaking as a person who does relatively little C programming, I don't see much difference between them. The first example is more Pythonic -- for Python. I agree with Barry that it's not much of a virtue for C code. It

Re: [Python-Dev] PySet API

2006-03-25 Thread Alex Martelli
On Mar 25, 2006, at 9:57 PM, Aahz wrote: I'd really like to see someone else who understands the issues (i.e. using the Python C-API) weigh in. Both Barry and Raymond are clever programmers who generally understand what's Pythonic, and I find myself agreeing with whoever posted last.

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

2006-03-19 Thread Alex Martelli
On Mar 19, 2006, at 7:42 PM, Guido van Rossum wrote: ... There seem to be other places where Python is beginning to require parens even though they aren't strictly necessary to resolve syntactic ambiguity. In the style guide only, I hope. The parens that are mandatory in a few

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

2006-03-16 Thread Alex Martelli
On Mar 16, 2006, at 7:30 PM, Brett Cannon wrote: ... I agree. as is taking on the use of assignment in statements that are not ``=`` and I say we just keep on with that. Plus Greg's above Hmmm, if we allowed '(expr as var)' for generic expr's we'd make a lot of people pining for

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

2006-03-13 Thread Alex Martelli
On Mar 13, 2006, at 12:29 PM, Fabiano Sidler wrote: Hi folks! Hello Fabiano! The proper venue for your interesting issues is comp.lang.python (or the equivalent mailing list), where all sorts of people will be able to hear you, discuss things, and help out. python-dev is strictly for

Re: [Python-Dev] decorator module patch

2006-03-12 Thread Alex Martelli
On Mar 12, 2006, at 11:16 AM, Ian Bicking wrote: ... memoize seems to fit into functools fairly well, though deprecated not so much. functools is similarly named to itertools, another module that is kind of vague in scope (though functools is much more vague). partial would make just

Re: [Python-Dev] as mania

2006-03-07 Thread Alex Martelli
On Mar 7, 2006, at 6:15 AM, Georg Brandl wrote: Hi, while as is being made a keyword, I remembered parallels between with and a proposal made some time ago: with expr as f: do something with f while expr as f: do something with f if expr as f: do something with f

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

2006-03-07 Thread Alex Martelli
On Mar 7, 2006, at 7:29 AM, Steve Holden wrote: ... In fact, I think the below examples are reasonable uses that do a better job of expressing intent than the if statement would. I just don't like the mental backtrack they require, and would like some sort of advance warning.

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

2006-03-06 Thread Alex Martelli
On Mar 6, 2006, at 4:43 PM, Bob Ippolito wrote: On Mar 6, 2006, at 4:14 PM, Guido van Rossum wrote: ... I wonder if this use case and the frequently requested case-insensitive dict don't have some kind of generalization in common -- perhaps a dict that takes a key function a la

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

2006-03-06 Thread Alex Martelli
On Mar 6, 2006, at 10:17 AM, Tim Peters wrote: ... How's everyone doing, BTW? Swimmingly, thanks! Too busy to breathe, or come to pycon:-(, but, happy as a lark. I think I picked up the Texas Mystery Disease from Holger Krekel -- bed-ridden 20 hours Saturday, and most of Sunday, with

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

2006-03-06 Thread Alex Martelli
On Mar 6, 2006, at 9:17 AM, Jim Jewett wrote: ... I think that adding parentheses would help, by at least signalling that the logic is longer than just the next (single) expression. level = (0 if absolute_import in self.futures else -1) +1 (just because I can't give it

Re: [Python-Dev] Translating docs

2006-02-25 Thread Alex Martelli
On Feb 25, 2006, at 4:43 PM, [EMAIL PROTECTED] wrote: Zitat von Facundo Batista [EMAIL PROTECTED]: The question is, it's ok to use a third party system for this initiative? Or you (we) prefer to host it in-house? Someone alredy thought of this? I thought about it at one time, and I think

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

2006-02-23 Thread Alex Martelli
: Guido van Rossum Alex Martelli many other worthies snipped 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 can carry it to you, just let me know

Re: [Python-Dev] defaultdict proposal round three

2006-02-22 Thread Alex Martelli
On Feb 22, 2006, at 7:21 AM, Raymond Hettinger wrote: ... I'm somewhat happy with the patch as it stands now. The only part that needs serious rethinking is putting on_missing() in regular dicts. See my other email on that subject. What if we named it _on_missing? Hook methods

Re: [Python-Dev] defaultdict proposal round three

2006-02-21 Thread Alex Martelli
On Feb 21, 2006, at 1:51 AM, Greg Ewing wrote: ... Just one more thing -- have you made a final decision about the name yet? I'd still prefer something like 'autodict', because to me 'defaultdict' suggests autodict is shorter and sharper and I prefer it, too: +1 etc.) it seems more

Re: [Python-Dev] defaultdict proposal round three

2006-02-20 Thread Alex Martelli
On Feb 20, 2006, at 5:41 AM, Guido van Rossum wrote: ... Alternative A: add a new method to the dict type with the semantics of __getattr__ from the last proposal, using default_factory if not None (except on_missing is inlined). This avoids the discussion about broken invariants, but one

Re: [Python-Dev] defaultdict proposal round three

2006-02-20 Thread Alex Martelli
On Feb 20, 2006, at 8:35 AM, Raymond Hettinger wrote: [GvR] I'm not convinced by the argument that __contains__ should always return True Me either. I cannot think of a more useless behavior or one more likely to have unexpected consequences. Besides, as Josiah pointed out, it is

Re: [Python-Dev] defaultdict proposal round three

2006-02-20 Thread Alex Martelli
On Feb 20, 2006, at 12:33 PM, Guido van Rossum wrote: ... You don't need a new feature for that use case; d[k] = d.get(k, 0) + 1 is perfectly fine there and hard to improve upon. I see d[k]+=1 as a substantial improvement -- conceptually more direct, I've now seen one more k than I had

Re: [Python-Dev] Proposal: defaultdict

2006-02-20 Thread Alex Martelli
On Feb 20, 2006, at 12:38 PM, Aahz wrote: ... Can you say, for the record (since nobody else seems to care), if d.getorset(key, func) would work in your use cases? Because I haven't been reading this thread all that closely, you'll have to remind me what this means. Roughly the same

Re: [Python-Dev] defaultdict proposal round three

2006-02-20 Thread Alex Martelli
On Feb 20, 2006, at 3:04 PM, Brett Cannon wrote: ... - Yes and it should be the only constructor argument. This is my ... While #3 is my preferred solution as well, it does pose a Liskov violation if this is a direct dict subclass instead of storing a dict How so? Liskov's

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 that I'm withdrawing proposal A (new method) and championing only B (a

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

2006-02-20 Thread Alex Martelli
On Feb 21, 2006, at 6:53 AM, Bengt Richter wrote: Perhaps a more informative message would be nice. Here's an easy way to trigger it: compile(#-*- coding: ascii -*-\nprint 'ab%c'\n%0x80, '','exec') Traceback (most recent call last): File stdin, line 1, in ? MemoryError Definitely

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

2006-02-18 Thread Alex Martelli
On Feb 18, 2006, at 12:38 AM, Georg Brandl wrote: Guido van Rossum wrote: WFM. Patch anyone? Done. http://python.org/sf/1434038 I reviewed the patch and added a comment on it, but since the point may be controversial I had better air it here for discussion: in 2.4,

Re: [Python-Dev] Proposal: defaultdict

2006-02-17 Thread Alex Martelli
On 2/16/06, Guido van Rossum [EMAIL PROTECTED] wrote: A bunch of Googlers were discussing the best way of doing the ... Wow, what a great discussion! As you'll recall, I had also mentioned the callable factory as a live possibility, and there seems to be a strong sentiment in favor of that;

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

2006-02-17 Thread Alex Martelli
On 2/17/06, Georg Brandl [EMAIL PROTECTED] wrote: Ian Bicking wrote: Unfortunately, a @property decorator is impossible... It already works! But only if you want a read-only property. Which is actually about 50%+ of the properties I create. So the status quo is not really that bad.

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

2006-02-15 Thread Alex Martelli
On Feb 15, 2006, at 9:51 AM, Barry Warsaw wrote: On Wed, 2006-02-15 at 09:17 -0800, Guido van Rossum wrote: Regarding open vs. opentext, I'm still not sure. I don't want to generalize from the openbytes precedent to openstr or openunicode (especially since the former is wrong in 2.x and the

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

2006-02-14 Thread Alex Martelli
On 2/14/06, Just van Rossum [EMAIL PROTECTED] wrote: ... Maybe it's even better to use opentext() AND openbinary(), and deprecate plain open(). We could even introduce them at the same time as bytes() (and leave the open() deprecation for 3.0). What about shorter names, such as 'text'

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
On 2/13/06, Guido van Rossum [EMAIL PROTECTED] wrote: ... I don't like to add a built-in index() at this point; mostly because of Occam's razor (we haven't found a need). I thought you had agreed, back when I had said that __index__ should also be made easily available to implementors of

[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 it is a

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 aggressive (by

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 write

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] 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 empty dict and

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. But

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 '+' makes the two

[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

  1   2   >