* rantingrick, on 11.07.2010 08:50:
On Jul 11, 1:22 am, Stephen Hansen<me+list/pyt...@ixokai.io>  wrote:

Utter nonsense. No one does that unless they are coming from C or some
other language without a True/False and don't know about it, or if they
are using a codebase which is supporting a very old version of Python
before True or False were introduced.

Ah yes, when nothing else seems to work fall back to you default
programming... FUD and ad hominem
attacks

I agree with Stephen, but for a different reason: that given desirability of implicit conversion to bool for some elementary types, then for uniformity there should be such conversion for all of them (and AFAIK there is), and given that, the rule should be the same, namely that default value of each type bool's to False, and other values to True, and so it is.

The OP should simply represent "not found" as e.g. integer -1 instead of as a value of a different type.

And write e.g.

  not_found = -1

     ...

  if choiceIdx1 == choiceIdx2 == not_found:
      bah, none of them
  elif choice2Idx == not_found:
      use choice 1
  elif choice1Idx == not_found:
      use choice 2
  else:
      determine bestest choice


Cheers & hth.,

- Alf


--
blog at <url: http://alfps.wordpress.com>
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to