Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types.BoolType #36968

Closed
mfx mannequin opened this issue Aug 2, 2002 · 5 comments
Closed

types.BoolType #36968

mfx mannequin opened this issue Aug 2, 2002 · 5 comments
Assignees
Labels
stdlib Python modules in the Lib dir

Comments

@mfx
Copy link
Mannequin

mfx mannequin commented Aug 2, 2002

BPO 590119
Nosy @gvanrossum, @loewis, @rhettinger

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/gvanrossum'
closed_at = <Date 2002-09-12.15:04:06.000>
created_at = <Date 2002-08-02.13:26:45.000>
labels = ['library']
title = 'types.BoolType'
updated_at = <Date 2002-09-12.15:04:06.000>
user = 'https://bugs.python.org/mfx'

bugs.python.org fields:

activity = <Date 2002-09-12.15:04:06.000>
actor = 'gvanrossum'
assignee = 'gvanrossum'
closed = True
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2002-08-02.13:26:45.000>
creator = 'mfx'
dependencies = []
files = []
hgrepos = []
issue_num = 590119
keywords = ['patch']
message_count = 5.0
messages = ['40770', '40771', '40772', '40773', '40774']
nosy_count = 4.0
nosy_names = ['gvanrossum', 'loewis', 'rhettinger', 'mfx']
pr_nums = []
priority = 'low'
resolution = 'rejected'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue590119'
versions = ['Python 2.3']

@mfx
Copy link
Mannequin Author

mfx mannequin commented Aug 2, 2002

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:

@mfx mfx mannequin closed this as completed Aug 2, 2002
@mfx mfx mannequin assigned gvanrossum Aug 2, 2002
@mfx mfx mannequin added the stdlib Python modules in the Lib dir label Aug 2, 2002
@mfx mfx mannequin closed this as completed Aug 2, 2002
@mfx mfx mannequin assigned gvanrossum Aug 2, 2002
@mfx mfx mannequin added the stdlib Python modules in the Lib dir label Aug 2, 2002
@loewis
Copy link
Mannequin

loewis mannequin commented Aug 4, 2002

Logged In: YES
user_id=21627

What bug does this fix?

@rhettinger
Copy link
Contributor

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?

@loewis
Copy link
Mannequin

loewis mannequin commented Sep 12, 2002

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.

@gvanrossum
Copy link
Member

Logged In: YES
user_id=6380

I see no bug here.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir
Projects
None yet
Development

No branches or pull requests

2 participants