Checking whether an object has been created.
Fredrik Lundh
effbot at telia.com
Tue Oct 17 12:58:36 EDT 2000
Olivier CARRERE wrote:
> has anyone a clean method to check if an object has been instanciated?
>
> What I wish to do is to create an object if it hasn't been made before,
> ie something like this :
>
> if not exists(objectReference):
> objectReference=Object()
> # perform stuff on objectReference
objectReference = None
...
if objectReference is None:
objectReference = Object()
...
</F>
More information about the Python-list
mailing list