[Pyrex] A couple of questions about pyrex

Yingjie Lan lanyjie at yahoo.com
Wed May 13 00:46:26 CEST 2009


--- On Tue, 5/12/09, Stefan Behnel <stefan_ml at behnel.de> wrote:

> From: Stefan Behnel <stefan_ml at behnel.de>
> Subject: Re: [Pyrex] A couple of questions about pyrex
> To: lanyjie at yahoo.com
> Cc: pyrex at lists.copyleft.no
> 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


      



More information about the Pyrex mailing list