2016
Aug
11
awarded  Yearling
May
31
comment Check First vs Exception Handling?
@yeoman when to throw an exception is a different question, this one is about using try/except rather than setting up a conditional for "is the following likely to throw an exception", and Python practice is definitely to prefer the former. It doesn't hurt that that approach is (probably) more efficient here, since, in the case where the split succeeds, you only walk the string once. As to whether split should throw an exception here, I would say it definitely should - one common rule is you should throw when you can't do what your name says, and you can't split at a missing delimiter.
2015
Mar
11
awarded  Yearling
2014
Mar
11
awarded  Yearling
2013
Apr
23
awarded  Good Answer
Mar
11
awarded  Yearling
2012
Jul
26
awarded  Nice Answer
Jun
21
answered Can the Turing machine be classified?
Mar
14
answered Which style to use for unused return parameters in a Python function call
Mar
11
awarded  Teacher
Mar
11
awarded  Supporter
Mar
11
answered Check First vs Exception Handling?