7

Sometimes I see questions tagged with [python], but not more spefically tagged with [python-2.7] or [python-3.x]. People answering often assume a particular version of Python without explicitly saying so (for example, using xrange rather than range and thus assuming 2.7).

I think that if there is a default version that people are presumed to be using then it ought to be 3.x, but I'm curious whether there is a policy of any sort.

6
  • 2
    In the absence of specification, I'd say you can assume the latest version. Or whichever version you want. Jun 2, 2014 at 8:56
  • @CodyGray that might be right for many languages but is actually wrong for python as 2.x is still widely used; there are many libraries that have not yet been ported to python3. But in general, I'd try to answer any python questions with code that runs in the latest versions of python 2 and 3 (meaning in 2.7 and 3.4), and if applicable include some text about any version specific differences. As to old python versions, I wrote an answer for python2.1 a few months ago, as apparently the latest IBM websphere still ships with a jython version from the last decade...
    – l4mpi
    Jun 2, 2014 at 10:53
  • You are giving reasons why it is necessary to specify which version of Python is being used. I agree with that. This question assumes there is no version specified. Jun 2, 2014 at 11:05
  • @CodyGray actually I don't think it's neccessary for at least 95% of python questions - as long as you can assume that the answerer is using a recent version of python, it mostly doesn't matter if that is 2.6+ or 3.3+. Often the version differences are minor and an answer can apply to both 2.x and 3.x, or can at least explain the 2.x/3.x difference without much effort, see e.g. my most upvoted python answer.
    – l4mpi
    Jun 2, 2014 at 11:22
  • @l4mpi recent? 3.0, 3.1 and 3.2 are newer than Python 2.6. Python 3.2 is newer than 2.7! Mar 11, 2016 at 20:06
  • @AnttiHaapala that depends on your definition. Yes, 3.0.0 is newer than 2.6.0 and 3.2.0 is newer than 2.7.0; but 2.7 is still an active branch while 3.0 to 3.2 have long been phased out (as well as 3.3 and 2.6, afaik). Anyways, the point of my comment was that the default assumption in the absence of specific tags should be that a reasonably recent and stable python version is used (e.g. not something absurd such as jython 2.1, looking at you IBM); and that it mostly doesn't matter if that's a 2.x or 3.x as the answer can usually address both versions.
    – l4mpi
    Mar 12, 2016 at 13:02

1 Answer 1

9

There is a tagging recommendation here:

Use the tag for all Python related questions. If you believe your question includes issues specific to incompatibilities between Python 2.x and Python 3.x, use or in addition to the main tag. If you believe your question may be even more specific, you can include a version specific tag such as .

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .