On Aug 25, 2009, at 11:36 AM, Christopher Barker wrote:

> Dag Sverre Seljebotn wrote:
>>>> (Well, at least two people (myself and Robert) has opposed this  
>>>> being
>>>> the default (and not for reasons of backwards compatability!), so I
>>>> don't think we're at the stage where we can discuss deprecation  
>>>> just yet
>>>> :-))
>
> My point was that IF any backward incompatible changes were made,  
> there
> should be a reasonable deprecation procedure. Whether the change  
> should
> be made or not I'll leave to others -- what seems obvious to me could
> well be a function of my very limited use of Cython so far.
>
> What I do know is that the current behavior is a surprise to  
> newbies --
> a bit more documentation may be all we need.

Yes, thanks! Maybe there should even be a "common pitfalls" page for  
newbies.

I would be in favor of adding a compiler directive for this behavior,  
so that people who wanted "not None" everywhere could just stick it  
in one spot.

>>> If a faster "nonecheck" was added
>>> then "not None" would be a really redundant part of the language.
>
> Is that possible (well, not "faster", but fast enough not to  
> notice). My
> understanding of nonecheck is that a check has to be done on every
> object access (Or index, or...). In a tight loop that indexes  
> through a
> numpy array and does very little, that just doesn't seem practical. Or
> could you put the check outside the loop, but not at the beginning of
> the function?

With control flow analysis, one could statically eliminate almost all  
checks (in this example, if the argument were never assigned to, it  
would probably only need to be checked on the first access).

- Robert

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to