Re: Way for see if dict has a key



Michele Petrazzo wrote:

Michele Petrazzo wrote:

key in dict
new syntax (2.3 and later).
So, following it, it can be used for the operations like len?

what's "it" in this sentence?

It, is the thought that the new 2.3 introduce.

support for "key in dictionary" form was added in 2.3 (in earlier versions,
"in" was only supported for sequences, not for mappings).

len(dictionary) works in all Python versions.

</F>



.



Relevant Pages

  • Re: status of Programming by Contract (PEP 316)?
    ... If you are suggesting that "programming by contract" is not ... Python by making Python more suitable for *some* mission-critical ... PEP 316 introduces new syntax for a limited use feature. ... which give all the syntax support you need and let you move the actual ...
    (comp.lang.python)
  • Re: Silly question
    ... Ever since Python 1.4, the slicing syntax has supported an optional ... tuple, and string sequence types have never supported this feature, ... started to support them from 2.3. ...
    (comp.lang.python)
  • Re: ANN: pyparsing 1.5.1 released
    ... (Python 3.0 uses syntax for catching exceptions that is incompatible ... so there is no way for me to support ... syntax, I could actually have pulled it off. ... it will make it easier to maintain the Py3 source ...
    (comp.lang.python)
  • Re: Indentation/whitespace
    ... > Is Python going to support s syntax the does not use it's infamous ... > Many people think Python's syntax makes sense. ... "support s syntax the does not use it's infamous whitespace rules" ...
    (comp.lang.python)
  • Re: ANN: pyparsing 1.5.1 released
    ... (Python 3.0 uses syntax for catching exceptions that is ... syntax, I could actually have pulled it off. ... (I'll still have to keep and support two different source ... You then maintain your 2.x code base adding another test where the ...
    (comp.lang.python)