[Types-sig] File Protocol Proposal
Paul Prescod
paulp@ActiveState.com
Wed, 14 Mar 2001 23:44:21 -0800
Tim Hochberg wrote:
>
> ...
>
> It's possible that this has changed, but according so section 2.1.1 of the
> Library Reference, everything is a boolean type! Or am I missing something.
That's true. It's also true that boolean functions in Python basically
always return 1 or 0 so there are really two different conventions at
work...
> The simple way is to just use union type. I called this composite in my
> orginal proposal, but that may be bad terminology. Anyway, the following
> should work:
>
> def weeble(wobble : UnionOf(NoneType, String)):
> # ....
Agreed. This is the right way.
> If we forced typecheck objects to all inherit from a common base class, it
> would also be pretty easy to write this as:
>
> def weeble(wobble : NoneType | String):
> # ....
Agreed on this too. But I was going to use the "or" keyword if at all
possible. I admit that the pipe symbol is more mathematically
conventional but "or" is more, er, English.
--
Take a recipe. Leave a recipe.
Python Cookbook! http://www.activestate.com/pythoncookbook