#27: Move to Zope 2.7.x + Python 2.3.x
- Contents
- Proposed by
- tiran
- Proposal type
- Architecture
- State
- rejected
Motivation
Moving to Zope 2.7 and Python 2.3.3 will increase the quality and readability of the code.
Examples:
- return 1 is often used to return a value that's evaluted as true. But maybe the number 1 is meant and not the a true value. Using True and False instead of 1 and 0 or None is easier to understand and a better way of coding
- not not foo or some complex if/else stuff is often used to evalute the boolean value of a var. Using the bool() is better to read
Proposal
Move Plone to use features that weren't available under Zope 2.6 and Python 2.1. Remove deprecated stuff and dependencies on old stuff and clean up some other bad or circumstantial code.
Implementation
- replace return 1 and return 0 resp. return None by the True and False
- replace not not or something else by bool()
- try to use list comprehensives [ foo for foo in bar if foo ] instead of for in: ... list.append()
- replace type(v) is type(()) etc. by type(v) is TupleType. Either STRING_TYPES = (UnicodeType, StringType) + type(s) in STRING_TYPES or isinstance(s, basestring) for strings
- replace comparison like if val == None by either if val if it's only a bool comparsion or if val is None if we really want to know wether val is None (might cause some problems)
to be continued
code reorg
This is evolutionary. It will happen in 2.1.1 the no XXX release and can continue on another branch while 2.2 is being developed.