By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,652 Members | 1,694 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,652 IT Pros & Developers. It's quick & easy.

suggestion: recursive collections.defaultdict

P: n/a
It seems like

x = defaultdict(defaultdict(list))

should do the obvious, but it doesn't. This seems to work

y = defaultdict(lambda: defaultdict(list))

though is a bit uglier.

Jun 18 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
In <11**********************@k79g2000hse.googlegroups .com>,
tu*****@gmail.com wrote:
It seems like

x = defaultdict(defaultdict(list))

should do the obvious, but it doesn't.
It *does* the obvious. Parenthesis after a name means: call this object
*now*. Any other behavior wouldn't be obvious.

Ciao,
Marc 'BlackJack' Rintsch
Jun 18 '07 #2

P: n/a
On Jun 18, 1:56 pm, Marc 'BlackJack' Rintsch <bj_...@gmx.netwrote:
In <1182184918.766497.315...@k79g2000hse.googlegroups .com>,

tutu...@gmail.com wrote:
It seems like
x = defaultdict(defaultdict(list))
should do the obvious, but it doesn't.

It *does* the obvious. Parenthesis after a name means: call this object
*now*. Any other behavior wouldn't be obvious.

Well, some of us are in the "slow" class...
Jun 28 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.