Re: [Python-Dev] __dir__ and __all__

2007-02-04 Thread Josiah Carlson

See the two threads started in python-dev by Tomer Filiba on (according
to my clock) July 6, 2006 and October 6, 2006, both have __dir__ in the
subject.

 - Josiah

Giovanni Bajo <[EMAIL PROTECTED]> wrote:
> 
> Hello,
> 
> I could not find a PEP for __dir__. I was thinking today that if __dir__ was 
> added, I would find it useful if modules implemented it by returning __all__ 
> (when __all__ is defined). Or even better, to return the same names that 
> would 
> be imported by a star-import (so, if __all__ is not defined, all names which 
> do not start with '_').
> 
> This wouldn't prevent introspection tools to use mod.__dict__ to still access 
> the module's global dictionary, of course. But it would allow module's 
> authors 
> to more clearly document the module's public API.
> -- 
> Giovanni Bajo
> 
> ___
> Python-Dev mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
> http://mail.python.org/mailman/options/python-dev/jcarlson%40uci.edu

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Weekly Python Patch/Bug Summary

2007-02-04 Thread Kurt B. Kaiser
Patch / Bug Summary
___

Patches :  423 open ( +2) /  3553 closed ( +4) /  3976 total ( +6)
Bugs:  963 open (+20) /  6479 closed ( +8) /  7442 total (+28)
RFE :  260 open ( +0) /   250 closed ( +0) /   510 total ( +0)

New / Reopened Patches
__

ConfigParser getboolean() consistency  (2007-01-28)
   http://python.org/sf/1646432  opened by  Tal Einat

gzip.GzipFile has no name attribute  (2007-01-29)
   http://python.org/sf/1647484  opened by  Lars Gustäbel

proxy_bypass in urllib handling of  macro  (2007-01-30)
   http://python.org/sf/1648102  opened by  Anthony Tuininga

pty.fork() python implementation leaks the slave fd  (2007-01-31)
CLOSED http://python.org/sf/1648435  opened by  John Levon

Adding support for _Bool to ctypes as c_bool  (2007-01-31)
   http://python.org/sf/1649190  opened by  David Remahl

configHandler support for raw data  (2007-02-01)
   http://python.org/sf/1650174  opened by  Tal Einat

Patches Closed
__

file -> open in stdlib  (2007-01-25)
   http://python.org/sf/1644218  closed by  gbrandl

compiler.pycodegen causes crashes when compiling 'with'  (2007-01-18)
   http://python.org/sf/1638243  closed by  gbrandl

Add aliases for latin7/9/10 charsets  (2007-01-13)
   http://python.org/sf/1634778  closed by  gbrandl

pty.fork() python implementation leaks the slave fd  (2007-01-31)
   http://python.org/sf/1648435  closed by  gbrandl

New / Reopened Bugs
___

os.access now returns bool but docstring is not updated  (2007-01-27)
CLOSED http://python.org/sf/1645944  opened by  Seo Sanghyeon

Dict lookups fail if sizeof(Py_ssize_t) < sizeof(long)  (2007-01-27)
   http://python.org/sf/1646068  opened by  ked-tao

ctypes.string_at(buf, 0) is seen as zero-terminated-string  (2007-01-28)
   http://python.org/sf/1646630  opened by  Johannes Hölzl

datetime.fromtimestamp fails with negative fractional times  (2007-01-29)
   http://python.org/sf/1646728  opened by  James Henstridge

os.path, %HOME% set: realpath contradicts expanduser on '~'  (2007-01-29)
   http://python.org/sf/1646838  opened by  wrstl prmpft

cookielib.CookieJar does not handle cookies when port in url  (2007-01-29)
CLOSED http://python.org/sf/1647037  opened by  STS

zero-length match confuses re.finditer()  (2007-01-29)
   http://python.org/sf/1647489  opened by  Jacques Frechet

SystemError with re.match(array)  (2007-01-30)
   http://python.org/sf/1647541  opened by  Armin Rigo

No obvious and correct way to get the time zone offset  (2007-01-30)
   http://python.org/sf/1647654  opened by  James Henstridge

set update problem with class derived from dict  (2007-01-30)
CLOSED http://python.org/sf/1648179  opened by  duncan

Grammatical error  (2007-01-30)
CLOSED http://python.org/sf/1648191  opened by  Chris Beelby

Parameter list mismatches (portation problem)  (2007-01-30)
   http://python.org/sf/1648268  opened by  ked-tao

HP-UX: ld -Wl,+b...  (2007-01-31)
   http://python.org/sf/1648890  opened by  Johannes Abt

HP-UX: -lcurses missing for readline.so  (2007-01-31)
   http://python.org/sf/1648923  opened by  Johannes Abt

HP-UX: _ctypes/libffi/src/ia64/ffi/__attribute__/native cc  (2007-01-31)
   http://python.org/sf/1648957  opened by  Johannes Abt

HP-UX11.23: module zlib missing  (2007-01-31)
   http://python.org/sf/1648960  opened by  Johannes Abt

HP-UX: compiler warnings: alignment  (2007-01-31)
   http://python.org/sf/1649011  opened by  Johannes Abt

non-standard: array[0]  (2007-01-31)
   http://python.org/sf/1649098  opened by  Johannes Abt

Arithmetics behaving strange  (2007-01-31)
CLOSED http://python.org/sf/1649100  opened by  Sascha Peilicke

potential class with C++ in ceval.h  (2007-01-31)
   http://python.org/sf/1649238  opened by  thechao

gettext.py incompatible with eggs  (2007-01-31)
   http://python.org/sf/1649329  opened by  Shannon -jj Behrens

decimals compare badly to floats  (2007-02-01)
   http://python.org/sf/1650053  opened by  Brian Sutherland

doctest doesn't find nested functions  (2007-02-01)
   http://python.org/sf/1650090  opened by  Daniel Brown

sys.excepthook does not work with -m command line switch  (2007-02-02)
CLOSED http://python.org/sf/1650899  opened by  Miki Tebeka

PyFloat_FromString deprecated form  (2007-02-02)
   http://python.org/sf/1650903  opened by  Jim Jewett

ctypes.Structure formal parameter dies given tuple  (2007-02-03)
   http://python.org/sf/1651235  opened by  Gary Bishop

readline needs termcap on my FC6  (2007-02-03)
   http://python.org/sf/1651427  opened by  guichaz

sgmllib _convert_ref UnicodeDecodeError exception, new in 2.  (2007-02-04)
   http://python.org/sf/1651995  opened by  John Nagle

Bugs Closed
___

os.access now returns bool but docstring is not updated  (2007-01-27)
   http://python.org/sf/1645944  closed by  gbrandl

cookielib.

Re: [Python-Dev] Shortcut Notation for Chaining Method Calls

2007-02-04 Thread Raymond Hettinger
[Michael O'Keefe]
> def desired():
>pass
># IF we had a --> operator which would execute the method at 
># left but return a ref to object
>#return [8,9,7,1].sort()-->reverse()-->pop(0)--> # returns [8,7,1]
># return [8,9,7,1].sort()-->reverse()-->pop(0) # returns 9
># return [8,9,7,1].sort()-->reverse()-->pop(0) # equivalent to above

I would write these as:

>>> sorted([8,9,7,1], reverse=True)[1:]
[8, 7, 1]
>>> sorted([8,9,7,1], reverse=True)[0]
9

FWIW, I think the proposed notation is somewhat weird in that
the first example's --> chain ends with a pop but returns a list.
For successive mutations, separate lines are much more clear:
s = [8,9,7,1]
s.sort()
s.reverse()
s.pop(0)

Also, I don't think your example generalizes well.  How many classes 
have multiple methods that can meaningfully be chained together 
in an arbitrary order.  It is telling that the example chooses to call
the reverse method when it could have simple chosen the reverse=True
argument to sort().



Raymond
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com