[BangPypers] Need Help : Setting Floating Precision Point as 2 in Python

Noufal Ibrahim noufal at gmail.com
Tue Aug 24 18:06:58 CEST 2010


renuka prasad <renukaprasadb at gmail.com> writes:


[...]

> what is the reason for the previous problem? can you elaborate a
> bit.. What my understanding is that the typical code and value , that
> is what we code is not the same as its value
>
> but would like to know more.. can you explain a bit?

[...]


It's generally bad form in Python to say, for example

   d.has_key(foo)

rather than

   foo in d

The former assumes the "has_key" method (commonly there when d is a
dictionary) and so doesn't work for other containers like lists, tuples,
sets.

In short, if you're going to do addition, all you should be worried
about is whether the operands support the addition protocol. You
shouldn't care about (and shouldn't definitely not check for) the types
of the operands which is what, from Arul's comment, the VCS module seems
to be doing.


-- 


More information about the BangPypers mailing list