On Sat, Sep 20, 2014 at 3:20 PM, Clayton Kirkwood <c...@godblessthe.us> wrote: > I’m ramping slowly unfortunately. How does one go about knowing which module > to import to make certain functions work? I have a read() that fails because > there is no definition for it.
Specific details may help here. Can you tell us more? What are you trying to do? If you are seeing error messages, please copy exact error message content and present it. Error messages have more than one bit of information: they usually encode some information that folks here can try to interpret. > Secondarily, why can you import a module without it importing all of its > daughters? The act of importing a module is "recursive": if you import a module, and that module itself has import statements, then Python will do the import of the child modules too. And so forth. (You might imagine a system where the "main" module must do all this linkage by itself, rather than do this recursive walk. And there are systems that do work like this! See: https://talks.golang.org/2012/splash.article for Rob Pike's discussion on the Plan 9 compiler, which worked this way. But Python does not do this.) > And why do you have to use a ‘for in to import submodule’, why > not ’import module.sub’? If I'm not mistaken, you _can_ do this. Can you point us to a source where it says you can't? (There are particular style guidelines from certain organizations that prohibit this kind of import, but that prohibition is by convention. That is, it's not because the language disallows it, but because it doesn't fit with the house coding style.) > Lastly, in some tutorials and else-sourced docs certain lines have a ‘;’ at > the end. This seems to be most often with ‘opens’ and ‘fopen’ kind of calls. Huh. Can you point to a reference? Note that third-party documentation (and official documentation!) might be buggy or weird. :P If you can point us to an example, maybe one of us can investigate what's going on there. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor