[New-bugs-announce] [issue33574] Conversion of Number to String(str(number))

Khalid Moh'd. report at bugs.python.org
Fri May 18 15:30:27 EDT 2018


New submission from Khalid Moh'd. <khld.163 at gmail.com>:

Consider conversion of an integer to string:
a=5 #number
str #outputs <class 'str'>
str(a) #works perfectly and prints '5'

Now, consider:
str="Hello World" #reads the string
str #prints "Hello World"
str(5) #gives an error


Interpreter considers variable str before parenthesis not str from <class 'str'>
There must be a way to distinguish user defined variable str and conversion operation str().

----------
messages: 317049
nosy: Khalid Moh'd.
priority: normal
severity: normal
status: open
title: Conversion of Number to String(str(number))
type: compile error
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33574>
_______________________________________


More information about the New-bugs-announce mailing list