¡@

Home 

python Programming Glossary: my_number

Sub-classing float type in Python, fails to catch exception in __init__()

http://stackoverflow.com/questions/1936457/sub-classing-float-type-in-python-fails-to-catch-exception-in-init

float object In my code I'm using float self . class My_Number float def __init__ self float_string try super My_Number self.. My_Number float def __init__ self float_string try super My_Number self .__init__ float_string except TypeError ValueError raise.. str int float self else return str round float self 2 n My_Number '0.54353' print n 0.54 n My_Number '5.0' print n 5 n My_Number..