Terry Reedy wrote:
> Constant tuples (a tuple whose members are all seen as constants by the
> compiler) are now pre-compiled and constructed once and put into the
> code object as such rather than re-constructed with each run of the code.
Sadly that's not entirely accurate.
Tuples whose memb
On Jan 27, 10:15 pm, Terry Reedy wrote:
> On 1/27/2010 12:32 PM, Antoine Pitrou wrote:
>
> > Le Wed, 27 Jan 2010 02:20:53 -0800, Floris Bruynooghe a écrit :
>
> >> Is a list or tuple better or more efficient in these situations?
>
> > Tuples are faster to allocate (they are allocated in one single
On 1/27/2010 12:32 PM, Antoine Pitrou wrote:
Le Wed, 27 Jan 2010 02:20:53 -0800, Floris Bruynooghe a écrit :
Is a list or tuple better or more efficient in these situations?
Tuples are faster to allocate (they are allocated in one single step) and
quite a bit smaller too.
In some situations,
Le Wed, 27 Jan 2010 02:20:53 -0800, Floris Bruynooghe a écrit :
>
> Is a list or tuple better or more efficient in these situations?
Tuples are faster to allocate (they are allocated in one single step) and
quite a bit smaller too.
In some situations, in Python 2.7 and 3.1, they can also be igno
Iain King wrote:
> On Jan 27, 10:20 am, Floris Bruynooghe
> wrote:
>> One thing I ofter wonder is which is better when you just need a
>> throwaway sequence: a list or a tuple? E.g.:
>>
>> if foo in ['some', 'random', 'strings']:
>> ...
>> if [bool1, bool2, boo3].count(True) != 1:
>>...
>
Iain King wrote:
> On Jan 27, 10:20 am, Floris Bruynooghe
> wrote:
>> One thing I ofter wonder is which is better when you just need a
>> throwaway sequence: a list or a tuple? E.g.:
>>
>> if foo in ['some', 'random', 'strings']:
>> ...
>> if [bool1, bool2, boo3].count(True) != 1:
>>...
>
On Jan 27, 10:20 am, Floris Bruynooghe
wrote:
> One thing I ofter wonder is which is better when you just need a
> throwaway sequence: a list or a tuple? E.g.:
>
> if foo in ['some', 'random', 'strings']:
> ...
> if [bool1, bool2, boo3].count(True) != 1:
> ...
>
> (The last one only works
One thing I ofter wonder is which is better when you just need a
throwaway sequence: a list or a tuple? E.g.:
if foo in ['some', 'random', 'strings']:
...
if [bool1, bool2, boo3].count(True) != 1:
...
(The last one only works with tuples since python 2.6)
Is a list or tuple better or mor