Re: [Python-3000] callable()

2006-07-21 Thread Nick Coghlan
Greg Ewing wrote: > Guido van Rossum wrote: > >> Actually, the autowrapping was intended a backwards compatibility measure. > > But it seems like a perfectly good and useful feature > in its own right to me. Why force every sequence to > implement its own __iter__ if there is a default one > that

Re: [Python-3000] callable()

2006-07-21 Thread Walter Dörwald
Guido van Rossum wrote: > On 7/20/06, Walter Dörwald <[EMAIL PROTECTED]> wrote: >> str and unicode don't have __iter__, list, tuple and dict do: > [...] >> Should that be fixed too? > > Yes, please. (In Python 2.6 if you can.) Here's the patch: bugs.python.org/1526367 Servus, Walter ___

Re: [Python-3000] callable()

2006-07-21 Thread Thomas Wouters
On 7/21/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: I'd like to hear from others whether the default iter fallback oughtto stay or go.It should go (in py3k, obviously not in 2.6.) Maybe there should be a convenient way to spell 'iter me like a sequence', but it should definately be explicit, no

Re: [Python-3000] callable()

2006-07-21 Thread Raymond Hettinger
>> >> > We should make a conscious decision whether we should make it a >> > permanent feature or not. >> >> It sure simplified writing extensions. >> And it provided a convenient guarantee that all sequences are iterable. >> I don't see a downside to keeping it. > > > Well, it will also make mapp

Re: [Python-3000] Parameter types and multiple method dispatch

2006-07-21 Thread Giovanni Bajo
Greg Ewing wrote: >> Guido's original proposal called for __typecheck__(arg, type) to >> be called on each argument that has a type declaration, with the >> result replacing the argument value. >> >> Given this definition for the semantics, none of the issues you >> raised are relevant. > > I thin

Re: [Python-3000] callable()

2006-07-21 Thread Raymond Hettinger
>>>str and unicode don't have __iter__, list, tuple and dict do: >>> >>> >>[...] >> >> >>>Should that be fixed too? >>> >>> >>Yes, please. (In Python 2.6 if you can.) >> >> If implicit SeqIter wrapping won't potentially go away until Py3.0, why would this go into Py2.6? What

Re: [Python-3000] callable()

2006-07-21 Thread Guido van Rossum
On 7/21/06, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > Since builtin dicts and dict subclasses will already be iterable, the > mappings in question would be from user-defined classes with lookup > behavior and but not providing an iterator: > >class C: > '''This could be either a ma

Re: [Python-3000] callable()

2006-07-21 Thread Stefan Behnel
Guido van Rossum wrote: > def __iter__(self): > for i in itertools.count(): > yield self[i] Note that this likely raises IndexError, not StopIteration. Stefan ___ Python-3000 mailing list [email protected] http://mail.python.org/mailman/lis

Re: [Python-3000] callable()

2006-07-21 Thread Michael Chermside
Guido writes: > I'd like to hear from others whether the default iter fallback ought > to stay or go. Go, I think. It's not that hard to supply __iter__(), and the simplicity and explicitness feel Pythonic. -- Michael Chermside ___ Python-3000 mailing