Greg Ewing wrote: > Cesare Di Mauro wrote: > >> The same happens with: >> >> from Tkinter import * >> >> which is a fair common instruction... > > ...and which should *not* be used in most cases, for > the same reason. > > All those tutorials that start out with 'from something > import *' are doing a lot of harm to the impressionable > minds of new programmers, IMO. > Yeah, the only remotely legitimate usage of it that I am aware of is for modules with a hybrid implementation where the public Python module does a "from _native_module import *" to get the rest of the implementation. And even that is somewhat arguable. To go back to Cesare's most recent example: t = ScrolledText.ScrolledText(master, width=60, height=37) t.insert(Tkinter.END, self.log.getText()) t.configure(state=Tkinter.DISABLED) t.see(Tkinter.END) t.pack(fill=Tkinter.BOTH) can look like: tk = Tkinter: st = ScrolledText.ScrolledText(master, width=60, height=37): st.insert(tk.END, self.log.getText()) st.configure(state=tk.DISABLED) st.see(tk.END) st.pack(fill=tk.BOTH) Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4