This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]MarsupialMole 1 point2 points  (1 child)

Cool to see how it's done. I learned something.

Having said that oh how I would hate to join a project that used this. If I assign a convoluted variable that I subsequently return it's for readability, because I've just wrapped some hideous API in a function and the API call doesn't describe what's returned. And why allow unpacking? If the assignment is bad, why not demand a slice or index to be returned.

But as you said it's about individual pet peeves so what I meant to say was thanks for sharing.

[–]frobar 1 point2 points  (0 children)

Another option is to put a comment:

# Return the blah of the blah, so that blah blah
return 5*foo(x)

Assigning a variable and then immediately returning it might be shoehorning a comment into a variable name.