(name, initial)
return property(getter, setter, deleter)
Define a property attribute that proxies for top/right/bottom/left alternatives.
Define a property attribute that proxies for top/right/bottom/left alternatives.
Define a property attribute that proxies for top / right / bottom / left alternatives .
def directional_property(name, initial):
    "Define a property attribute that proxies for top/right/bottom/left alternatives."
    def getter(self):
        return (
            getattr(self, name % '_top', initial),
            getattr(self, name % '_right', initial),
            getattr(self, name % '_bottom', initial),
            getattr(self, name % '_left', initial),
        )

    def setter(self, value):
        if isinstance(value, tuple):
            if len(value) == 4:
                setattr(self, name % '_top', value[0])
                setattr(self, name % '_right', value[1])
                setattr(self, name % '_bottom', value[2])
                setattr(self, name % '_left', value[3])
            elif len(value) == 3:
                setattr(self, name % '_top', value[0])
                setattr(self, name % '_right', value[1])
                setattr(self, name % '_bottom', value[2])
                setattr(self, name % '_left', value[1])
            elif len(value) == 2:
                setattr(self, name % '_top', value[0])
                setattr(self, name % '_right', value[1])
                setattr(self, name % '_bottom', value[0])
                setattr(self, name % '_left', value[1])
            elif len(value) == 1:
                setattr(self, name % '_top', value[0])
                setattr(self, name % '_right', value[0])
                setattr(self, name % '_bottom', value[0])
                setattr(self, name % '_left', value[0])
            else:
                raise ValueError("Invalid value for '%s'; value must be an number, or a 1-4 tuple." % (name % ''))
        else:
            setattr(self, name % '_top', value)
            setattr(self, name % '_right', value)
            setattr(self, name % '_bottom', value)
            setattr(self, name % '_left', value)

    def deleter(self):
        delattr(self, name % '_top')
        delattr(self, name % '_right')
        delattr(self, name % '_bottom')
        delattr(self, name % '_left')

    _CSS_PROPERTIES.add(name % '')
    _CSS_PROPERTIES.add(name % '_top')
    _CSS_PROPERTIES.add(name % '_right')
    _CSS_PROPERTIES.add(name % '_bottom')
    _CSS_PROPERTIES.add(name % '_left')
    return property(getter, setter, deleter)
def directional_property ( name , initial ) : def getter ( self ) : return ( getattr ( self , name % '_top' , initial ) , getattr ( self , name % '_right' , initial ) , getattr ( self , name % '_bottom' , initial ) , getattr ( self , name % '_left' , initial ) , ) def setter ( self , value ) : if isinstance ( value , tuple ) : if len ( value ) == 4 : setattr ( self , name % '_top' , value [ 0 ] ) setattr ( self , name % '_right' , value [ 1 ] ) setattr ( self , name % '_bottom' , value [ 2 ] ) setattr ( self , name % '_left' , value [ 3 ] ) elif len ( value ) == 3 : setattr ( self , name % '_top' , value [ 0 ] ) setattr ( self , name % '_right' , value [ 1 ] ) setattr ( self , name % '_bottom' , value [ 2 ] ) setattr ( self , name % '_left' , value [ 1 ] ) elif len ( value ) == 2 : setattr ( self , name % '_top' , value [ 0 ] ) setattr ( self , name % '_right' , value [ 1 ] ) setattr ( self , name % '_bottom' , value [ 0 ] ) setattr ( self , name % '_left' , value [ 1 ] ) elif len ( value ) == 1 : setattr ( self , name % '_top' , value [ 0 ] ) setattr ( self , name % '_right' , value [ 0 ] ) setattr ( self , name % '_bottom' , value [ 0 ] ) setattr ( self , name % '_left' , value [ 0 ] ) else : raise ValueError ( "Invalid value for '%s'; value must be an number, or a 1-4 tuple." % ( name % '' ) ) else : setattr ( self , name % '_top' , value ) setattr ( self , name % '_right' , value ) setattr ( self , name % '_bottom' , value ) setattr ( self , name % '_left' , value ) def deleter ( self ) : delattr ( self , name % '_top' ) delattr ( self , name % '_right' ) delattr ( self , name % '_bottom' ) delattr ( self , name % '_left' ) _CSS_PROPERTIES . add ( name % '' ) _CSS_PROPERTIES . add ( name % '_top' ) _CSS_PROPERTIES . add ( name % '_right' ) _CSS_PROPERTIES . add ( name % '_bottom' ) _CSS_PROPERTIES . add ( name % '_left' ) return property ( getter , setter , deleter )