On Nov 3, 10:26 pm, Steven D'Aprano <[EMAIL PROTECTED]
cybersource.com.au> wrote:
> On Tue, 04 Nov 2008 00:19:16 +, Marc 'BlackJack' Rintsch wrote:
> > On Mon, 03 Nov 2008 23:32:25 +, Paulo J. Matos wrote:
>
> >> What's then the reason for adding named tuples if they are not
> >> mutable...
Michele Simionato <[EMAIL PROTECTED]> wrote:
> I did not expect such a large difference in instantiation time.
> However I was thinking about
> access time, and then the difference is not impressive (~20-25%):
>
The difference in time is because when you create a normal instance Python
has to c
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes:
> On Mon, 03 Nov 2008 23:32:25 +, Paulo J. Matos wrote:
>
>> What's then the reason for adding named tuples if they are not
>> mutable...???
>
> Names are more descriptive than "magic numbers" as indices. See for
> example the "named tuple
On Nov 4, 11:20 am, [EMAIL PROTECTED] wrote:
> Michele Simionato:
>
> > No, slots have nothing to do with speed, they are a memory optimization.
>
> In many languages, often in Python too, the less memory you use/
> allocate the faster you go.
>
> In fact slots allow a speed increase too (in new st
Michele Simionato:
> No, slots have nothing to do with speed, they are a memory optimization.
In many languages, often in Python too, the less memory you use/
allocate the faster you go.
In fact slots allow a speed increase too (in new style classes):
from timeit import default_timer as clock
c
Paulo J. Matos a écrit :
(snip)
However, I wouldn't dare to say Python needs structures to be a good
language, or anything similar. My question was more directed to : if
there aren't structures in Python, what do Pythonists use instead?
(I have seen dicts might be an alternative,
Yes, and the
Joe Strout a écrit :
On Nov 3, 2008, at 4:38 PM, Paulo J. Matos wrote:
However, I wouldn't dare to say Python needs structures to be a good
language, or anything similar. My question was more directed to : if
there aren't structures in Python, what do Pythonists use instead?
Classes.
or obj
On Nov 4, 2:57 am, Glenn Linderman <[EMAIL PROTECTED]> wrote:
> Note that classes, by default, are based on a contained dict! There are
> games to be played with slots that can apparently improve that. I am
> not yet experienced enough with Python to know if a slot is as fast as a
> C struct, but
On approximately 11/3/2008 5:28 PM, came the following characters from
the keyboard of Aaron Brady:
On Nov 3, 5:38 pm, "Paulo J. Matos" <[EMAIL PROTECTED]> wrote:
On Mon, Nov 3, 2008 at 10:19 PM, Aaron Brady <[EMAIL PROTECTED]> wrote:
On Nov 3, 3:45 pm, Ben Finney <[EMAIL PROTECTED]>
wr
On Tue, 04 Nov 2008 00:19:16 +, Marc 'BlackJack' Rintsch wrote:
> On Mon, 03 Nov 2008 23:32:25 +, Paulo J. Matos wrote:
>
>> What's then the reason for adding named tuples if they are not
>> mutable...???
>
> Names are more descriptive than "magic numbers" as indices. See for
> example
On Mon, 03 Nov 2008 17:06:07 -0800, Aaron Brady wrote:
>> For all practical purposes, dicts have almost constant access time (at
>> least with any half-decent __hash__ method).
>
> Hash tables are slick, but their hash function is their weakest link.
>
[ hash( 2**x ) for x in range( 0, 256
On approximately 11/3/2008 3:38 PM, came the following characters from
the keyboard of Paulo J. Matos:
On Mon, Nov 3, 2008 at 10:19 PM, Aaron Brady <[EMAIL PROTECTED]> wrote:
On Nov 3, 3:45 pm, Ben Finney <[EMAIL PROTECTED]>
wrote:
"Paulo J. Matos" <[EMAIL PROTECTED]> writes:
O
On Nov 3, 5:38 pm, "Paulo J. Matos" <[EMAIL PROTECTED]> wrote:
> On Mon, Nov 3, 2008 at 10:19 PM, Aaron Brady <[EMAIL PROTECTED]> wrote:
> > On Nov 3, 3:45 pm, Ben Finney <[EMAIL PROTECTED]>
> > wrote:
> >> "Paulo J. Matos" <[EMAIL PROTECTED]> writes:
> >> Take care with broad sweeping statements a
On Nov 3, 6:33 pm, George Sakkis <[EMAIL PROTECTED]> wrote:
> On Nov 3, 6:32 pm, "Paulo J. Matos" <[EMAIL PROTECTED]> wrote:
>
> > Even though I can use dicts where the keys are strings (as if it were
> > the name of the field), it seems to heavy, since a structure doesn't
> > need to be resizable
On Nov 3, 6:32 pm, "Paulo J. Matos" <[EMAIL PROTECTED]> wrote:
> Even though I can use dicts where the keys are strings (as if it were
> the name of the field), it seems to heavy, since a structure doesn't
> need to be resizable (and dicts are) and it has constant time access
> (which depending on
"Paulo J. Matos" <[EMAIL PROTECTED]> writes:
> OK, so this is now messing with my lack of knowledge regarding Python.
> What's (pure) Python? Is there any impure Python?
impure Python = Python with extensions written in C.
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Nov 4, 2008 at 12:17 AM, George Sakkis <[EMAIL PROTECTED]> wrote:
>
> Technically there are no private attributes in (pure) Python so the
> answer is still classes.
>
OK, so this is now messing with my lack of knowledge regarding Python.
What's (pure) Python? Is there any impure Python?
>
On Mon, 03 Nov 2008 23:32:25 +, Paulo J. Matos wrote:
> What's then the reason for adding named tuples if they are not
> mutable...???
Names are more descriptive than "magic numbers" as indices. See for
example the "named tuple" returned by `os.stat()`.
Ciao,
Marc 'BlackJack' Rints
On Nov 3, 6:51 pm, "Paulo J. Matos" <[EMAIL PROTECTED]> wrote:
> On Mon, Nov 3, 2008 at 11:47 PM, Joe Strout <[EMAIL PROTECTED]> wrote:
> > On Nov 3, 2008, at 4:38 PM, Paulo J. Matos wrote:
>
> >> However, I wouldn't dare to say Python needs structures to be a good
> >> language, or anything simila
On Mon, Nov 3, 2008 at 11:47 PM, Joe Strout <[EMAIL PROTECTED]> wrote:
> On Nov 3, 2008, at 4:38 PM, Paulo J. Matos wrote:
>
>> However, I wouldn't dare to say Python needs structures to be a good
>> language, or anything similar. My question was more directed to : if
>> there aren't structures in
On Nov 3, 2008, at 4:38 PM, Paulo J. Matos wrote:
However, I wouldn't dare to say Python needs structures to be a good
language, or anything similar. My question was more directed to : if
there aren't structures in Python, what do Pythonists use instead?
Classes.
Best,
- Joe
--
http://mail.
On Mon, Nov 3, 2008 at 10:19 PM, Aaron Brady <[EMAIL PROTECTED]> wrote:
> On Nov 3, 3:45 pm, Ben Finney <[EMAIL PROTECTED]>
> wrote:
>> "Paulo J. Matos" <[EMAIL PROTECTED]> writes:
>>
>> > On Mon, Nov 3, 2008 at 12:32 PM, Ben Finney
>> > <[EMAIL PROTECTED]> wrote:
>> > > I'm wondering a more fundam
On Mon, Nov 3, 2008 at 10:10 PM, Arnaud Delobelle
<[EMAIL PROTECTED]> wrote:
> Ben Finney <[EMAIL PROTECTED]> writes:
>
>> "Paulo J. Matos" <[EMAIL PROTECTED]> writes:
> [...]
>> Okay, you're talking about 'struct' from the C language. That helps
>> answer the question.
>
> Note that structs are mu
Craig Allen <[EMAIL PROTECTED]> writes:
>>
>> Care to say more about what they are, not what they're like?
>>
>
> I'm not the OP and I may be biased by C++, I can imagine the
> complaints when I say, classes are just structures with function
> members for working on the structure.
In C++ classes
>
> Care to say more about what they are, not what they're like?
>
I'm not the OP and I may be biased by C++, I can imagine the
complaints when I say, classes are just structures with function
members for working on the structure.
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 3, 3:45 pm, Ben Finney <[EMAIL PROTECTED]>
wrote:
> "Paulo J. Matos" <[EMAIL PROTECTED]> writes:
>
> > On Mon, Nov 3, 2008 at 12:32 PM, Ben Finney
> > <[EMAIL PROTECTED]> wrote:
> > > I'm wondering a more fundamental question: What are structures?
> > > That is, what do *you* mean by that te
Ben Finney <[EMAIL PROTECTED]> writes:
> "Paulo J. Matos" <[EMAIL PROTECTED]> writes:
[...]
> Okay, you're talking about ‘struct’ from the C language. That helps
> answer the question.
Note that structs are mutable.
> In Python, the way to do that is with a dict. A class can be used, but
> is of
On Mon, 3 Nov 2008 20:33:45 +, Paulo J. Matos <[EMAIL PROTECTED]> wrote:
> On Mon, Nov 3, 2008 at 12:32 PM, Ben Finney
> <[EMAIL PROTECTED]> wrote:
>> "Paulo J. Matos" <[EMAIL PROTECTED]> writes:
...
>> I'm wondering a more fundamental question: What are structures? That
>> is, what do *you* me
"Paulo J. Matos" <[EMAIL PROTECTED]> writes:
> On Mon, Nov 3, 2008 at 12:32 PM, Ben Finney
> <[EMAIL PROTECTED]> wrote:
> > I'm wondering a more fundamental question: What are structures?
> > That is, what do *you* mean by that term; without knowing that, an
> > answer isn't likely to be meaningfu
On Mon, Nov 3, 2008 at 12:32 PM, Ben Finney
<[EMAIL PROTECTED]> wrote:
> "Paulo J. Matos" <[EMAIL PROTECTED]> writes:
>
>> I am a Python beginner, reading through 2.6 tutorial. I am wondering
>> where are structures?
>
> I'm wondering a more fundamental question: What are structures? That
> is, wha
"Paulo J. Matos" <[EMAIL PROTECTED]> writes:
> I am a Python beginner, reading through 2.6 tutorial. I am wondering
> where are structures?
I'm wondering a more fundamental question: What are structures? That
is, what do *you* mean by that term; without knowing that, an answer
isn't likely to be
Paulo J. Matos wrote:
> Hi all,
>
> I am a Python beginner, reading through 2.6 tutorial. I am wondering
> where are structures?
>
> On the other hand, I think I might have the answer. Since Python focus
> on having one way to do it and structures are something like classes
> with only public met
Paulo J. Matos:
> Since Python focus
> on having one way to do it and structures are something like classes
> with only public methods, if I want structures that's what I should use.
> Is that right?
Yes, it is. On the other hand in Python 2.6 there's something that
helps you build one of such cla
33 matches
Mail list logo