On Tue, Apr 6, 2021 at 5:36 AM Rob Cliffe via Python-list
wrote:
>
>
>
> On 05/04/2021 18:33, Chris Angelico wrote:
> >
> > Firstly, anything with any variable at all can involve a lookup, which
> > can trigger arbitrary code (so "variables which do not occur on the
> > LHS" is not sufficient).
>
On 05/04/2021 18:33, Chris Angelico wrote:
Firstly, anything with any variable at all can involve a lookup, which
can trigger arbitrary code (so "variables which do not occur on the
LHS" is not sufficient).
Interesting. I was going to ask: How could you make a variable lookup
trigger arbitra
On Tue, Apr 6, 2021 at 3:26 AM Rob Cliffe via Python-list
wrote:
>
>
>
> On 05/04/2021 17:52, Chris Angelico wrote:
> > On Tue, Apr 6, 2021 at 2:32 AM Rob Cliffe via Python-list
> > wrote:
> >>
> >>
> >> It doesn't appear to, at least not always. In Python 3.8.3:
> >> from dis import dis
> >> de
On 05/04/2021 17:52, Chris Angelico wrote:
I don't understand. What semantic difference could there be between
x = { 1: 2 } ; y = [3, 4] ; z = (5, 6)
and
x, y, z = { 1:2 }, [3, 4], (5, 6)
? Why is it not safe to convert the latter to the former?
But I withdraw "set" from my "
On 05/04/2021 17:52, Chris Angelico wrote:
On Tue, Apr 6, 2021 at 2:32 AM Rob Cliffe via Python-list
wrote:
It doesn't appear to, at least not always. In Python 3.8.3:
from dis import dis
def f(): x = 1 ; y = 2
def g(): (x,y) = (1,2)
dis(f)
dis(g)
Output:
2 0 LOAD_CONST
On Tue, Apr 6, 2021 at 2:32 AM Rob Cliffe via Python-list
wrote:
>
>
>
> It doesn't appear to, at least not always. In Python 3.8.3:
> from dis import dis
> def f(): x = 1 ; y = 2
> def g(): (x,y) = (1,2)
> dis(f)
> dis(g)
>
> Output:
>2 0 LOAD_CONST 1 (1)
>
On 05/04/2021 00:47, dn via Python-list wrote:
On 04/04/2021 01.00, Rob Cliffe via Python-list wrote:
On 03/04/2021 04:09, 2qdxy4rzwzuui...@potatochowder.com wrote:
On 2021-04-03 at 02:41:59 +0100,
Rob Cliffe via Python-list wrote:
x1 = 42; y1 = 3; z1 = 10
x2 = 41; y2 = 12;
On 2021-04-05 at 11:47:53 +1200,
dn via Python-list wrote:
> Did you spot how various contributors identified when they prefer one
> method in a specific situation, but reach for another under differing
> circumstances!
What? Use cases matter? I'm *shocked*. :-/
Of all the methodologies I us
On 5/04/21 11:47 am, dn wrote:
I think I've read that the compiler is smart-enough to realise that the
RHS 'literal-tuples'?'tuple-literals' are being used as a 'mechanism',
and thus the inits are in-lined.
It does indeed seem to do this in some cases:
>>> def g(i, j, k):
... a, b, c = i, j,
On 04/04/2021 01.00, Rob Cliffe via Python-list wrote:
>
>
> On 03/04/2021 04:09, 2qdxy4rzwzuui...@potatochowder.com wrote:
>> On 2021-04-03 at 02:41:59 +0100,
>> Rob Cliffe via Python-list wrote:
>>
>>> x1 = 42; y1 = 3; z1 = 10
>>> x2 = 41; y2 = 12; z2 = 9
>>> x3 = 8; y3 = 8
On 03/04/2021 11.25, Marco Ippolito wrote:
>> (a) basic linear presentation:
>>
>> resource = "Oil"
>> time = 1
>> crude = 2
>> residue = 3
>> my_list = "long"
>>
>> (b) using explicit tuples:
>>
>> ( resource, time, crude, residue, my_list ) = ( "Oil", 1, 2, 3, "long" )
>>
>> (c) linear and indent
On 03/04/2021 04:09, 2qdxy4rzwzuui...@potatochowder.com wrote:
On 2021-04-03 at 02:41:59 +0100,
Rob Cliffe via Python-list wrote:
x1 = 42; y1 = 3; z1 = 10
x2 = 41; y2 = 12; z2 = 9
x3 = 8; y3 = 8; z3 = 10
(please imagine it's in a fixed font with everything neatly vertica
On 2021-04-03 at 02:41:59 +0100,
Rob Cliffe via Python-list wrote:
> x1 = 42; y1 = 3; z1 = 10
> x2 = 41; y2 = 12; z2 = 9
> x3 = 8; y3 = 8; z3 = 10
> (please imagine it's in a fixed font with everything neatly vertically
> aligned).
> This has see-at-a-glance STRUCTURE: the lette
On 02/04/2021 23:10, dn via Python-list wrote:
> When there are several items to be defined and initialised, how do you
> prefer to format the code, and why?
> (a) basic linear presentation:
>
> resource = "Oil"
> time = 1
> crude = 2
> residue = 3
> my_list = "long"
In production code I'd almos
On 02/04/2021 23:10, dn via Python-list wrote:
(f) the space-saver:
resource = "Oil"; time = 1; crude = 2; residue = 3; my_list = "long"
IMO This can be OK when the number of items is VERY small (like 2) and
not expected to increase (or decrease). Especially if there are
multiple simil
On 2021-04-02 at 19:25:07 -0300,
Marco Ippolito wrote:
> > (a) basic linear presentation:
> >
> > resource = "Oil"
> > time = 1
> > crude = 2
> > residue = 3
> > my_list = "long"
> >
> > (b) using explicit tuples:
> >
> > ( resource, time, crude, residue, my_list ) = ( "Oil", 1, 2, 3, "long" )
> (a) basic linear presentation:
>
> resource = "Oil"
> time = 1
> crude = 2
> residue = 3
> my_list = "long"
>
> (b) using explicit tuples:
>
> ( resource, time, crude, residue, my_list ) = ( "Oil", 1, 2, 3, "long" )
>
> (c) linear and indented tuples:
>
> (
> resource,
> time,
>
When there are several items to be defined and initialised, how do you
prefer to format the code, and why?
Apprentice: learn options
Journeyman: consider and discuss
Python Master: define, declare, and correct/advise/tutor
Some do not realise that using a tuple is a convenient way to convey
mul
18 matches
Mail list logo