Re: import keyword behaviour - performance impact if used multiple times?
Nick Coghlan wrote: > > Is > > this something to do with system modules being singletons? > > They aren't singletons in the GoF design pattern sense. However, Python's import > machinery operates in such a way that it takes effort to get multiple version of > the same module into memory at the same time (it *can* be done, but you have to > work at it). Given that this is exactly what I want, how can you do it? -- http://mail.python.org/mailman/listinfo/python-list
Re: sum and strings
Fredrik Lundh wrote: > do you often write programs that "sums" various kinds of data types, and > for which performance issues are irrelevant? > > or are you just stuck in a "I have this idea" loop? Maybe he's just insisting on the principle of least surprise? Personally, I'd rather expect sum() to work for strings and Python to issue a warning instead of raising a type error. That warning might also be appropriate when using sum() on other builtin sequence types. -- http://mail.python.org/mailman/listinfo/python-list