Type derivation in python?
Posted
by aXqd
on Stack Overflow
See other posts from Stack Overflow
or by aXqd
Published on 2010-04-28T03:27:52Z
Indexed on
2010/04/28
3:33 UTC
Read the original article
Hit count: 358
In Perl, I can do this:
push(@{$h->[x]}, y);
Can I simplify the following python codes according to above Perl example?
if x not in h:
h[x] = []
h[x].append(y)
I want to simplify this, because it goes many places in my code, (and I cannot initialize all possible x with []). I do not want to make it a function, because there is no 'inline' keyword.
Any ideas?
© Stack Overflow or respective owner