Re: [Python-Dev] "as" mania

2006-03-07 Thread Steve Holden
Andrew Koenig wrote: >>Function arguments are not covered by this trick, but >> >>def bar(z): >>(x,y) = z >> >>probably isn't too much overhead... > > > It's not the machine overhead, it's the intellectual overhead. I know there > are some who will disagree with me, but I would find

Re: [Python-Dev] Long-time shy failure in test_socket_ssl

2006-03-07 Thread Neal Norwitz
On 2/27/06, Tim Peters <[EMAIL PROTECTED]> wrote: > > Neal plugged another hole later, but-- alas --I have seen the same shy > failure since then on WinXP. One of the most recent buildbot test > runs saw it too, on a non-Windows box: > > http://www.python.org/dev/buildbot/trunk/g5%20osx.3%20trunk/

Re: [Python-Dev] _bsddb.c ownership

2006-03-07 Thread Thomas Wouters
On 3/7/06, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: Thomas Wouters wrote:> Who 'owns' Modules/_bsddb.c, if anyone?It's a fork of pybsddb, originally contributed by Gregory Smith (*).For all practical purposes, he also "owns" it, but hasn't objected to others making changes in the past.At the ti

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

2006-03-07 Thread Robert Brewer
Greg Ewing wrote: > Jeremy Hylton wrote: > > Perhaps the solution > > is to require parens around all expressions, a simple > consistent rule. > > I actually designed a language with that feature once. > It was an exercise in minimality, with hardly anything > built-in -- all the arithmetic opera

Re: [Python-Dev] "as" mania

2006-03-07 Thread Greg Ewing
Alex Martelli wrote: > On Mar 7, 2006, at 6:15 AM, Georg Brandl wrote: >>with expr as f: >>do something with f I expect the "with" example here is a red herring, not intended to have anything to do with the new "with" statement that's just been added. > I think the best use cases for 'assign

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

2006-03-07 Thread Greg Ewing
Paul Moore wrote: > +0 for mentioning parens around conditional expressions in PEP 8. But > it's aready covered by the general "code should be readable" in my > view. Indeed. Writing readable code is ultimately the responsibility of the person doing the writing. It's enough that you *can* put par

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

2006-03-07 Thread Greg Ewing
Jeremy Hylton wrote: > Perhaps the solution > is to require parens around all expressions, a simple consistent rule. I actually designed a language with that feature once. It was an exercise in minimality, with hardly anything built-in -- all the arithmetic operators, etc. were defined in the lang

[Python-Dev] quit() on the prompt

2006-03-07 Thread Jim Jewett
Ian reproposed: class Quitter(object): def __init__(self, name): self.name = name def __repr__(self): return 'Use %s() to exit' % self.name def __call__(self): raise SystemExit() The one change I would suggest is the string use

Re: [Python-Dev] str(Exception) changed, is that intended?

2006-03-07 Thread Brett Cannon
On 3/7/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 3/7/06, Barry Warsaw <[EMAIL PROTECTED]> wrote: > > On Tue, 2006-03-07 at 13:35 -0800, Guido van Rossum wrote: > > > > > IMO it shouldn't be fixed. Classic classes define their str to print > > > the module name and class name with a dot i

Re: [Python-Dev] quit() on the prompt

2006-03-07 Thread Thomas Wouters
On 3/8/06, Brett Cannon <[EMAIL PROTECTED]> wrote: On 3/7/06, Ian Bicking <[EMAIL PROTECTED]> wrote:> class Quitter(object):>  def __init__(self, name):>  self.name = name>  def __repr__(self):>  return 'Use %s() to exit' % self.name>  def __call__(self):>  rais

Re: [Python-Dev] quit() on the prompt

2006-03-07 Thread Brett Cannon
On 3/7/06, Ian Bicking <[EMAIL PROTECTED]> wrote: > Frederick suggested a change to quit/exit a while ago, so it wasn't just > a string with slight instructional purpose, but actually useful. The > discussion was surprisingly involved, despite the change really trully > not being that big. And ev

Re: [Python-Dev] quit() on the prompt

2006-03-07 Thread Ian Bicking
BJörn Lindqvist wrote: > do { > cmd = readline() > do_stuff_with_cmd(cmd); > } while (!strcmp(cmd, "quit")); > printf("Bye!"); > exit(0); > > KISS? I believe there were concerns that rebinding quit would cause strange behavior. E.g.: >>> quit = False >>> while not quit: ... >>

Re: [Python-Dev] quit() on the prompt

2006-03-07 Thread Crutcher Dunnavant
I am probably the biggest proponent of magic variables, but this just won't work. First, commands and lines are not the same thing, so: print \ exit breaks your propossal. Second, quit and exit are bindable variables, and you need to be sure that they still mean _quit_, and not something else.

Re: [Python-Dev] quit() on the prompt

2006-03-07 Thread BJörn Lindqvist
do { cmd = readline() do_stuff_with_cmd(cmd); } while (!strcmp(cmd, "quit")); printf("Bye!"); exit(0); KISS? -- mvh Björn ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://m

Re: [Python-Dev] quit() on the prompt

2006-03-07 Thread Nick Coghlan
Ian Bicking wrote: > class Quitter(object): > def __init__(self, name): > self.name = name > def __repr__(self): > return 'Use %s() to exit' % self.name > def __call__(self): > raise SystemExit() > quit = Quitter('quit') > exit = Quitter('exit') > > This i

Re: [Python-Dev] str(Exception) changed, is that intended?

2006-03-07 Thread Guido van Rossum
On 3/7/06, Barry Warsaw <[EMAIL PROTECTED]> wrote: > On Tue, 2006-03-07 at 13:35 -0800, Guido van Rossum wrote: > > > IMO it shouldn't be fixed. Classic classes define their str to print > > the module name and class name with a dot in between; new-style > > classes use the same format as their rep

Re: [Python-Dev] str(Exception) changed, is that intended?

2006-03-07 Thread Barry Warsaw
On Tue, 2006-03-07 at 13:35 -0800, Guido van Rossum wrote: > IMO it shouldn't be fixed. Classic classes define their str to print > the module name and class name with a dot in between; new-style > classes use the same format as their repr. Making exceptions new-style > classes is going to break a

Re: [Python-Dev] quit() on the prompt

2006-03-07 Thread Guido van Rossum
Works for me. On 3/7/06, Ian Bicking <[EMAIL PROTECTED]> wrote: > Frederick suggested a change to quit/exit a while ago, so it wasn't just > a string with slight instructional purpose, but actually useful. The > discussion was surprisingly involved, despite the change really trully > not being th

[Python-Dev] quit() on the prompt

2006-03-07 Thread Ian Bicking
Frederick suggested a change to quit/exit a while ago, so it wasn't just a string with slight instructional purpose, but actually useful. The discussion was surprisingly involved, despite the change really trully not being that big. And everyone drifted off, too tired from the discussion to m

Re: [Python-Dev] str(Exception) changed, is that intended?

2006-03-07 Thread Thomas Heller
Brett Cannon wrote: > On 3/7/06, Thomas Heller <[EMAIL PROTECTED]> wrote: >> I know that my unittests should not rely on this, but is this change >> intended? >> >> c:\sf\ctypes_head>py24 >> Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on >> win32 >> Type "help", "copyrigh

Re: [Python-Dev] str(Exception) changed, is that intended?

2006-03-07 Thread Guido van Rossum
On 3/7/06, Brett Cannon <[EMAIL PROTECTED]> wrote: > On 3/7/06, Thomas Heller <[EMAIL PROTECTED]> wrote: > > I know that my unittests should not rely on this, but is this change > > intended? > > > > c:\sf\ctypes_head>py24 > > Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on

Re: [Python-Dev] how about adding ping's uuid module to the standard lib ?

2006-03-07 Thread Thomas Heller
Oleg Broytmann wrote: > On Tue, Mar 07, 2006 at 10:19:03PM +0100, Thomas Heller wrote: >> Too bad that ctypes whill be an optional module, so I'm >> not sure if it could be used in the Python library itself. > > try: >import ctypes > except ImportError: >def fallback(): > ... > else:

Re: [Python-Dev] how about adding ping's uuid module to the standard lib ?

2006-03-07 Thread Oleg Broytmann
On Tue, Mar 07, 2006 at 10:19:03PM +0100, Thomas Heller wrote: > Too bad that ctypes whill be an optional module, so I'm > not sure if it could be used in the Python library itself. try: import ctypes except ImportError: def fallback(): ... else: def real_thing(): ... Oleg. -

Re: [Python-Dev] how about adding ping's uuid module to the standard lib ?

2006-03-07 Thread Thomas Heller
Paul Moore wrote: > On 3/7/06, Phillip J. Eby <[EMAIL PROTECTED]> wrote: >> At 06:29 AM 3/7/2006 +0100, Fredrik Lundh wrote: >>> see subject and http://python.org/sf/1368955 >>> >>> comments ? >> would be nice if you could just call UUID() to create a generic UUID in a >> platform-appropriate way.

Re: [Python-Dev] str(Exception) changed, is that intended?

2006-03-07 Thread Brett Cannon
On 3/7/06, Thomas Heller <[EMAIL PROTECTED]> wrote: > I know that my unittests should not rely on this, but is this change > intended? > > c:\sf\ctypes_head>py24 > Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32 > Type "help", "copyright", "credits" or "license" for m

[Python-Dev] str(Exception) changed, is that intended?

2006-03-07 Thread Thomas Heller
I know that my unittests should not rely on this, but is this change intended? c:\sf\ctypes_head>py24 Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> str(Exception) 'exceptions.Exception' >>>

Re: [Python-Dev] "as" mania

2006-03-07 Thread Andrew Koenig
> Function arguments are not covered by this trick, but > > def bar(z): > (x,y) = z > > probably isn't too much overhead... It's not the machine overhead, it's the intellectual overhead. I know there are some who will disagree with me, but I would find it easier to read de

Re: [Python-Dev] "as" mania

2006-03-07 Thread Paul Moore
On 3/7/06, Andrew Koenig <[EMAIL PROTECTED]> wrote: > As it turns out, Python has similar ways of decomposing data structures: > > (x, y) = foo > > or > > def bar((x, y)): > # etc. > > and I have sometimes wished I could write > > z as (x, y) = foo > > or > >

Re: [Python-Dev] _bsddb.c ownership

2006-03-07 Thread Martin v. Löwis
Thomas Wouters wrote: > Who 'owns' Modules/_bsddb.c, if anyone? It's a fork of pybsddb, originally contributed by Gregory Smith (*). For all practical purposes, he also "owns" it, but hasn't objected to others making changes in the past. At the time it was imported, I recall the plan was to out-p

Re: [Python-Dev] "as" mania

2006-03-07 Thread Andrew Koenig
> Thinking over it, this is too much a difference between the with-"as" and > my "as", so I'm abandoning this idea. My "as" would just have been a > shortcut to avoid writing longish expressions that have to be checked for > true-ness and then tinkered with. ML has a similar feature, which you may

Re: [Python-Dev] "as" mania

2006-03-07 Thread Georg Brandl
Guido van Rossum wrote: > On 3/7/06, Georg Brandl <[EMAIL PROTECTED]> wrote: >> > Have you even tried to define precise semantics for any of those, like >> > the expansion of "with E as V: B" in PEP 343? >> >> Easily. >> >> if expr as name: >> BLOCK >> >> would be equivalent to >> >> name = exp

Re: [Python-Dev] "as" mania

2006-03-07 Thread Josiah Carlson
Georg Brandl <[EMAIL PROTECTED]> wrote: > or something like > > m = re.match(...) > if m.group(1) as filename: > do something with filename Except that m could be None, which would raise an exception during the .group(1) call. Perhaps you meant... m = re.match(...) if m and m.group(1) as f

Re: [Python-Dev] "as" mania

2006-03-07 Thread Georg Brandl
Alex Martelli wrote: > I think the best use cases for 'assignment inside an if or while' > condition, as far as they go, require `capturing' a SUB-expression of > the condition, rather than the whole condition. E.g., in C, > > while ( (x=next_x()) < threshold ) ... > > being able to capture

Re: [Python-Dev] "as" mania

2006-03-07 Thread Guido van Rossum
On 3/7/06, Georg Brandl <[EMAIL PROTECTED]> wrote: > > Have you even tried to define precise semantics for any of those, like > > the expansion of "with E as V: B" in PEP 343? > > Easily. > > if expr as name: > BLOCK > > would be equivalent to > > name = expr > if name: > BLOCK > del name

Re: [Python-Dev] "as" mania

2006-03-07 Thread Georg Brandl
[HPH the BDFL] > I suggest you file those as products of an overactive imagination. :-) At least not only mine. ;) > Have you even tried to define precise semantics for any of those, like > the expansion of "with E as V: B" in PEP 343? Easily. if expr as name: BLOCK would be equivalent to

Re: [Python-Dev] how about adding ping's uuid module to the standard lib ?

2006-03-07 Thread Bill Janssen
> Philip Eby writes: > ... > I completely agree with Philip. Sorry, I mean of course "Phillip". Bill ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/option

Re: [Python-Dev] how about adding ping's uuid module to the standard lib ?

2006-03-07 Thread Bill Janssen
Having UUID in the stdlib would be very helpful. Philip Eby writes: > I like the idea of having RFC-compliant UUIDs in the stdlib, but I really > want immutable ones, preferably without {} in their standard string > representation. And efficient use of platform-local UUID generation APIs > wou

[Python-Dev] _bsddb.c ownership

2006-03-07 Thread Thomas Wouters
Who 'owns' Modules/_bsddb.c, if anyone? The file doesn't mention whether it's a fork of pybsddb maintained separately or not. I ask because it seems to contain a number of refleaks, and I wanted to fix some of the style issues while I'm at it (and maybe even Py_ssize_t it,) but I'll happily send th

Re: [Python-Dev] how about adding ping's uuid module to the standard lib ?

2006-03-07 Thread Paul Moore
On 3/7/06, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > At 06:29 AM 3/7/2006 +0100, Fredrik Lundh wrote: > >see subject and http://python.org/sf/1368955 > > > >comments ? > > would be nice if you could just call UUID() to create a generic UUID in a > platform-appropriate way. PEAK's uuid module doe

Re: [Python-Dev] how about adding ping's uuid module to the standard lib ?

2006-03-07 Thread Phillip J. Eby
At 06:29 AM 3/7/2006 +0100, Fredrik Lundh wrote: >see subject and http://python.org/sf/1368955 > >comments ? Why can't the UUIDs be immutable, so they can be dictionary keys? Also, it would be nice if you could just call UUID() to create a generic UUID in a platform-appropriate way. PEAK's uui

[Python-Dev] Scientific Survey: Working Conditions in Open Source Projects

2006-03-07 Thread Dirk Jendroska
We like to invite you to a survey about the working conditions in Free/Open-Source Software development. This survey is conducted by the Open-Source Research Group of the University of Würzburg (Germany). We will compare work design in open source and proprietary software development. Our findi

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] conditional expressions - add parens?

2006-03-07 Thread Steve Holden
Jim Jewett wrote: > On 3/7/06, Paul Moore <[EMAIL PROTECTED]> wrote: > > >>The parentheses around genexps were (AFAICT) >>different - without them, the grammar was ambiguous, >>so some way of disambiguating was needed. > > > The out-of-order evaluation is a very large change, > because now we h

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

2006-03-07 Thread Jim Jewett
On 3/7/06, Paul Moore <[EMAIL PROTECTED]> wrote: > The parentheses around genexps were (AFAICT) > different - without them, the grammar was ambiguous, > so some way of disambiguating was needed. The out-of-order evaluation is a very large change, because now we have a situation where normal parsi

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] "as" mania

2006-03-07 Thread Guido van Rossum
I suggest you file those as products of an overactive imagination. :-) Have you even tried to define precise semantics for any of those, like the expansion of "with E as V: B" in PEP 343? --Guido On 3/7/06, Georg Brandl <[EMAIL PROTECTED]> wrote: > Hi, > > while "as" is being made a keyword, I r

[Python-Dev] "as" mania

2006-03-07 Thread Georg Brandl
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 elif expr as f: do something else with f What do you think

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

2006-03-07 Thread Nick Coghlan
Paul Moore wrote: > On 3/7/06, Jeremy Hylton <[EMAIL PROTECTED]> wrote: >> On 3/6/06, Alex Martelli <[EMAIL PROTECTED]> wrote: >>> 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 jus

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

2006-03-07 Thread Paul Moore
On 3/7/06, Jeremy Hylton <[EMAIL PROTECTED]> wrote: > On 3/6/06, Alex Martelli <[EMAIL PROTECTED]> wrote: > > > > 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 (sin

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

2006-03-07 Thread Jeremy Hylton
On 3/6/06, Alex Martelli <[EMAIL PROTECTED]> wrote: > > 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

Re: [Python-Dev] how about adding ping's uuid module to the standard lib ?

2006-03-07 Thread Martin v. Löwis
Fredrik Lundh wrote: > see subject and http://python.org/sf/1368955 > > comments ? Fine with me. Martin ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/op

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

2006-03-07 Thread Steve Holden
Joe Smith wrote: > "Steve Holden" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>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_imp