[Python-Dev] ',' precedence in documentation

C. Titus Brown ctb at msu.edu
Sun Sep 14 21:31:01 CEST 2008


Hi folks,

over on the pygr list, we were recently discussing a mildly confusing
edit I made:

   assert 'seq1' in self.db, self.db.keys() 

This was interpreted by someone as being

   assert 'seq1' in (self.db, self.db.keys())

which is very different from the actual meaning,

   assert ('seq1' in self.db), self.db.keys()

where 'self.db.keys()' serves as the message to be printed out when the
assertion fails.  Apart from questions of why I was apparently out to
confuse people with this edit, the question of ',' precedence came up.
Looking at

	http://docs.python.org/ref/summary.html

there's no mention of ',' binding and tuple creation vs the other
operators.  I'm not really sure how to think of it but it seems like
this is something that could be cleared up in the docs with a brief note
somewhere.  Thoughts?

cheers,
--titus
-- 
C. Titus Brown, ctb at msu.edu


More information about the Python-Dev mailing list