Re: A couple of questions about pyrex

Yingjie Lan <[email protected]> Tue, 12 May 2009 15:46:26 -0700 (PDT)
Newsgroups gmane.comp.python.pyrex
Message-ID <[email protected]>
--- On Tue, 5/12/09, Stefan Behnel <[email protected]> wrote:

> From: Stefan Behnel <[email protected]>
> Subject: Re: [Pyrex] A couple of questions about pyrex
> To: [email protected]
> Cc: [email protected]
> Date: Tuesday, May 12, 2009, 7:50 PM
> Yingjie Lan wrote:
> > I would say that
> > it seems to me pyrex decides on each statement whether
> > to treat it as pythonic or native (c/c++). Then can we
> > say that we make this distinction between 'cdef
> class' and
> > 'class' by checking if the class body contains
> any
> > statement treated as native?
> 
> No, because this will not work then:
> 
>     class MyClass: pass
> 
>     MyClass.some_attribute = 1
> 

I am not quite sure about the purpose of this example,
but let me proceed with some tentative comments.

According to the criterion I have given, the definition
of MyClass has only one line, and no native statements
are involved, so it should be judged as a pure pythonic
class (If the definition does contain some native statements,
this class would be equivalent to 'cdef class', and still
visible to python as of current situation).

That being said, the second line of statement can also be 
treated as a pure pythonic statement. 

What do you think?

yingjie