[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

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 > wrote: Adam Olsen wrote: On Fri, Oct 23, 2009 at 11:04, Vitor Bosshard wrote: I see this as being useful for frozensets as well, where you can't get an arbitrary element easily due to

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 : > 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 betwen statements an

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 wrote: > > Hi, > > > > this is just a short notice that Mattias Brändström and I have finished a > > patch to implement

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

2009-04-23 Thread Alex Martelli
On Thu, Apr 23, 2009 at 11:21 AM, cyberGn0m 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 > snapshot? > I haven't

Re: [Python-Dev] Possible py3k io wierdness

2009-04-05 Thread Alex Martelli
On Sun, Apr 5, 2009 at 3:54 PM, Nick Coghlan wrote: > Antoine Pitrou wrote: > > James Y Knight 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 on the base

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

2009-03-31 Thread Alex Martelli
On Tue, Mar 31, 2009 at 6:33 PM, Alexandre Vassalotti wrote: ... > html > https://lists.ubuntu.com/archives/bazaar/2009q1/055872.html > Perfect, thanks! Alex ___ Python-Dev mailing list

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

2009-03-31 Thread Alex Martelli
On Tue, Mar 31, 2009 at 6:33 PM, Alexandre Vassalotti wrote: ... > html > https://lists.ubuntu.com/archives/bazaar/2009q1/055872.html > Perfect, thanks! Alex ___ Python-Dev mailing list

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

2009-03-31 Thread Alex Martelli
On Tue, Mar 31, 2009 at 5:42 PM, Tres Seaver 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 it might b

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

2009-03-31 Thread Alex Martelli
On Tue, Mar 31, 2009 at 5:42 PM, Tres Seaver 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 it might b

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 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 cheap, so I'v

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 err

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

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 requires

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 Li

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 ext

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

2008-08-26 Thread Alex Martelli
On Tue, Aug 26, 2008 at 6:16 PM, Michele Simionato <[EMAIL PROTECTED]> wrote: ... > It is just a matter of how rare the use cases really are. Cooperative > methods has been introduced 6+ years ago. In all this time surely > they must have been used. How many compelling uses of cooperation > we c

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

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

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

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 sy

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 = cal

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 th

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

2008-06-14 Thread Alex Martelli
Yep. Javascript's totally botched and unusable 'with' statement is an excellent warning of what horrors that kind of thing can wreck in a dynamic language unless carefully designed. I also agree that .foo is a good disambiguation syntax -- unfortunately it doesn't disambiguate among *nested* with

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 loo

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

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"

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): ... >

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

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 exam

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

2008-05-02 Thread Alex Martelli
On Fri, May 2, 2008 at 4:11 PM, Jesse Noller <[EMAIL PROTECTED]> wrote: > +1 from me +2 from me -- of all abuses of lambdas, this one's the worst. Alex ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev

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

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 devil

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 ,

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 ann

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/

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

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

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-Inst

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

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 we

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 w

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 glo

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 64-

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> fortu

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 Ross

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' 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 expres

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

[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] Pre-PEP: Allow Empty Subscript List Without Parentheses

2006-06-09 Thread Alex Martelli
On Jun 9, 2006, at 4:55 PM, Greg Ewing wrote: ... > Think about how you get from an N dimensional array to > an N-1 dimensional array: you index it, e.g. > > A2 = [[1, 2], [3, 4]] # a 2D array > > A1 = A2[1] # a 1D array > > A0 = A1[1] # a 0D array??? > > print A0 > > What do you think

Re: [Python-Dev] Pre-PEP: Allow Empty Subscript List Without Parentheses

2006-06-09 Thread Alex Martelli
On 6/9/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: ... > The language doesn't have zero-dimensional arrays, although it doesn't > prevent users from defining them. but why would one want to index a > zero-dimensional array, since it has no dimensions? It should be > written as x, not x[]. W

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 t

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

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 Mi

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 i

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

2006-04-24 Thread Alex Martelli
gt;> 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 the thread, IIRC). I'm off to the dentist, no > time to Google fo

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, Greg Ewing <[EMAIL PROTECTED]> wrote: ... > > GMP is covered by LGPL, so must any such derivative work > > But the wrapper is just using GMP as a library, so > it shouldn't be infected with LGPLness, should it? If a lawyer for the PSF can confidently assert that gmpy is not a deriva

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 element

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 instea

[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 Parser

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] 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 wit

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

2006-04-04 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

Re: [Python-Dev] Should issubclass() be more like isinstance()?

2006-04-04 Thread Alex Martelli
On Apr 4, 2006, at 8:18 PM, Crutcher Dunnavant wrote: ... >> There's no rule that predicate cannot raise an exception. > > No, but it makes many applications (such as using it as a test in list > comprehensions) difficult enough to not be worth it. IMHO, the solution to THAT very real problem

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 se

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 >> ret

[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, fo

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] pysqlite for 2.5?

2006-03-29 Thread Alex Martelli
On 3/29/06, Paul Moore <[EMAIL PROTECTED]> wrote: > On 3/29/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > from a user perspective, adding this to the standard library is a > > no-brainer. > > the only reason not to add it would be if the release managers don't have > > time to sort out the bu

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

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

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-dev/archive%40mail

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 '( as )' for generic expr's we'd make a lot of people pining for 'assignmen

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] 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 j

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] "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 some

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 +3.1415

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, w

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

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

2006-02-27 Thread Alex Martelli
On 2/27/06, M.-A. Lemburg <[EMAIL PROTECTED]> wrote: > Microsoft has recently released their express version of the Visual C++. > Given that this version is free for everyone, wouldn't it make sense > to ship Python 2.5 compiled with this version ?! > > http://msdn.microsoft.com/vstudio/express

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

2006-02-26 Thread Alex Martelli
On Feb 26, 2006, at 5:43 PM, Ron Adam wrote: ... > So far everywhere I've seen closures used, a class would work. But > maybe not as conveniently or as fast? Yep. In this, closures are like generators: much more convenient than purpose-built classes, but not as general. > Haskel sounds in

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

2006-02-26 Thread Alex Martelli
On Feb 26, 2006, at 4:20 PM, Ron Adam wrote: ... > (sigh of relief) Ok, so the following example will still be true. Yep, no danger of dynamic scoping, be certain of that. > Maybe something explicit like: > import __main__ as glob Sure, or the more general ''glob=__import__(__name__)''

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

2006-02-26 Thread Alex Martelli
On Feb 26, 2006, at 11:47 AM, Ron Adam wrote: ... > How would you know you aren't in inadvertently masking a name in a > function you call? What does calling have to do with it? Nobody's proposing a move to (shudder) dynamic scopes, we're talking of saner concepts such as lexical scopes a

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, a

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

2006-02-24 Thread Alex Martelli
On 2/24/06, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > Michael Chermside wrote: > >> The next() method of iterators was an interesting > >> object lesson. ... Since it was sometimes invoked by name > >> and sometimes by special mechanism, the choice was to use the > >> unadorned name, but lat

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 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 int

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 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 "", line 1, in ? > MemoryError Defin

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 champio

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 pr

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

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] 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

  1   2   3   >