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 nice to have.
> A prope
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 n
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': 2}.v
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 more
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 = itemgetter('a', 'b', 'c')
a
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', 'b', 'c')
>>
>
> def retrieve(mapping, *keys):
>return (mapping[key] for key in keys)
>
>
>
Or even:
from operator import it
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.
_
I think you want something similar to locals.update(mydict)?
2017-06-08 0:54 GMT+02:00 Erik :
> 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 requir
* locals().update(mydict)
2017-06-08 0:59 GMT+02:00 Antoine Rozo :
> I think you want something similar to locals.update(mydict)?
>
> 2017-06-08 0:54 GMT+02:00 Erik :
>
>> On 07/06/17 23:42, C Anthony Risinger wrote:
>>
>>> Neither of these are really comparable to destructuring.
>>>
>>
>> No, bu
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', 'b', 'c')
>>
>
> def retrieve(mapping, *keys):
>return (mapping[key] fo
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 - to implement it).
That wa
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
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 of the variables. Som
> 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 again.
One existing way to do this:
a, b, c = (mydict[k] for k in ('a', 'b', 'c'))
--
Greg
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
C Anthony Risinger wrote:
Incredibly useful and
intuitive, and for me again, way more generally applicable than iterable
unpacking. Maps are ubiquitous.
Maps with a known, fixed set of keys are relatively uncommon
in Python, though. Such an object is more likely to be an
object with named attr
>
> Maps with a known, fixed set of keys are relatively uncommon
> in Python, though.
This is false in interacting with HTTP services, where frequently you're
working with deserialized JSON dictionaries you expect to be in a precise
format (and fail if not).
On Wed, Jun 7, 2017 at 11:32 PM, Greg
17 matches
Mail list logo