"Greg McIntyre" <[EMAIL PROTECTED]> writes:
>   while c = f.read(1):
>       # ...
> 
> I couldn't find any general PEPs along these lines, only specific ones
> (e.g. 308 re. an if-then-else expression).

I often end up doing something like this:

   class foo:
      def set(self, x):
          self.x = x
          return x
   c = foo()

   while c.set(f.read(1)):
     # do stuff with c.x

In that file example, it's too much nuisance, but when you're
comparing some input against a series of regexps and you'd otherwise
need a multi-line construction for each one, this method comes in
quite handy.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to