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/2002-May/024805.html below:

[Python-Dev] Other library code transformations

[Python-Dev] Other library code transformations [Python-Dev] Other library code transformationsRaymond Hettinger python@rcn.com
Fri, 31 May 2002 12:07:32 -0400
While we're eliminating uses of the string and types modules, how about
other code clean-ups and modernization:

d.has_key(k) --> k in d
if k in d.keys() --> if k in d
obj.__dict__ --> vars(obj)
class X(UserList) --> class X(list)
class X(UserDict) --> class X(dict)  # and remove .data references
0L --> 0
1L --> 1
lambda x, y=y: fun(x,y) --> lambda x: fun(x,y)
x = y.__class__ --> x is type(y)
== None --> is None
if item in astring --> if item in adict


This is from my own list of code updates, the python library already in
better shape.


Raymond Hettinger










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