Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #103507
| From | Ethan Furman <ethan@stoneleaf.us> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: "from module import data; print(data)" vs "import module; print(module.data)" |
| Date | 2016-02-25 08:51 -0800 |
| Message-ID | <mailman.131.1456419044.20994.python-list@python.org> (permalink) |
| References | <mailman.111.1456362461.20994.python-list@python.org> <56ce7762$0$11100$c3e8da3@news.astraweb.com> <CAGGBd_pkpMt8b8ybwLkS_E5K2dKNfTX__du5+w20EGF9c0TJrQ@mail.gmail.com> <CAGGBd_p5jd_4w-VhuGk+b3Swe926BYuNMaWKPN15PAEEzMkH_Q@mail.gmail.com> |
On 02/25/2016 08:20 AM, Dan Stromberg wrote: > My intuition is telling me that "module.data; module.data.mutate()" > would be easier to monkey patch in a way that all modules will see. > Is that fair to say? It is fair to say that if you need to monkey-patch a module, you should import the module. :) You should also import it before anything else does to make sure your change is visible to all other code. -- ~Ethan~
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
"from module import data; print(data)" vs "import module; print(module.data)" Dan Stromberg <drsalists@gmail.com> - 2016-02-24 17:07 -0800
Re: "from module import data; print(data)" vs "import module; print(module.data)" Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-02-25 14:39 +1100
Re: "from module import data; print(data)" vs "import module; print(module.data)" Dan Stromberg <drsalists@gmail.com> - 2016-02-25 08:15 -0800
Re: "from module import data; print(data)" vs "import module; print(module.data)" Dan Stromberg <drsalists@gmail.com> - 2016-02-25 08:20 -0800
Re: "from module import data; print(data)" vs "import module; print(module.data)" Ethan Furman <ethan@stoneleaf.us> - 2016-02-25 08:35 -0800
Re: "from module import data; print(data)" vs "import module; print(module.data)" Ethan Furman <ethan@stoneleaf.us> - 2016-02-25 08:51 -0800
Re: "from module import data; print(data)" vs "import module; print(module.data)" sohcahtoa82@gmail.com - 2016-02-25 12:00 -0800
Re: "from module import data; print(data)" vs "import module; print(module.data)" Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-02-26 11:20 +1300
Re: "from module import data; print(data)" vs "import module; print(module.data)" Ben Finney <ben+python@benfinney.id.au> - 2016-02-26 10:38 +1100
Re: "from module import data; print(data)" vs "import module; print(module.data)" Steven D'Aprano <steve@pearwood.info> - 2016-02-26 11:40 +1100
Re: "from module import data; print(data)" vs "import module; print(module.data)" Ian Kelly <ian.g.kelly@gmail.com> - 2016-02-25 20:56 -0700
Re: "from module import data; print(data)" vs "import module; print(module.data)" Chris Angelico <rosuav@gmail.com> - 2016-02-26 15:11 +1100
Re: "from module import data; print(data)" vs "import module; print(module.data)" Ben Finney <ben+python@benfinney.id.au> - 2016-02-26 15:37 +1100
csiph-web