Seek Python Warning For A Multiply Defined Function
Q: is there a way to get Python to give me a warning when there is more than one definition of the same function, conflicting, etc. (I just wasted a bit of time making edits to two
Solution 1:
No, there's no way to get Python to behave this way natively. A function definition is essentially an assignment to a name, and names in Python can be reassigned at any time. Functions are not treated in any special way compared to integers, strings, etc.
Solution 2:
You can decorate all you functions and create a database of symbols and warn on redefinitions.
Post a Comment for "Seek Python Warning For A Multiply Defined Function"