79 chars or more?

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Wed Aug 18 13:18:06 CEST 2010


In message <4C6A9C72.4040708 at sschwarzer.net>, Stefan Schwarzer wrote:

>           self.expiration_date = translate_date(
>             find(response, 'MPNExpirationDate').text,
>             '%Y-%m-%d',
>             '%m%d%Y')

Might I suggest (guessing at the argument keywords here) :

    self.expiration_date = translate_date \
      (
        TheText = find(response, 'MPNExpirationDate').text,
        ToFormat ='%Y-%m-%d',
        FromFormat ='%m%d%Y'
      )

Presumably FromFormat should be localizable, rather than hard-coded.

See, that’s the kind of thing you notice when you think about the code in 
this way.



More information about the Python-list mailing list