On Tue, Oct 25, 2016 at 09:11:06PM +0200, Michel Desmoulin wrote:
> We have a syntax to create strings with variables automatically inferred
> from its context:
>
> >>> name = "Guido"
> >>> print(f'Hello {name}')
> Hello Guido
> Similarly, I'd like to suggest a similar feature for building dict
Le 25/10/2016 à 22:27, Paul Moore a écrit :
On 25 October 2016 at 20:11, Michel Desmoulin wrote:
Similarly, I'd like to suggest a similar feature for building dictionaries:
foo = 1
bar = 2
{:bar, :foo}
{'bar': 1, 'foo', 2}
I don't see a huge advantage over
dict(foo=foo, bar=bar)
Avoi
On 25 October 2016 at 20:11, Michel Desmoulin wrote:
> Similarly, I'd like to suggest a similar feature for building dictionaries:
>
foo = 1
bar = 2
{:bar, :foo}
> {'bar': 1, 'foo', 2}
I don't see a huge advantage over
>>> dict(foo=foo, bar=bar)
Avoiding having to repeat the vari
We have a syntax to create strings with variables automatically inferred
from its context:
>>> name = "Guido"
>>> print(f'Hello {name}')
Hello Guido
Similarly, I'd like to suggest a similar feature for building dictionaries:
>>> foo = 1
>>> bar = 2
>>> {:bar, :foo}
{'bar': 1, 'foo', 2}
And a