how to avoid python numeric literals beginning with “0” being treated as octal?
问题 I am trying to write a small Python 2.x API to support fetching a job by jobNumber , where jobNumber is provided as an integer. Sometimes the users provide a jobNumber as an integer literal beginning with 0, e.g. 037537 . (This is because they have been coddled by R, a language that sanely considers 037537==37537 .) Python, however, considers integer literals starting with "0" to be OCTAL, thus 037537!=37537 , instead 037537==16223 . This strikes me as a blatant affront to the principle of