[Tkinter-discuss] (no subject)

Michael Lange klappnase at web.de
Sun May 31 11:39:28 CEST 2015


Hi,

On Sun, 31 May 2015 09:21:20 +0000
Vasilis Vlachoudis <Vasilis.Vlachoudis at cern.ch> wrote:

> Hi All,
> 
> my question is not tkinter related but I could not find any help on that
> I am compiling a list of commands for faster access in my application.
> How can I check the type of a compiled object with isinstance()?
> 
> >>> c = compile("x+y","","eval")
> 
> >>> isinstance(c,code)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> NameError: name 'code' is not defined
> 
> While type(c) gives a "code" object?
> 
> >>> c
> <code object <module> at 0xb74a5cc8, file "", line 1>
> 
> >>> type(c)
> <type 'code'>

Maybe you will have to use

    isinstance(c, types.CodeType)

instead.

Regards

Michael

.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

The sooner our happiness together begins, the longer it will last.
		-- Miramanee, "The Paradise Syndrome", stardate 4842.6


More information about the Tkinter-discuss mailing list