[BangPypers] Expressing meta-data about classes, methods, variables, parameters in python

Sidharth Kuruvila sidharth.kuruvila at gmail.com
Thu Apr 3 10:56:28 CEST 2008


H Heshan,

  Can you explain why you'd want to do this?

You can write

def f():
     print f.a

f.a = 4

f()

But I can't see you would want to do something like that. Maybe if you  
give a use case. Someone can come up with a solution.

Regards,
Sidharth

On Apr 3, 2008, at 2:03 PM, Heshan Suriyaarachchi wrote:

> Hi
> What I meant was a situation like this.
>
> In javascript I'm used to associating metadata with a function as
> follows.
>
> foo.bar = "foobar";
> function foo(){
> }
>
> What is the normal python practice to do this kind of a thing.
>
> Your help is very much appreciated.
>
> Thanks,
> Heshan Suriyaarachchi
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers



More information about the BangPypers mailing list