> In python 3.6+ this is better since the dictionary is insertion-ordered,
but is still not really what one would probably want.
Be careful: ordered dict is an implementation detail. You must use
explicitly collections.OrderedDict() to avoid bad surprises.
In CPython 3.7, dict might change
Thank you! This overview really helps!
On Thu, Jun 08, 2017 at 11:18:06AM +1000, Steven D'Aprano
wrote:
> On Wed, Jun 07, 2017 at 06:14:08PM +, Nick Humrich wrote:
>
> > It would be cool to have a syntax that would unpack the dictionary to
> > values based on the names
On Wed, Jun 07, 2017 at 06:14:08PM +, Nick Humrich wrote:
> It would be cool to have a syntax that would unpack the dictionary to
> values based on the names of the variables. Something perhaps like:
>
> a, b, c = **mydict
This was discussed (briefly, to very little interest) in March/April
On Jun 7, 2017 5:54 PM, "Erik" wrote:
On 07/06/17 23:42, C Anthony Risinger wrote:
> Neither of these are really comparable to destructuring.
>
No, but they are comparable to the OP's suggested new built-in method
(without requiring each mapping type - not just dicts
On Jun 7, 2017 5:42 PM, "C Anthony Risinger" wrote:
On Jun 7, 2017 5:15 PM, "Matt Gilson" wrote:
On Wed, Jun 7, 2017 at 3:11 PM, Erik wrote:
> On 07/06/17 19:14, Nick Humrich wrote:
>
>> a, b, c = mydict.unpack('a',
On 07/06/17 23:42, C Anthony Risinger wrote:
Neither of these are really comparable to destructuring.
No, but they are comparable to the OP's suggested new built-in method
(without requiring each mapping type - not just dicts - to implement
it). That was what _I_ was responding to.
E.
On Wed, Jun 7, 2017 at 3:11 PM, Erik wrote:
> On 07/06/17 19:14, Nick Humrich wrote:
>
>> a, b, c = mydict.unpack('a', 'b', 'c')
>>
>
> def retrieve(mapping, *keys):
>return (mapping[key] for key in keys)
>
>
>
Or even:
from operator import itemgetter
retrieve =
On 07/06/17 19:14, Nick Humrich wrote:
a, b, c = mydict.unpack('a', 'b', 'c')
def retrieve(mapping, *keys):
return (mapping[key] for key in keys)
$ python3
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for
In python, we have beautiful unpacking:
a, b, c = [1,2,3]
and even
a, b, *c = [1,2,3,4,5]
We also have dictionary destructing for purposes of keywords:
myfunc(**mydict)
You can currently unpack a dictionary, but its almost certainly not what
you would intend.
a, b, c = {'a': 1, 'c': 3, 'b':
On 2017-06-07 02:03, Mikhail V wrote:
> Greg Ewing wrote:
>
>> Steven D'Aprano wrote:
>>> There's not much, if any, benefit to writing:
>>>
>>> ∫(expression, lower_limit, upper_limit, name)
>
>> More generally, there's a kind of culture clash between mathematical
>> notation and programming
As already mentioned, Vim can display <= as ≤ using the ' conceal' feature.
(And in fact arbitrary substitutions, of course.)
Stephan
Op 7 jun. 2017 8:48 a.m. schreef "Brice PARENT" :
Le 07/06/17 à 07:34, Greg Ewing a écrit :
> Yes, there are a few symbols it would be
Le 07/06/17 à 07:34, Greg Ewing a écrit :
Yes, there are a few symbols it would be nice to have.
A proper ≠ symbol would have avoided the wars between
<> and !=. :-)
I'm not sure it's worth any change in the language, it's already really
easy to read and write as is.
But I agree this can
07.06.17 08:34, Greg Ewing пише:
Mikhail V wrote:
I find actually symbols ≤ ≥ (inclusive comparison) nice.
Yes, there are a few symbols it would be nice to have.
A proper ≠ symbol would have avoided the wars between
<> and !=. :-)
But this would start the war between ≤ and ⩽ (symbols used
13 matches
Mail list logo