Some conceptual doubts. In this code:
class A:
print "here in A"
print "flying 1"
def main():
print "here in main"
print "flying 2"
if __name__ == "__main__":
main()
print "another flying"
class B:
print "flying/here in B"
def __init__(self):
print "built in B"
The output is as follows:
here in A
flying 1
flying 2
here in main
another flying
flying/here in B
Questions:
1.- Why "here in A" gets printed when there's no an instance of A? (no warning/error informed)
2.- What's the scope of the "flying" things? they all get printed. I don't understand the parsing rules of Python.
3.- Same as 1.- why "here in B" gets printed when there's no an instance of B?
4.- Is there something like a default class constructor?
Sorry for the confusion but a 'similar code' would never compile in, for example, C++