python syntax for conditional is unfortunate
Aaron "Castironpi" Brady
castironpi at gmail.com
Thu Sep 25 05:16:49 CEST 2008
On Sep 24, 9:49 pm, Asun Friere <afri... at yahoo.co.uk> wrote:
> On Sep 25, 11:57 am, "Aaron \"Castironpi\" Brady"
> <castiro... at gmail.com> wrote:
> > On Sep 24, 8:40 pm, Asun Friere <afri... at yahoo.co.uk> wrote:
> > > ... I think
> > > your last version ('%d thing%s' % (i, 's' if i != 1 else '')), holding
> > > all variables for placeholders in the tuple, is better. It's certainly
> > > more readible.
> > It's a different answer if you have 'things is/are'. '%d thing%s %s'%
> > ( ( i, )+ ( 's', 'are' ) if i!= 1 else ( '', 'is' ) ). Or excluding
> > prepositional phrases and subordinate clauses, '%d thing%s'% ( i, 's
> > are' if i!= 1 else ' is' ).
> Forgive me for being dull, my caffeine levels have not yet optimal,
> but I don't follow. Both the solutions you propose do put all the
> placeholder variables in the tuple. Or are you saying it no longer
> remains readible?
> BTW you repeated my mistake with the first scraplet of code.
Ah yes. Maybe the order of precedence can undergo a change in the
future. ... Though talk about backwards incompatible. They were two
options if you have a verb with your noun, which would need a
More information about the Python-list