IMHO, it would be much easier to learn and understand if keywords can only
be used by escaping them, instead of depending where they occur.
On Wed, May 16, 2018 at 9:13 AM, Wolfgang Maier <
wolfgang.ma...@biologie.uni-freiburg.de> wrote:
> On 16.05.2018 02:41, Steven D'Aprano wrote:
>
>>
>> Some
sion-based constructs don't
> feel that natural for Python.
>
> On Saturday, May 12, 2018 at 2:50:49 PM UTC, Andrés Delfino wrote:
>>
>> I find it weird for case statements to be "inside" match statements.
>> There's isn't a statement "group
I find it weird for case statements to be "inside" match statements.
There's isn't a statement "group" that works this way right now, AFAIK.
This would also be weird:
match X:
case Y:
...
I thought a form based on try would make more coherent:
match:
suite
case x:
suite1
else:
suite
Oh, I get it now, thanks!
On Fri, Apr 13, 2018 at 2:11 AM, Serhiy Storchaka
wrote:
> 12.04.18 22:42, Andrés Delfino пише:
>
>> I think the update method can (and personally, should) stay unchanged:
>>
>> spam.update(dict(x, y))
>>
>> seems succinct a
Storchaka
wrote:
> 09.04.18 00:18, Andrés Delfino пише:
>
>> I thought that maybe dict could accept several mappings as positional
>> arguments, like this:
>>
>> class Dict4(dict):
>> def __init__(self, *args, **kwargs):
>> if len
s over the
> years to get a new one but it doesn't work:
>
> d3 = d1 + d2 # TypeError
>
> Thinking a bit, set union is probably a better analogue, but it doesn't
> work either:
>
> d3 = d1 | d2 # TypeError
>
> Where the last value of any duplicate keys
Extending the original idea, IMHO it would make sense for the dict
constructor to create a new dictionary not only from several mappings, but
mixing mappings and iterables too.
Consider this example:
x = [(1, 'one')]
y = {2: 'two'}
Now: {**dict(x), **y}
Proposed: dict(x, y)
I think this extensi
Sorry, I didn't know that kwargs unpacking in dictionaries displays don't
raise a TypeError exception.
On Mon, Apr 9, 2018 at 8:23 AM, Daniel Moisset
wrote:
> In which way would this be different to {**mapping1, **mapping2,
> **mapping3} ?
>
> On 8 April 2018 at 22:18,
Hi!
I thought that maybe dict could accept several mappings as positional
arguments, like this:
class Dict4(dict):
> def __init__(self, *args, **kwargs):
> if len(args) > 1:
> if not all([isinstance(arg, dict) for arg in args]):
> raise TypeError('Dict4 ex
Hi!
I was thinking: perhaps it would be nice to be able to quicky split a
string, do some slicing, and then obtaining the joined string back.
Say we have the string: "docs.python.org", and we want to change "docs" to
"wiki". Of course, there are a ton of simpler ways to solve this particular
need
10 matches
Mail list logo