type lookuperror

Steve D'Aprano steve+python at pearwood.info
Fri Aug 19 02:10:51 EDT 2016


On Fri, 19 Aug 2016 11:43 am, meInvent bbird wrote:

> a company which write siri in iphone, has already wrote a program
> which can write program itself after the program talks with users
> 
> it seems possible,

You are asking about self-modifying code, which is a terrible idea.

Siri uses machine learning, which is a difference concept.


> i find many default function when using dir(function) to see
> so i guess that these default functions in openstack have its existence
> reason which i guess for program itself.

I'm afraid I don't understand the question.


> how to append a function or code in runtime in python?

Just write the function, and then call it.

If you write a function:

def foo(x):
   return x + 1


now you can use foo() like any other function, len(), str(), etc.


Have you done the Python tutorial? It sounds like you should consider doing
the tutorial.

For version 3:

https://docs.python.org/3/tutorial/

For version 2:

https://docs.python.org/2/tutorial/





-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list