On Wed, Nov 14, 2012 at 3:12 AM, Chris Withers ch...@simplistix.co.uk wrote:
Hi All,
A colleague pointed me at Doug's excellent article here:
...which made me a little sad, I suspect I'm not the only one who finds:
a_dict = dict(
x = 1,
y = 2,
z = 3,
...
)
On Wed, Nov 14, 2012 at 11:02 AM, Xavier Morel python-...@masklinn.net wrote:
On 2012-11-14, at 17:42 , Richard Oudkerk wrote:
On 14/11/2012 4:23pm, Serhiy Storchaka wrote:
PEP 8 recommends:
a_dict = dict(
x=1,
y=2,
z=3,
...
)
and
a_dict = {
'x': 1,
'y':
On Wed, Nov 14, 2012 at 11:00 AM, Brian Curtin br...@python.org wrote:
On Wed, Nov 14, 2012 at 10:12 AM, Mark Adam dreamingforw...@gmail.com wrote:
On Wed, Nov 14, 2012 at 3:12 AM, Chris Withers ch...@simplistix.co.uk
wrote:
Hi All,
A colleague pointed me at Doug's excellent article here
On Wed, Nov 14, 2012 at 11:27 AM, R. David Murray rdmur...@bitdance.com wrote:
Maybe it's not good design, but I'll bet you that if it didn't do that,
there would be lots of instances of this scattered around various
codebases:
def makedict(**kw):
return kw
Now that's a good
On Wed, Nov 14, 2012 at 12:12 PM, Xavier Morel catch-...@masklinn.net wrote:
On 2012-11-14, at 18:10 , Mark Adam wrote:
Try the canonical {'x':1}. Only dict allows the special
initialization above. Other collections require an iterable.
Other collections don't have a choice, because
On Wed, Nov 14, 2012 at 1:37 PM, Xavier Morel catch-...@masklinn.net wrote:
On 2012-11-14, at 19:54 , Mark Adam wrote:
Merging of two dicts is done with dict.update.
No, dict.update merges one dict (or two) into a third one.
No. I think you need to read the docs.
How do you do
On Wed, Nov 14, 2012 at 5:40 PM, Chris Angelico ros...@gmail.com wrote:
On Thu, Nov 15, 2012 at 10:36 AM, Steven D'Aprano st...@pearwood.info wrote:
On 15/11/12 05:54, Mark Adam wrote:
Notice that I'm not merging one dict into another, but merging two dicts
into a third.
Side point: Wouldn't
On Wed, Nov 14, 2012 at 8:28 PM, Stephen J. Turnbull step...@xemacs.org wrote:
Chris Angelico writes:
{a:1}+{b:2}
It would make sense for this to result in {a:1,b:2}.
The test is not does this sometimes make sense? It's does this
ever result in nonsense, and if so, do we care?