On 8/07/20 10:19 PM, Peter J. Holzer wrote:
On 2020-07-08 12:26:06 +1200, dn via Python-list wrote:
OTOH, using a tuple doesn't prevent the function from mutating mutable
arguments:
#!/usr/bin/python3
def f(*a):
a[0]["new"] = 2
v = { "old": 1}
f(v)
print(v)
prints «{'old': 1, 'new': 2}».
' mailto:python-list@python.org>> Subject: Questioning the effects of
multiple assignment TLDR; if you are a Python 'Master' then feel
free to skim the first part (which you should know hands-down),
...
Dunno about the rest of the list but I'm finding this
On 8/07/20 2:40 PM, Kyle Stanley wrote:
A matter of style, which I like to follow [is it TDD's influence? - or
does it actually come-from reading about DBC (Design by Contract*)?] is
the injunction that one *not* vary the value of a parameter inside a
method/function.
(useful
On Tue, Jul 7, 2020 at 2:30 AM Mike Dewhirst wrote:
>
> Original message From: dn via Python-list <
> python-list@python.org> Date: 7/7/20 16:04 (GMT+10:00) To: 'Python' <
> python-list@python.org> Subject: Questioning the effects of multip
On 2020-07-08 12:26:06 +1200, dn via Python-list wrote:
> A matter of style, which I like to follow [is it TDD's influence? - or
> does it actually come-from reading about DBC (Design by Contract*)?]
I think Design by Contract only affects the interfaces (parameters,
return values and side effects
>
> A matter of style, which I like to follow [is it TDD's influence? - or
> does it actually come-from reading about DBC (Design by Contract*)?] is
> the injunction that one *not* vary the value of a parameter inside a
> method/function.
> (useful in 'open-box testing' to check both the API and th
On 7/07/20 7:44 PM, Kyle Stanley wrote:
Can you explain why these two (apparently) logical assignment processes
have been designed to realise different result-objects?
The reason is because of the conventions chosen in PEP 3132, which
implemented the feature in the first place. It wa
On 7/07/20 7:21 PM, Mike Dewhirst wrote:
Original message
For comparison, here's the original form:-
>>> def f( a, *b, c=0 ):
... print( a, type( a ) )
... print( c, type( c ) )
... print( b )
...
>>> f( 1, 'two', 3, 'four' )
1
0
('two', 3, 'four')
Shouldn't
>
> Can you explain why these two (apparently) logical assignment processes
> have been designed to realise different result-objects?
The reason is because of the conventions chosen in PEP 3132, which
implemented the feature in the first place. It was considered to return a
tuple for the consiste
Original message From: dn via Python-list
Date: 7/7/20 16:04 (GMT+10:00) To: 'Python'
Subject: Questioning the effects of multiple
assignment TLDR; if you are a Python 'Master' then feel free to skim the first
part (which you should know hands-down)
TLDR; if you are a Python 'Master' then feel free to skim the first part
(which you should know hands-down), until the excerpts from 'the manual'
and from there I'll be interested in learning from you...
Yesterday I asked a junior prog to expand an __init__() to accept either
a series of (>1)
11 matches
Mail list logo