On 11/14/06, George Sakkis <[EMAIL PROTECTED]> wrote:
> When I talk about or
> introduce Python to outsiders, one of the toughest questions is often
> something along the lines of "why len() is a function and not a
> method?"
I came to Python from Java and originally thought this. The answer I
rec
Greg Ewing wrote:
> If there were a substantial number of commonly
> used operations on them that could be implemented
> efficiently in a generic way, then we probably
> would have listtools and dicttools modules
> (or more properly sequencetools and mappingtools).
> That doesn't seem to have happ
On 11/14/06, Greg Ewing <[EMAIL PROTECTED]> wrote:
> George Sakkis wrote:
>
> > I think I do, though I can't tell the same about the reasons of your
> > objections to it.
>
> Perhaps I can fill in some of the things that Guido
> is not explicitly saying.
Indeed, another high quality reply. Thanks
On 11/14/06, Bill Janssen <[EMAIL PROTECTED]> wrote:
> Greg Ewing wrote:
> > Bill Janssen wrote:
> >
> > > Duck typing is a seriously bad idea, forced on Python by the now
> > > obsolete split between built-in types and user-defined types.
> >
> > Non-duck typing is a seriously bad idea, forced
> >
Greg Ewing wrote:
> Bill Janssen wrote:
>
> > Duck typing is a seriously bad idea, forced on Python by the now
> > obsolete split between built-in types and user-defined types.
>
> Non-duck typing is a seriously bad idea, forced
> on some other languages by static typing. Python
> is mercifully f
> The real
> problem is that iterator is an interface, and there's no formal way to
> express interfaces in Python; it's all in the documentation.
> ...
> The problem with .__getitem__ is, you can't tell whether an object is
> a sequence or a mapping. If it has .__getitem__, it's one or the
> othe
George Sakkis wrote:
> I understand you are exaggerating (can't believe you are seriously
> claiming that cmath or traceback are more frequently used than
> itertools)
I don't think he's exaggerating much -- I'm sure
many of those modules are used a lot more than
itertools. I don't know about gen
BJörn Lindqvist wrote:
> But why is both the dict and list protocol so fat then?
Because there are a variety of things you need to
be able to do to sequences and mappings, and the
implementations of them are closely tied to the
internals of the type concerned.
If there were a substantial number
George Sakkis wrote:
> Short answer: it doesn't. Only if you actually use the new API it matters,
> e.g.
>
> for var in Iter(it1) + Iter(it2):
Which doesn't look any more readable to me than
for var in chain(it1, it2):
In fact, it looks considerably *less* readable.
--
Greg
__
George Sakkis wrote:
> Seems like a classic case for OOP to me: combine state (iterables)
> with behavior (iter) in handly little packets (objects).
Except that it's not really behaviour. Chaining, e.g., is
something you do *to* iterators, not something that the
iterators themselves do.
--
Greg
George Sakkis wrote:
> I think I do, though I can't tell the same about the reasons of your
> objections to it.
Perhaps I can fill in some of the things that Guido
is not explicitly saying.
You've shown that it *can* be done, but you haven't
provided a compelling reason why it *should* be done.
Bill Janssen wrote:
> Duck typing is a seriously bad idea, forced on Python by the now
> obsolete split between built-in types and user-defined types.
Non-duck typing is a seriously bad idea, forced
on some other languages by static typing. Python
is mercifully free of such constraints.
--
Greg
On 11/14/06, Mike Klaas <[EMAIL PROTECTED]> wrote:
> On 11/14/06, George Sakkis <[EMAIL PROTECTED]> wrote:
> > On 11/14/06, Mike Klaas <[EMAIL PROTECTED]> wrote:
>
> > > I don't see the problem of importing important language functionality.
> > > Most languages since c have required somthing simi
On 11/14/06, George Sakkis <[EMAIL PROTECTED]> wrote:
> On 11/14/06, Mike Klaas <[EMAIL PROTECTED]> wrote:
> > I don't see the problem of importing important language functionality.
> > Most languages since c have required somthing similar.
>
> Most languages since C are not as readable and elega
On 11/14/06, Mike Klaas <[EMAIL PROTECTED]> wrote:
> On 11/14/06, George Sakkis <[EMAIL PROTECTED]> wrote:
>
> > And for those objecting to touching the existing iter() or bloating
> > the builtin namespace with yet another builtin, let me mention that we
> > can get rid of *two* existing function
On 11/14/06, Andrew Koenig <[EMAIL PROTECTED]> wrote:
> > Duck typing is a seriously bad idea
>
> Why?
And more importantly, are we all talking about the same thing when we
say "duck typing"? Duck typing as I know it means accepting an
argument that exhibits certain behaviors rather than being a
On 11/14/06, George Sakkis <[EMAIL PROTECTED]> wrote:
> And for those objecting to touching the existing iter() or bloating
> the builtin namespace with yet another builtin, let me mention that we
> can get rid of *two* existing functions which for some reason were
> promoted to builtin status, al
On 11/14/06, Nick Coghlan <[EMAIL PROTECTED]> wrote:
> Having a rich method API vs having a narrow method API and duck-typed support
> functions is a design trade-off. In the case of sequences and mappings, the
> trade-off went towards a richer API because the de facto reference
> implementations w
We can all save a lot of time by not continuing this conversation.
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
___
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
htt
On 11/14/06, George Sakkis <[EMAIL PROTECTED]> wrote:
> On 11/14/06, Jim Jewett <[EMAIL PROTECTED]> wrote:
> > (3) IterMixin would be the only mixin exposed as a builtin -- the
> > other mixins must be imported. The builtin type factories are
> > typically the stripped down versions.
>
> That p
On 11/14/06, Fred L. Drake, Jr. <[EMAIL PROTECTED]> wrote:
> On Tuesday 14 November 2006 13:06, George Sakkis wrote:
> > I understand you are exaggerating (can't believe you are seriously
> > claiming that cmath or traceback are more frequently used than
> > itertools),
>
> I certainly use trace
On Tuesday 14 November 2006 13:06, George Sakkis wrote:
> I understand you are exaggerating (can't believe you are seriously
> claiming that cmath or traceback are more frequently used than
> itertools),
I certainly use traceback far more than itertools. I use traceback
occaissionally, but I
On 11/14/06, Jim Jewett <[EMAIL PROTECTED]> wrote:
> Yes, and at first glance, an IterMixin would be nice. But only at first
> glance.
>
> (1) Things that are already iterators won't implement the entire
> newly expanded iteration API. I don't want people to start
> mechanically replacing
>
>
On 11/14/06, Fredrik Lundh wrote:
> Uhuh. And why would this more important than adding, say, Array,
> AtExit, Bz2, Cgi, CgiTB, Cmath, Code, Codecs, Collections, Copy, Csv,
> DateTime, Decimal, ElementTree, ErrNo, Ftplib, Gc, GetOpt, GetText,
> Glob, Gzip, HashLib, HMac, Inspect, Locale, Logging
On 11/14/06, George Sakkis <[EMAIL PROTECTED]> wrote:
> This is the python-3000 list; I don't aim at Python 2.x. Given that I
> propose to *replace* itertools, not add an extra builtin (having them
> both would be redundant and violates the one obvious way to do it
> principle), it wouldn't be bac
On 11/14/06, Josiah Carlson <[EMAIL PROTECTED]> wrote:
>
> "George Sakkis" <[EMAIL PROTECTED]> wrote:
> >
> > On 11/14/06, Nick Coghlan <[EMAIL PROTECTED]> wrote:
> >
> > > George Sakkis wrote:
> > > > On 11/14/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> > > >
> > > >> BJ?rn Lindqvist wrote:
> >
On 11/14/06, Nick Coghlan <[EMAIL PROTECTED]> wrote:
> George Sakkis wrote:
> > Understood. Any _technical_ reasons then why shouldn't all iterators
> > inherit from it, or "duck typing is The Right Way" should be taken as
> > an axiom ? Why do we somehow _need_ itertools when we don't need
> > se
On 11/14/06, George Sakkis <[EMAIL PROTECTED]> wrote:
> Given the overly negative reaction to a base iterator type, I withdraw
> the part of my proposal that suggests this type as the base of all
> iterators. Instead I propose a builtin Iter (or even better iter, if
> there is no objection to chang
"George Sakkis" <[EMAIL PROTECTED]> wrote:
>
> On 11/14/06, Nick Coghlan <[EMAIL PROTECTED]> wrote:
>
> > George Sakkis wrote:
> > > On 11/14/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> > >
> > >> BJ?rn Lindqvist wrote:
> > >>
> > >>> But why is both the dict and list protocol so fat then? Is
George Sakkis wrote:
> Given the overly negative reaction to a base iterator type, I withdraw
> the part of my proposal that suggests this type as the base of all
> iterators. Instead I propose a builtin Iter (or even better iter, if
> there is no objection to change iter's current behavior) as an
George Sakkis wrote:
> On 11/14/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
>
>> BJ?rn Lindqvist wrote:
>>
>>> But why is both the dict and list protocol so fat then? Is it hard to
>>> create your own dict or list-derived types in Python?
>> don't confuse things like lists and dictionaries with t
On 11/14/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> BJ?rn Lindqvist wrote:
>
> > But why is both the dict and list protocol so fat then? Is it hard to
> > create your own dict or list-derived types in Python?
>
> don't confuse things like lists and dictionaries with things like
> sequences and
On 11/14/06, Aahz <[EMAIL PROTECTED]> wrote:
> [off-list to avoid more CLUTTER]
Sorry, I don't consider a well-intentioned discussion to understand
how things work at the design level of python CLUTTER.
> On Mon, Nov 13, 2006, George Sakkis wrote:
> >
> > Excuse my ignorance, but what's a "self-
Jean-Paul Calderone wrote:
> Anyway, the proposal was in no way suggesting moving away from duck
> typing. The new iter was to be a _wrapper_ around any existing
> iterator, not a base class for iterators.
the OP seems to think otherwise:
The key points are:
/.../
3. Make this t
George Sakkis wrote:
>> don't confuse things like lists and dictionaries with things like
>> sequences and mappings. iterators and iterables belong to the second
>> category.
>
> This doesn't answer my last question: why do we need itertools when we
> can live without sequencetools, mappingtools,
George Sakkis wrote:
> Understood. Any _technical_ reasons then why shouldn't all iterators
> inherit from it, or "duck typing is The Right Way" should be taken as
> an axiom ? Why do we somehow _need_ itertools when we don't need
> sequencetools, mappingtools, etc ? What's so special about the
> i
> Duck typing is a seriously bad idea
Why?
___
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
On 11/14/06, Nick Coghlan <[EMAIL PROTECTED]> wrote:
> George Sakkis wrote:
> > On 11/14/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> >
> >> BJ?rn Lindqvist wrote:
> >>
> >>> But why is both the dict and list protocol so fat then? Is it hard to
> >>> create your own dict or list-derived types in
BJörn Lindqvist wrote:
> But why is both the dict and list protocol so fat then? Is it hard to
> create your own dict or list-derived types in Python?
don't confuse things like lists and dictionaries with things like
sequences and mappings. iterators and iterables belong to the second
category
On 11/14/06, Ronald Oussoren <[EMAIL PROTECTED]> wrote:
> On 14 Nov 2006, at 4:26 AM, George Sakkis wrote:
> > I honestly fail to understand your current objections. Is my analogy
> > with dictmixin flawed ? Would anything change if I named it
> > "itermixin" instead of iter or Iter ? I'm ok with
On 11/13/06, Guido van Rossum <[EMAIL PROTECTED]> wrote:
> On 11/13/06, George Sakkis <[EMAIL PROTECTED]> wrote:
> > On 11/13/06, Guido van Rossum <[EMAIL PROTECTED]> wrote:
> >
> > > As my final word, I think this is a seriously bad idea, and as you're
> > > not answering my challenge about duck
"George Sakkis" <[EMAIL PROTECTED]> wrote:
> The original motivation is to provide syntax sugar (+, *, indexing,
> slicing) to iterators, which you can't do with functions. The rest
> methods that would be spelled out with their current itertools names
> is a fortunate side-effect, not the primary
42 matches
Mail list logo