This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: types.BoolType
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: gvanrossum, loewis, mfx, rhettinger
Priority: low Keywords: patch

Created on 2002-08-02 13:26 by mfx, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (5)
msg40770 - (view) Author: Markus F.X.J. Oberhumer (mfx) Date: 2002-08-02 13:26
I know that types is getting deprecated, but for
orthogonality we really should have a BoolType. Also,
IMHO we should _not_ have a BooleanType (or
DictionaryType), but that might break code.

Index: types.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/types.py,v
retrieving revision 1.29
diff -u -r1.29 types.py
--- types.py    14 Jun 2002 20:41:13 -0000      1.29
+++ types.py    2 Aug 2002 13:22:22 -0000
@@ -16,7 +16,7 @@
 IntType = int
 LongType = long
 FloatType = float
-BooleanType = bool
+BoolType = BooleanType = bool
 try:
     ComplexType = complex
 except NameError:
msg40771 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-08-04 08:59
Logged In: YES 
user_id=21627

What bug does this fix?
msg40772 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2002-09-12 14:43
Logged In: YES 
user_id=80475

I think the OP doesn't have a bugfix in mind,
he is trying to keep a parallel to the line:

DictType = DictionaryType = dict

DictionaryType had already been in out in Py2.1.
Tim added DictType to maintain the naming rule:
    type(obj).__name__ .title() + "Type"

Since we are not already locked into BooleanType,
a better solution would be:

-BooleanType = bool 
+BoolType = bool 

Guido, do you care if I make this change or is there a 
reason for keeping BooleanType?
msg40773 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-09-12 15:02
Logged In: YES 
user_id=21627

The requirement that 

getattr(types, X).__name__.title()+"Type" == X for all X in
dir(types) 
if endswith("Type")

is reasonable; the following types currently break that:

BooleanType (bool)
BuiltinFunctionType (builtin_function_or_method)
BuiltinMethodType (builtin_function_or_method)
ClassType (classobj)
DictProxyType (dictproxy)
DictionaryType (dict)
LambdaType (function)
MethodType (instancemethod)
NoneType (NoneType)
StringType (str)
UnboundMethodType (instancemethod)
XRangeType (xrange)

If it is desirable tha the predicate above holds, then I'd
encourage the following fix:
- produce a test case that tests the predicate
- provide a patch that makes the test pass.

It certainly needs to be taken into account that some names
are synonyms of others, so they can be removed, so the test
should deal with that (by accepting cases where the
canonical type name is in types); cases that only show case
problems (xrange, dictproxy) probably can also pass as-is.

If that property is not desirable, I again ask what the
problem is.

If BoolType is added (for whatever reason), I agree with
Raymond that removing BooleanType is sensible.


msg40774 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-09-12 15:04
Logged In: YES 
user_id=6380

I see no bug here.
History
Date User Action Args
2022-04-10 16:05:33adminsetgithub: 36968
2002-08-02 13:26:45mfxcreate