Re: [Python-3000] Adaptation [was:Re: Iterators for dict keys, values, and items == annoying :)]

2006-04-02 Thread Paul Moore
On 4/2/06, Brett Cannon <[EMAIL PROTECTED]> wrote: > I am not suggesting the default be that everything satisfies a > protocol. I am thinking about situations like our __index__ > situation; will someone have to explicitly somewhere say that a type > meets the index protocol even if it does implem

Re: [Python-3000] Adaptation [was:Re: Iterators for dict keys, values, and items == annoying :)]

2006-04-02 Thread Paul Moore
On 4/2/06, Nick Coghlan <[EMAIL PROTECTED]> wrote: > This is where I've always come unstuck in thinking about adaptation - actually > using C++ and VB6 has persuaded me that implicit type conversions are > generally evil, and there doesn't seem to be anything in adaptation that makes > it the excep

Re: [Python-3000] Adaptation [was:Re: Iterators for dict keys, values, and items == annoying :)]

2006-04-02 Thread Alex Martelli
On Apr 2, 2006, at 7:11 AM, Paul Moore wrote: ... > On the face of it, there's nothing implicit going on. There has to be > an explicit adaptation call. However, I agree that systems that make > extensive use of adaptation can seem to end up in a situation where > data seems to magically appea

Re: [Python-3000] It's a statement! It's a function! It's BOTH!

2006-04-02 Thread Guido van Rossum
On 4/1/06, Talin <[EMAIL PROTECTED]> wrote: > This is about the print / writeln debate. No, it isn't. :-) Let me focus on the part that you skirt, to explain that that's what makes anything like this pretty much impossible. > We would start by defining a simple metalanguage for giving instructio

[Python-3000] String formating operations in python 3k

2006-04-02 Thread Crutcher Dunnavant
Python currently supports 'S % X', where S is a strinng, and X is one of: * a sequence * a map * treated as (X,) But I have some questions about this for python 3000. 1. Shouldn't there be a format method, like S.format(), or S.fmt()? 2. What about using __call__ instead of / in addition to __r

Re: [Python-3000] String formating operations in python 3k

2006-04-02 Thread Georg Brandl
Crutcher Dunnavant wrote: > Python currently supports 'S % X', where S is a strinng, and X is one of: > * a sequence > * a map > * treated as (X,) > > But I have some questions about this for python 3000. > > 1. Shouldn't there be a format method, like S.format(), or S.fmt()? Possible, but why?

Re: [Python-3000] It's a statement! It's a function! It's BOTH!

2006-04-02 Thread Talin
Guido van Rossum python.org> writes: > Based on my experience with past wild proposals, you're probably going > to counter by proposing that the Python interpreter somehow follows > imports at compile time; I could then object that it's totally > reasonable that the module to be imported is unava

[Python-3000] A few small py3k wishes

2006-04-02 Thread Talin
Just a few things that have wanted while doing python programming. Maybe some of these are already doable or are already on someone's wish list... -- The __main__ module should contain a file path like imported modules. in other words, every module should know where it came from. In fact, I see no

[Python-3000] pre-PEP: Things that Will Not Change in Python 3.0

2006-04-02 Thread Georg Brandl
Guido van Rossum wrote: > On 4/2/06, Georg Brandl <[EMAIL PROTECTED]> wrote: >> A quick idea of mine: Wouldn't it be useful to maintain a list of what will >> not change, collected in the discussions here? That way, people eager to >> suggest >> braces and whatnot can be referred to it. >> >> (I'd

Re: [Python-3000] A few small py3k wishes

2006-04-02 Thread Tim Hochberg
Talin wrote: > Just a few things that have wanted while doing python > programming. Maybe some of these are already doable > or are already on someone's wish list... Some of these are already pretty easy to do. Perhaps you should explain what's inadequate about the current solutions. For example:

Re: [Python-3000] Iterating over a dict

2006-04-02 Thread Brett Cannon
On 4/2/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 4/2/06, Georg Brandl <[EMAIL PROTECTED]> wrote: > > A quick idea of mine: Wouldn't it be useful to maintain a list of what will > > not change, collected in the discussions here? That way, people eager to > > suggest > > braces and whatno

Re: [Python-3000] A few small py3k wishes

2006-04-02 Thread Michael P. Soulier
On 02/04/06 Talin said: > Just a few things that have wanted while doing python > programming. Maybe some of these are already doable > or are already on someone's wish list... It's a minor thing, but it'd be nice to make a method alias for append() on mutable sequences called push(), to go with

Re: [Python-3000] String formating operations in python 3k

2006-04-02 Thread Nick Coghlan
Georg Brandl wrote: > Crutcher Dunnavant wrote: >> Python currently supports 'S % X', where S is a strinng, and X is one of: >> * a sequence >> * a map >> * treated as (X,) >> >> But I have some questions about this for python 3000. >> >> 1. Shouldn't there be a format method, like S.format(), or

Re: [Python-3000] A few small py3k wishes

2006-04-02 Thread Talin
Alex Martelli gmail.com> writes: > for k, v in sorted(d.iteritems()): Ah, thanks! I didn't know that worked. (The missing piece was that I wasn't aware that relative comparisons worked on tuples. I even looked in the library reference manual under "sequence types") > A module can be imported se

Re: [Python-3000] A few small py3k wishes

2006-04-02 Thread Talin
Thomas Wouters python.org> writes: > I'm not sure what you're missing. The __main__ module has __file__: > centurion:~ > cat tmp.py > print "__file__:", __file__ > import __main__ > print "__main__.__file__:", __main__.__file__ > > centurion:~ > python tmp.py > __file__: tmp.py > __main__.__fi

Re: [Python-3000] Adaptation [was:Re: Iterators for dict keys, values, and items == annoying :)]

2006-04-02 Thread Walter Dörwald
Alex Martelli wrote: > On Apr 2, 2006, at 7:11 AM, Paul Moore wrote: > ... > [...] > > Say, for example, that protocols are identified (as in my strawman > proposal) by unique strings anyway. E.g., if I were to invent a > protocol, I could name it 'it.aleax.myprot' -- since I own the >

Re: [Python-3000] Iterating over a dict

2006-04-02 Thread Thomas Lotze
Am Sun, 02 Apr 2006 09:29:13 -0700 schrieb Guido van Rossum: > Just to confirm what's already been said, this was considered very > carefully and won't change. OK, thanks. -- Thomas ___ Python-3000 mailing list [email protected] http://mail.pyth

Re: [Python-3000] String formating operations in python 3k

2006-04-02 Thread Crutcher Dunnavant
On 4/2/06, Georg Brandl <[EMAIL PROTECTED]> wrote: > Crutcher Dunnavant wrote: > > Python currently supports 'S % X', where S is a strinng, and X is one of: > > * a sequence > > * a map > > * treated as (X,) > > > > But I have some questions about this for python 3000. > > > > 1. Shouldn't there b

Re: [Python-3000] A few small py3k wishes

2006-04-02 Thread Thomas Wouters
On 4/3/06, Talin <[EMAIL PROTECTED]> wrote: Thomas Wouters python.org> writes:> I'm not sure what you're missing. The __main__ module has __file__:Except that they are not the same! When I print __file__ from my __main__ module, I get the name of thefile only, no path.You get the path that was use

Re: [Python-3000] Iterating over a dict

2006-04-02 Thread Guido van Rossum
On 4/2/06, Georg Brandl <[EMAIL PROTECTED]> wrote: > A quick idea of mine: Wouldn't it be useful to maintain a list of what will > not change, collected in the discussions here? That way, people eager to > suggest > braces and whatnot can be referred to it. > > (I'd be volunteering to maintain suc

Re: [Python-3000] pre-PEP: Things that Will Not Change in Python 3.0

2006-04-02 Thread Greg Ewing
Georg Brandl wrote: > PEP: XXX > Title: Things that will Not Change in Python 3000 > > ... > > Copyright > = I was expecting to see something like "The Python licence will not change" under this heading. :-) -- Greg ___ Python-3000 mailing li

Re: [Python-3000] Adaptation [was:Re: Iterators for dict keys, values, and items == annoying :)]

2006-04-02 Thread Alex Martelli
On Apr 2, 2006, at 4:39 PM, Walter Dörwald wrote: ... > Why not make the registry identical to the protocol? The protocol > is just a convention anyway: Yes, a 1<->1 relationship between registries and protocols makes the 'registryof' function I was talking about simpler, at least when it

Re: [Python-3000] String formating operations in python 3k

2006-04-02 Thread Barry Warsaw
On Sun, 2006-04-02 at 22:27 +0200, Georg Brandl wrote: > BTW, has anyone seen string.Template being used somewhere? I use it, which shouldn't be a big suprise (though not in much public code). You'll probably see it get used quite a bit in a future Mailman release. -Barry signature.asc Descr

Re: [Python-3000] String formating operations in python 3k

2006-04-02 Thread Adam DePrince
On Sun, 2006-04-02 at 22:27 +0200, Georg Brandl wrote: > Crutcher Dunnavant wrote: > > Python currently supports 'S % X', where S is a strinng, and X is one of: > > * a sequence > > * a map > > * treated as (X,) > > > > But I have some questions about this for python 3000. > > > > 1. Shouldn't t

Re: [Python-3000] Adaptation: T->P vs P->P

2006-04-02 Thread Tim Hochberg
In this thread, Alex has been advocating adaption where types are adapted to protocols: T->P adaption for short. By contrast, my two sample implementations have involved Protocol->Protocol adaption where objects that implement a certain protocol are adapted to another protocol: P->P adaption f

Re: [Python-3000] String formating operations in python 3k

2006-04-02 Thread Barry Warsaw
On Mon, 2006-04-03 at 00:44 +0200, Giovanni Bajo wrote: > Not me. Surely it'd help if its documentation explained why on earth it has > been introduced. There are no apparent advantages over the builtin %s > operator, > at first sight. Nothing worth using a non-standard non-builtin substitution >

Re: [Python-3000] A few small py3k wishes

2006-04-02 Thread Adam DePrince
On Sun, 2006-04-02 at 21:39 +, Talin wrote: > Just a few things that have wanted while doing python > programming. Maybe some of these are already doable > or are already on someone's wish list... > > -- The __main__ module should contain a file path like imported > modules. in other words, ev

Re: [Python-3000] A few small py3k wishes

2006-04-02 Thread Talin
Adam DePrince gmail.com> writes: > One of my more recent abominations, my views PEP, would have addressed > this nicely. And so would ... > > class caselessdict( dict ): Interesting approach. I'm not sure I like storing two copies of every key thought. > sorted( dict.items() ) As I mentio

Re: [Python-3000] A few small py3k wishes

2006-04-02 Thread Greg Ewing
Michael P. Soulier wrote: > It's a minor thing, but it'd be nice to make a method alias for append() on > mutable sequences called push(), to go with pop(). That depends on what value you have in mind for "nice". There would then be two methods which do exactly the same thing, and everyone would

Re: [Python-3000] A few small py3k wishes

2006-04-02 Thread Greg Ewing
Talin wrote: > -- A mechanism whereby imported modules can import > symbols from the module that imported them. (Specifically, > I want to take a bunch of variables in my __main__ module > and make them accessible to the imported module.) In my_imported_module.py: import __main__ def my_s

Re: [Python-3000] A few small py3k wishes

2006-04-02 Thread Terry Reedy
"Michael P. Soulier" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >It's a minor thing, but it'd be nice to make a method alias for append() >on >mutable sequences called push(), to go with pop(). Bound methods to your rescue: _stack = [] push = _stack.append pop = _stack.pop N

Re: [Python-3000] String formating operations in python 3k

2006-04-02 Thread Walter Dörwald
Crutcher Dunnavant wrote: > On 4/2/06, Georg Brandl <[EMAIL PROTECTED]> wrote: >> Crutcher Dunnavant wrote: >>> Python currently supports 'S % X', where S is a strinng, and X is one of: >>> * a sequence >>> * a map >>> * treated as (X,) >>> >>> But I have some questions about this for python 3000

Re: [Python-3000] Adaptation [was:Re: Iterators for dict keys, values, and items == annoying :)]

2006-04-02 Thread Paul Moore
On 4/2/06, Alex Martelli <[EMAIL PROTECTED]> wrote: > I believe that such "magically appearing" does not depend on > adaptation, per se, but on the mix of "convenience" approaches to > adaptation and registration that one chooses to provide alongside it. Apologies if I didn't explain myself well -