Steven D'Aprano a écrit :
> On Fri, 02 Nov 2007 03:40:59 +, Tim Roberts wrote:
>
>> Steven D'Aprano <[EMAIL PROTECTED]> wrote:
>>
>>> On Wed, 31 Oct 2007 22:48:12 -0700, Carl Banks wrote:
>>>
> I hope you're not serious that $# would make a good operator.
If you happen to know where I
Steven D'Aprano <[EMAIL PROTECTED]> writes:
> > Seriously? You didn't know that $#x in perl returns the length of the
> > array @x, minus 1?
> I don't speak Perl. You know there are million of us who have managed to
> avoid it.
I used to use perl (though I was never an expert) and I didn't know
On Fri, 02 Nov 2007 03:40:59 +, Tim Roberts wrote:
> Steven D'Aprano <[EMAIL PROTECTED]> wrote:
>
>>On Wed, 31 Oct 2007 22:48:12 -0700, Carl Banks wrote:
>>
I hope you're not serious that $# would make a good operator.
>>>
>>> If you happen to know where I borrowed it from, it would be
Steven D'Aprano <[EMAIL PROTECTED]> wrote:
>On Wed, 31 Oct 2007 22:48:12 -0700, Carl Banks wrote:
>
>>> I hope you're not serious that $# would make a good operator.
>>
>> If you happen to know where I borrowed it from, it would be pretty
>> evident that I wasn't being serious.
>
>Ooh, now I'm cu
Steven D'Aprano wrote:
> On Wed, 31 Oct 2007 22:48:12 -0700, Carl Banks wrote:
>
>
>>> I hope you're not serious that $# would make a good operator.
>>>
>> If you happen to know where I borrowed it from, it would be pretty
>> evident that I wasn't being serious.
>>
>
> Ooh, now I'm c
On Wed, 31 Oct 2007 22:48:12 -0700, Carl Banks wrote:
>> I hope you're not serious that $# would make a good operator.
>
> If you happen to know where I borrowed it from, it would be pretty
> evident that I wasn't being serious.
Ooh, now I'm curious.
--
Steven.
--
http://mail.python.org/mail
On Oct 30, 1:30 am, George Sakkis <[EMAIL PROTECTED]> wrote:
> Having a builtin len() that calls the method __len__
> seems (using your words) "not only foolish but wasteful".
But what about (for instance) having the bitwise not operator (^)
calling __bitwise_not__. Is that foolish and wasteful?
On Oct 31, 6:29 pm, Steven D'Aprano <[EMAIL PROTECTED]
cybersource.com.au> wrote:
> On Wed, 31 Oct 2007 07:59:58 -0700, Carl Banks wrote:
> > Python considers len to be an operator for all intents and purposes.
> > Python chose to spell this operator like a regular function, but it
> > could easily
On Oct 31, 2007 6:02 PM, George Sakkis <[EMAIL PROTECTED]> wrote:
> On Oct 31, 6:13 pm, Steven D'Aprano
>
> > What you have measured is a local optimization that is only useful when
> > you have a tight loop with lots of calls to the same len():
> >
> > Len = sequence.__len__
> > while Len() < 1000
On Oct 31, 6:13 pm, Steven D'Aprano
> What you have measured is a local optimization that is only useful when
> you have a tight loop with lots of calls to the same len():
>
> Len = sequence.__len__
> while Len() < 10:
> foo(sequence)
Exactly what timeit() does, a tight loop.
> But what
On Wed, 31 Oct 2007 07:59:58 -0700, Carl Banks wrote:
> Python considers len to be an operator for all intents and purposes.
> Python chose to spell this operator like a regular function, but it
> could easily have given a special syntax to the length operation (for
> instance, $#x).
I hope you'r
On Wed, 31 Oct 2007 13:14:41 +, George Sakkis wrote:
> On Oct 31, 8:44 am, Neil Cerutti <[EMAIL PROTECTED]> wrote:
>> On 2007-10-30, George Sakkis <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>> > On Oct 30, 11:25 am, Neil Cerutti <[EMAIL PROTECTED]> wrote:
>> >> On 2007-10-30, Eduardo O. Padoan <[EMAI
On Wed, 31 Oct 2007 14:45:59 +, Duncan Booth wrote:
>> Thanks for the interesting note. I didn't know that tuples originally
>> had no methods. That made len mandatory, I suppose.
>>
> Only if you think tuples are a sequence rather than a record.
Even records have a length. The length of a r
On Oct 31, 8:44 am, Neil Cerutti <[EMAIL PROTECTED]> wrote:
> On 2007-10-30, George Sakkis <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Oct 30, 11:25 am, Neil Cerutti <[EMAIL PROTECTED]> wrote:
> >> On 2007-10-30, Eduardo O. Padoan <[EMAIL PROTECTED]> wrote:
>
> >> > This is a FAQ:
> >> >http://effbot.o
Neil Cerutti <[EMAIL PROTECTED]> wrote:
> On 2007-10-31, Duncan Booth <[EMAIL PROTECTED]> wrote:
>> Obviously it isn't an absolute thing: lists and dictionaries do
>> have other methods in the user namespace, so the decision to
>> keep len out of that namespace is partly a judgement call, and
>> p
On 2007-10-31, Duncan Booth <[EMAIL PROTECTED]> wrote:
> Obviously it isn't an absolute thing: lists and dictionaries do
> have other methods in the user namespace, so the decision to
> keep len out of that namespace is partly a judgement call, and
> partly historical (I think tuples didn't used to
Neil Cerutti <[EMAIL PROTECTED]> wrote:
> But if I'm wrong about the performance benefits then I guess I'm
> still in the dark about why len is a builtin. The only compelling
> thing in the linked explation was the signatures of the guys who
> wrote the artible. (Guido does admit he would, "hate t
On 2007-10-31, George Sakkis <[EMAIL PROTECTED]> wrote:
> On Oct 31, 8:44 am, Neil Cerutti <[EMAIL PROTECTED]> wrote:
>> On 2007-10-30, George Sakkis <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>> > On Oct 30, 11:25 am, Neil Cerutti <[EMAIL PROTECTED]> wrote:
>> >> On 2007-10-30, Eduardo O. Padoan <[EMAIL
On Oct 31, 8:44 am, Neil Cerutti <[EMAIL PROTECTED]> wrote:
> On 2007-10-30, George Sakkis <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Oct 30, 11:25 am, Neil Cerutti <[EMAIL PROTECTED]> wrote:
> >> On 2007-10-30, Eduardo O. Padoan <[EMAIL PROTECTED]> wrote:
>
> >> > This is a FAQ:
> >> >http://effbot.o
On 2007-10-30, George Sakkis <[EMAIL PROTECTED]> wrote:
> On Oct 30, 11:25 am, Neil Cerutti <[EMAIL PROTECTED]> wrote:
>> On 2007-10-30, Eduardo O. Padoan <[EMAIL PROTECTED]> wrote:
>>
>> > This is a FAQ:
>> >http://effbot.org/pyfaq/why-does-python-use-methods-for-some-function...
>>
>> Holy Airy P
On 2007-10-30, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
> On Tue, 30 Oct 2007 15:25:54 GMT, Neil Cerutti <[EMAIL PROTECTED]> wrote:
>>On 2007-10-30, Eduardo O. Padoan <[EMAIL PROTECTED]> wrote:
>>> This is a FAQ:
>>> http://effbot.org/pyfaq/why-does-python-use-methods-for-some-functionality-e
On 30 Okt, 15:09, Steven D'Aprano <[EMAIL PROTECTED]
cybersource.com.au> wrote:
>
[Language "OOness", hand-waving]
> I disagree. I think they *do* take away from the overall Object-Oriented
> nature of the language, and that is A Very Good Thing Indeed.
But everything is an object in Python: not
On Oct 30, 11:25 am, Neil Cerutti <[EMAIL PROTECTED]> wrote:
> On 2007-10-30, Eduardo O. Padoan <[EMAIL PROTECTED]> wrote:
>
> > This is a FAQ:
> >http://effbot.org/pyfaq/why-does-python-use-methods-for-some-function...
>
> Holy Airy Persiflage Batman!
>
> Python 2.5.1 (r251:54863, Apr 18 2007, 08:
On Tue, 30 Oct 2007 15:25:54 GMT, Neil Cerutti <[EMAIL PROTECTED]> wrote:
>On 2007-10-30, Eduardo O. Padoan <[EMAIL PROTECTED]> wrote:
>> This is a FAQ:
>> http://effbot.org/pyfaq/why-does-python-use-methods-for-some-functionality-e-g-list-index-but-functions-for-other-e-g-len-list.htm
>
>Holy Airy
On 2007-10-30, Eduardo O. Padoan <[EMAIL PROTECTED]> wrote:
> This is a FAQ:
> http://effbot.org/pyfaq/why-does-python-use-methods-for-some-functionality-e-g-list-index-but-functions-for-other-e-g-len-list.htm
Holy Airy Persiflage Batman!
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.13
On Tue, 30 Oct 2007 00:11:58 +, Marc 'BlackJack' Rintsch wrote:
>>> And to answer the question. In OO programming generic functions are no
>>> less important than classes and objects.
>>
>> Do they not take away from the OOness of the overall language and
>> introduce inconsistencies?
>
> No
Eduardo O. Padoan wrote:
> This is a FAQ:
> http://effbot.org/pyfaq/why-does-python-use-methods-for-some-functionality-e-g-list-index-but-functions-for-other-e-g-len-list.htm
Thanks to all for the feedback. I'm no language designer. I just see and
hear these criticisms and I wanted to think thro
On Oct 29, 7:59 pm, Wildemar Wildenburger
<[EMAIL PROTECTED]> wrote:
> Bjoern Schliessmann wrote:
> > The inconsistencies arise, IMHO, if an OO language introduces
> > non-object types for performance reasons, after that gets wrapper
> > classes to wrap those primitives, and even later gets the abi
On 10/29/07, brad <[EMAIL PROTECTED]> wrote:
> Will len(a_string) become a_string.len()? I was just reading
>
> http://docs.python.org/dev/3.0/whatsnew/3.0.html
>
> One of the criticisms of Python compared to other OO languages is that
> it isn't OO enough or as OO as others or that it is inconsist
brad a écrit :
> Rob Wolfe wrote:
>
>> I wonder why people always complain about `len` function but never
>> about `iter` or `pprint.pprint`? :)
>
> Not complaining. len is simple and understandable and IMO fits nicely
> with split(), strip(), etc... that's why I used it as an example, but
> li
brad a écrit :
> Will len(a_string) become a_string.len()? I was just reading
>
> http://docs.python.org/dev/3.0/whatsnew/3.0.html
>
> One of the criticisms of Python compared to other OO languages is that
> it isn't OO enough
Really ? IIRC, Python doesn't have primitive types, functions are
o
Bjoern Schliessmann:
> Is there any particular reason why it should be a method?
>
> [..]
>
> To make a long story short: Most methods do specific things with
> objects; but len is a common function to get a simple property of
> an object.
You said it. IMHO it really could be a *property*, say `
On Mon, 29 Oct 2007 19:50:14 -0700, George Sakkis wrote:
> On Oct 29, 5:49 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
>
>> | why not a_string.len()?
>>
>> You are free to bypass builtins and call methods directly if you like:
>> a_string.__len__().
>>
>> But consider rewriting the following:
>>
On Oct 29, 9:35 pm, Michael L Torrie <[EMAIL PROTECTED]> wrote:
> brad wrote:
> > Not complaining. len is simple and understandable and IMO fits nicely
> > with split(), strip(), etc... that's why I used it as an example, but
> > list(), etc. could be used as examples as well:
>
> > a_string.list()
On Oct 29, 5:49 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
> I was just reading
> |http://docs.python.org/dev/3.0/whatsnew/3.0.html
>
> which says nothing about such a change, except for one in the opposite
> direction: o.next() changes to next(o) which in turn calls o.__next__(),
> just as len
brad wrote:
> Not complaining. len is simple and understandable and IMO fits nicely
> with split(), strip(), etc... that's why I used it as an example, but
> list(), etc. could be used as examples as well:
>
> a_string.list() instead of list(a_string)
This is a great example of why list() needs
Bjoern Schliessmann wrote:
> The inconsistencies arise, IMHO, if an OO language introduces
> non-object types for performance reasons, after that gets wrapper
> classes to wrap those primitives, and even later gets the ability
> to automatically cast a primitive into a wrapper class instance.
> Tha
On Mon, 29 Oct 2007 17:26:06 -0400, brad wrote:
> Rob Wolfe wrote:
>
>> I wonder why people always complain about `len` function but never
>> about `iter` or `pprint.pprint`? :)
>
> Not complaining. len is simple and understandable and IMO fits nicely
> with split(), strip(), etc... that's why
On Oct 29, 4:25 pm, brad <[EMAIL PROTECTED]> wrote:
> One of the criticisms of Python compared to other OO languages is that
> it isn't OO enough or as OO as others or that it is inconsistent.
Python is less thoroughly OO than some other languages, yes. The
underlying assumption, that being thoro
brad wrote:
> a_string.list() instead of list(a_string)
A string can be stripped, "lowercased" or split, but why should it
be able to be "listed"? IMHO, list is a conversion function to make
a list from something.
>> And to answer the question. In OO programming generic functions
>> are no less
brad wrote:
> One of the criticisms of Python compared to other OO languages is
> that it isn't OO enough or as OO as others or that it is
> inconsistent.
If OO meant "everything must be a method" then yes, Python wasn't
OO.
> And little things such as this seem to support those
> arguments. No
"brad" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| Will len(a_string) become a_string.len()?
No.
I was just reading
| http://docs.python.org/dev/3.0/whatsnew/3.0.html
which says nothing about such a change, except for one in the opposite
direction: o.next() changes to next(
Rob Wolfe wrote:
> I wonder why people always complain about `len` function but never
> about `iter` or `pprint.pprint`? :)
Not complaining. len is simple and understandable and IMO fits nicely
with split(), strip(), etc... that's why I used it as an example, but
list(), etc. could be used as e
brad <[EMAIL PROTECTED]> writes:
> Will len(a_string) become a_string.len()? I was just reading
>
> http://docs.python.org/dev/3.0/whatsnew/3.0.html
>
> One of the criticisms of Python compared to other OO languages is that
> it isn't OO enough or as OO as others or that it is inconsistent. And
>
44 matches
Mail list logo