On Sun, Dec 27, 2015 at 3:05 PM, <jf...@ms4.hinet.net> wrote: >> Python's flexibility and simplicity are a huge part of why I love the >> language so much. > > simplicity? Maybe because you are soooo familiar with Python. It's not to me, > at least at this moment. Please see my next question follows. >
I define "simplicity" in terms of the number and complexity of the rules you have to keep in your head. It's not necessarily the best thing to do; for instance, a C-style #include directive is *extremely* simple (it is literally "drop the file contents in at this location"), but I prefer Python's semantics. On the other hand, PHP's include directive is *not* simple; in many ways it behaves like C's #include, but it can't be used inside class definitions, and if used in a function, some of what it does is at top level and some is inside the function. Python's rules for imports (whether they're "import X" or "from X import Y") include a somewhat complicated definition of search path, but ultimately, it's a matter of hunting down a module and executing it (all of it) in its own namespace, and then giving you a reference to sys.modules["X"] (or sys.modules["X"].Y for a from-import). ChrisA -- https://mail.python.org/mailman/listinfo/python-list