can it be shorter?
Jean-Michel Pichavant
jeanmichel at sequans.com
Mon Jun 8 10:50:43 EDT 2009
Aaron Brady wrote:
> Shorter is always better.
>
> url+= { '/': '' }.get( url[ -1 ], '/' )
Why bother with spaces or 3 letter-wide token, check this :o) :
x+={'/':''}.get(x[-1],'/')
Apart from joking, the following proposed solution is by **far** the one
I prefer
> if not url.endswith('/'):
> url += '/'
Maybe not the shorter, but the most concise and clear to me.
Jean-Michel
More information about the Python-list
mailing list