A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-November/075413.html below:

[Python-Dev] removing the new and types modules

[Python-Dev] removing the new and types modules [Python-Dev] removing the new and types modulesSteven Bethard steven.bethard at gmail.com
Wed Nov 28 23:38:11 CET 2007
On Nov 28, 2007 2:23 PM,  <henning.vonbargen at arcor.de> wrote:
> Sorry if this is a dumb question, but are there actually good reasons to remove "types"?
> IMHO the types module helps keeping code readable.
> For example
> "if type(obj) == FloatType"
> is just more readable than
> "if type(obj) == type(1.0)".

But you should really be writing::

    if isinstance(obj, float)

for most situations, and::

    if type(obj) == float

if you really *have* to check the exact type.

STeVe
-- 
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
        --- Bucky Katt, Get Fuzzy
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4