[python-users] Schönes Muster

Klaus Blindert klaus.blindert at googlemail.com
Mi Feb 17 19:44:42 CET 2010


Hallo,

ich bin letztens über ein schönes Muster (Pattern)
gestolpert. Vergleicht mal die beiden if-Bedingungen.

def save(self, *args, **kwargs):
    # Crop the image, provided x/y/w/h are available
    if self.x is not None and self.y is not None \
            and self.w is not None and self.h is not None:
        original = PIL.open(self.source.image)

def save(self, *args, **kwargs):
    # Crop the image, provided x/y/w/h are available
    if None not in (self.x, self.y, self.w, self.h):
        original = PIL.open(self.source.image)

Ist mir so noch nicht aufgefallen und hab mich doch sehr
gefreut =).

-klaus




Mehr Informationen über die Mailingliste python-users