- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Do you think declarations within Python class are equivalent to those within __init__ method?
Declarations anywhere in the class(other than in __init__) and declarations in the __init__method are not the same. The following code shows this to be true.
import sys class foo(): print 'within class' def __init__(self): print 'within init' def do_smthng(self): print 'do something' def main(): f=foo() f.do_smthng() return 0 if __name__ == '__main__': sys.exit( main() )
within class within init do something
- What do you think when you are alone?
- Do you think Python Dictionary is really Mutable?
- CSS :focus-within pseudo class
- Do you think a Python dictionary is thread safe?
- Why do you think tuple is an immutable in Python?
- Do you think heart break makes you a better person?
- How do you think apps have changed learning?
- Do you think garbage collector can track all the Python objects?
- Why do you think privatization of education is bad?
- Do you think robots will replace jobs in near future?
- Do you think homeschooling is better than available schools around?
- Do you think a poet can also be a lyricist?
- How to access Python objects within objects in Python?