D
Dave
Anyone familiar with PHP? I'm trying to make a translation. In PHP you
can get the current object's name by going like this:
get_class(item) == 'ClassName'
I've tried type(item), but since I can't be sure if I'll be in __main__
or as a child object, I can't guarantee what that value will return, so
I can't just manipulate that value as a string.
Is there a simple way to get the current object's name? You would think
__name__ would work, right? It doesn't.
Now here's another, similar one:
You can reference an object's parent object directly in PHP, like so:
//note the charming use of semi-colon. isn't it cute?
parent::__construct(
$stuffInAWeirdSyntaxThatDoesntMeanAnythingWhenYouReadIt);
I'd like to avoid passing a reference to an object's parent in
__init__, but is there a built in way in Python to say "You, Parent
Object, do ...stuff!"
Thanks!
can get the current object's name by going like this:
get_class(item) == 'ClassName'
I've tried type(item), but since I can't be sure if I'll be in __main__
or as a child object, I can't guarantee what that value will return, so
I can't just manipulate that value as a string.
Is there a simple way to get the current object's name? You would think
__name__ would work, right? It doesn't.
Now here's another, similar one:
You can reference an object's parent object directly in PHP, like so:
//note the charming use of semi-colon. isn't it cute?
parent::__construct(
$stuffInAWeirdSyntaxThatDoesntMeanAnythingWhenYouReadIt);
I'd like to avoid passing a reference to an object's parent in
__init__, but is there a built in way in Python to say "You, Parent
Object, do ...stuff!"
Thanks!