Python for a PHP user, how do i...?

rw2 richw at
Tue May 15 12:58:54 EDT 2001

In article <9dri66$202$1 at>, "Eduardo Dominguez"
<lalo_dominguez at> wrote:

> Disclaimer: I am not trying to compare, promote or bash PHP nor Python.
> I want to learn Python and I am curious.
> I am starting with Python, and I like it so far. But I still miss some
> features from PHP. THis might be in python, but I havent found them yet.
> If anyone can help me... :)
> In PHP I can call "variable" functions like:
>   $varName = "PrintDate";
>   $varName(); // calls function "PrintDate"
> Also, I can have variable variables, like:
>   $tempVar = "myVar";
>   $$tempVar = 1;
>   echo $myVar; // echoes "1"
> Can I get metadata of a class ?? for example, the name, my parents name,
> etc ?
> One thing I _really_ miss is an anotated manual. PHP has a great one and
> that really helps people start with PHP.

I like the annotated manual, but find the Python one completely
sufficient.  The PHP one seems to *need* the annotations a bit more
because the base level doc isn't quite as good (IMHO).

> How can I do this in Python ?

You can wrap this in a function to make it a bit less clumsy, but you can do
something close.

>>> spam="print 'eggs'"
>>> eval(compile(spam,'<string>','exec'))


I currently am looking for a consulting position requiring Python (or C++
or Java)

More information about the Python-list mailing list