Nikita Nemkin, 07.06.2013 13:24: > Currently, conditional casts like <Name?>obj do not allow None values.
This might seem like an inconsistency, because <Name>obj does allow None values, just like a normal assignment. However, it's a special case that asks explicitly for the given type, so I think it's ok to be stricter. > I have found it useful to allow None sometimes. > The syntax could be one of: > * <Name or None?>obj > * <Name? or None>obj > * <Name??>obj > > Use case (without this feature): > > tn_obj = self.any.non_trivial.nullable.expression() > cdef TypeName tn > if tn_obj is not None: > tn = <TypeName?>tn_obj > ... > > Use case (with this feature): > > cdef TypeName tn = <TypeName or > None?>self.any.non_trivial.nullable.expression() > if tn is not None: > ... Why not just cdef TypeName tn = self.any.non_trivial.nullable.expression() if tn is not None: ... ? I.e. why do you need that cast in the first place? Stefan _______________________________________________ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel