Phillip J. Eby wrote: > At 02:07 PM 5/24/2005 -0700, Heikki Toivonen wrote: > >> > +from datetime import datetime >> >> This is just a general note about from vs import. I think we determined >> that import is better, so things like this would be better to write: >> >> import datetime.datetime as datetime > > Since these two statements do the same thing, I don't understand how/why > one could be better, unless you mean readability. However, from a
I think there are subtle differences. I would have to check, but I believe one difference is that with import doing reload() would work as expected, but not so with from. In other words, doing: from datetime import datetime # then sometime later call reload(datetime) would be slightly different than: import datetime.datetime as datetime # then sometime later call reload(datetime) We haven't been rigorous with enforcing the convention though. And I don't know if we are actually using reload(), or if we are even planning on using it, or if it would actually be a bad idea to even try use it. -- Heikki Toivonen
signature.asc
Description: OpenPGP digital signature
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Open Source Applications Foundation "Dev" mailing list http://lists.osafoundation.org/mailman/listinfo/dev
