Is this pythonic?

Baby Coder babycode at gmail.com
Tue Jan 27 14:39:25 EST 2009


On 18 déc 2008, 13:51, Jason Scheirer <jason.schei... at gmail.com>
wrote:

> I'd say it's fine but breaking up the statement once or twice is a
> good idea just because if one of the function calls in this nested
> thing throws an exception, a smaller statement with fewer calls makes
> for a far more readable traceback. And I hope that this whole
> statement all lives inside of a method in the same x class, or is a
> higher-level class that makes use of this behavior? If not, you may
> want to consider doing so.
>
> class X(object):
>   @property
>   def todays_filepattern(self):
>       return self.match_filename(
>               self.determine_filename_pattern(
>                    datetime.datetime.now()))
>   def validate_todays_files(self):
>      return self.validate_output(self.find_text
> (self.todays_filepattern))

Thanks for this lesson in application design. Just what I was looking
for.



More information about the Python-list mailing list