47

Is there anything in Python akin to Java's JLS or C#'s spec?

kgrad
  • 4,672
  • 7
  • 36
  • 57
  • I Googled it too and found a Wikipedia article and the Python Language Reference. These are hardly a specification, which he is looking for. – cdmckay Jul 08 '09 at 02:21
  • 4
    @S.Lott Yes actually I did Google it, not that it matters, these are the types of questions that SO is here for. Instead of a snippy comment maybe you could try answering helpfully. – kgrad Jul 08 '09 at 02:25
  • Why was the Google result of a Python Language Specification unacceptable? What was wrong with it? – S.Lott Jul 08 '09 at 02:36
  • 5
    @S.Lott because it did not answer the question. Google gave me a wiki article on the PLR and the PLR itself. It did not tell me there was no formal spec nor did it say there was. It remained unclear. Furthermore, I thought this would be a good question for SO seeing as SO is MEANT for these types of questions. – kgrad Jul 08 '09 at 02:59

3 Answers3

35

There's no specification per se. The closest thing is the Python Language Reference, which details the syntax and semantics of the language.

Noldorin
  • 144,213
  • 56
  • 264
  • 302
  • 5
    How is the PLR not a specification? It is not a mathematically formal specification, but then neither is the ISO C or ISO C++ Standard. – Yttrill Dec 17 '11 at 09:47
  • @Yttrill Maybe it was different when this answer was posted? Right _now_, it does look like a formal specification, in section 5 (Expressions) and onward. Sections 1-4 just look like detailed descriptions, rather than a spec. – Izkata May 17 '12 at 18:05
  • I think the Python Language Reference is just a reference specified for CPython? – yegle Oct 16 '12 at 18:11
  • CPython is the default/standard implementation, so it's a pretty darn good reference! – Noldorin Oct 16 '12 at 18:37
  • 4
    CPython specific implementation details are generally appropriately qualified in the language reference and the standard library reference. As other compliant implementations like PyPy, IronPython and Jython find areas they have a problem with, they seek clarification from python-dev as necessary (the C API, reference counting and the GIL are all CPython implementation details, for example). We sometimes even find obscure CPython bugs this way. Tests covering such areas are flagged as "cpython_only" in the regression test suite, which is also shared across the major implementations. – ncoghlan Mar 18 '15 at 05:45
  • @Yttrill If it can change at will, and it just records the choices of CPython, it's really documentation, and not a specification. The ISO standards are specs because they are the source of truth. – Justin Meiners Dec 10 '20 at 05:36
2

You can check out the Python Reference

nojevive
  • 3,518
  • 3
  • 22
  • 18
0

No, python is defined by its implementation.

Marko
  • 30,263
  • 18
  • 74
  • 108
  • 32
    Not true -- what's generally considered the de facto reference implementation (CPython) has some aspects that are NOT part of the Python Language (as defined in the Reference), such as reference counting, the GIL, &c, and other perfectly correct implementations of Python (such as Jython and IronPython) do NOT mimic these parts of CPython. So the PLR is closer to a specification, than any single implementation out of the several ones available can be. – Alex Martelli Jul 07 '09 at 22:08