+ 1

What if you declare a variable with a default function name?

I have figured that when you declare a variable with a default function's name, then you have 2 options if you want to use that function later: 1) delete the variable. After deleting the variable there is no need to define the function, as it is automatically restored; 2) define a new function that will do the same as the previous one. This way you can have both your variable and function Example: range = 7 print (6*range) del range num = range (1,5) print (2*list(num)[0]) *Output: 42 2 P.S. this is based on trial and error. Please comment if you have anything to add or if you can suggest better alternatives.

19th May 2017, 11:40 AM
Hakob Baghdasaryan
Hakob Baghdasaryan - avatar
1 Réponse
+ 1
It screws things up. Best to avoid this whenever you realize it. Another tip, don't name your .py files with module names.. for instance if you have a file called random.py and you try to import random, it will import your random.py instead of the random module
19th May 2017, 1:02 PM
LordHill
LordHill - avatar