[Tutor] Strange issue w/ Python shell 3.0.0.

Steven D'Aprano steve at pearwood.info
Sat Nov 23 19:07:40 CET 2013


On Sat, Nov 23, 2013 at 06:44:43PM +0100, Rafael Knuth wrote:
> Hej there,
> 
> I noticed that sometimes when I do lots of modifications within a
> program, I get runtime errors even if the program is "clean". I
> realized that first time when I copy and pasted a program into a new
> window - it miraculously ran without any problems. Although it was
> exactly the same program that caused problems in the old window.
> 
> Stupid rookie question: Does Python shell have a cache or so? And if
> that's the case - how do I empty it?

???

Your question unfortunately doesn't make a lot of sense to me. A cache 
for what? I suspect you are operating under an assumption which seems to 
make sense to you, but isn't actually correct.

I think, if I were to answer your literal question, I would say "No", 
the Python shell doesn't have a cache. But the Python compiler has all 
sorts of caches, regardless of whether it is running in the shell or 
not. It caches modules. It caches all sorts of objects. But this 
shouldn't be a problem under normal circumstances. My guess is that it 
isn't a cache that is causing problems, but a misinterpretation of what 
you are seeing. But I could be wrong.

Can you explain in detail what you mean by "when I do lots of 
modifications within a program", "runtime errors", and especially what 
you mean by calling the program "clean"?

How are you making modifications to the program? How then do you see the 
errors?

... let me think... are you using reload()? Because that doesn't work 
like you might be thinking. When you reload a module, it doesn't affect 
objects which are already in use. Likewise with importing. But since I 
don't know how you are making modifications, or what you are doing that 
generates runtime errors, I can't tell what you're doing wrong.

Oh, wait, I see you are using Python 3.0. Don't. Python 3.0 is not 
supported because it is buggy. You should use 3.1, or better still, 3.3. 
Python 3.3 is much better than 3.1 or 3.2, and 3.0 is buggy and slow.


-- 
Steven


More information about the Tutor mailing list