You can't. Creation of an object is totally independent from assigning a reference to that object to some named variable.
foo().doSomething()
— an instance of foo is not bound to any name and probably gets garbage collected right after the call.
a[1].moo = foo()
— what's the name, again?
a = foo()
b = a # is name of foo 'a' or 'b'? both point to the same instance
a = None # but 'a' is gone, so now the name is 'b'?..
OTOH, passing a name to the constructor is painless:
my_foos = {}
for name in ('a', 'b', 'c'):
my_foos[name] = foo(name)
You may even rudely assign an instance attribute, if you won't change the constructor for some reason:
my_foos = {}
for name in ('a', 'b', 'c'):
a_foo = foo()
a_foo.my_mame = name # here
my_foos[name] = a_foo
And if you're into the dark side, you finally can add your foos to global namespace:
globals().update(my_foos)
— now you have global names a
, b
and c
, each referring to an aptly-named foo.
And, for foo's sake, name your classes with a capital initial letter :)