Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #46403 > unrolled thread
| Started by | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| First post | 2013-05-29 12:24 -0600 |
| Last post | 2013-05-29 12:24 -0600 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Getting a callable for any value? Ian Kelly <ian.g.kelly@gmail.com> - 2013-05-29 12:24 -0600
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2013-05-29 12:24 -0600 |
| Subject | Re: Getting a callable for any value? |
| Message-ID | <mailman.2373.1369851922.3114.python-list@python.org> |
On Wed, May 29, 2013 at 12:19 PM, Fábio Santos <fabiosantosart@gmail.com> wrote: > Are you sure you don't want to use a lambda expression? They are pretty > pythonic. > > none_factory = lambda: None > defaultdict_none_factory = lambda: defaultdict(none_factory) > > collections.defaultdict(defaultdict_none_factory) Gah. If you're going to go to the trouble of assigning a name to the lambda, then just use a def statement: def none_factory: return None def defaultdict_none_factory: return defaultdict(none_factory) collections.defaultdict(defaultdict_none_factory)
Back to top | Article view | comp.lang.python
csiph-web