Organiser of the Edinburgh Language Exchange and The Edinburgh Open Tech Scene |
Full Snack Developer 🥪, Ramen guzzler 🍜, quiche murderer 🥧. A friendly cat.
All these are new to me - but most quizzical is the default mutable object. I had to parse that in my head several times before I could quite grasp its implications.
It's as if
defthing(a=[]):a.append("nope")
is processed in-interpreter as
define a = <an array>
assign a to address <$A>
define thing using <$A>
So some sort of pre-processing of assignments ...
Which is essentially what you explained but I just really needed to express it in my own broken break-down....
I have never tried to use such a construct, but I am pretty sure I have seen it in some peoples' code at work so I will endeavour to weed that out.....!
And the disaster that's blessing in disguise is to use this for logging within a function. Capture some kind of information everytime a function is called.
There are sure some more interesting ways to log our findings or errors, like using decorator, singleton object or mutable objects in functions and simply using conditionals.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
All these are new to me - but most quizzical is the default mutable object. I had to parse that in my head several times before I could quite grasp its implications.
It's as if
is processed in-interpreter as
a = <an array>
a
to address<$A>
thing
using<$A>
So some sort of pre-processing of assignments ...
Which is essentially what you explained but I just really needed to express it in my own broken break-down....
I have never tried to use such a construct, but I am pretty sure I have seen it in some peoples' code at work so I will endeavour to weed that out.....!
I am englihtened!
Glad you found it interesting 😊
And the disaster that's blessing in disguise is to use this for
logging
within a function. Capture some kind of information everytime a function is called.There are sure some more interesting ways to log our findings or errors, like using decorator, singleton object or mutable objects in functions and simply using conditionals.