Shadow Detection?

  • Thread starter Michael Yanowitz
  • Start date
M

Michael Yanowitz

Hello:

Many times, people are warning things like
"Don't use 'str' as a variable name as it will shadow the
built in str function."
Is there some way to determine if a string is already
defined in some higher scope?
Maybe something like
<code>

if isdefined ('str'):
print 'str is already defined, please choose another name'

</code>

If not, would it be easy to write this?

Thanks in advance:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,294
Messages
2,571,511
Members
48,213
Latest member
DonnellTol

Latest Threads

Top