Function passed as an argument returns none

Chris Angelico rosuav at
Fri Oct 3 04:08:36 CEST 2014

On Fri, Oct 3, 2014 at 11:49 AM, Rustom Mody <rustompmody at> wrote:
> Ok so there is no conventional attribution line because it was
> cut-pasted from elsewhere in the thread but there is a clear
> and unequivocal prefix of "OP subject as well as post".

When I respond to this part...

> Why/how should there be any ambiguity that that is Shiva??

... and then to this, the normal assumption is that, since both are at
the same indentation level, they're both covered by the same heading
line. Compare:

def rustom():
    yield "... there is no conventional ..."
    yield "... elsewhere in the thread ..."
    yield "... unequivocal ..."

# I respond to this...

    yield "... any ambiguity ..."

# Is there any expectation that the above line of code isn't part of
the same function?

And there IS an unequivocal prefix of "OP subject as well as post". It
looks like this:

On Thu, Oct 2, 2014 at 8:37 AM, Shiva
<shivaji_tn at> wrote:
> Any idea why 'None' is getting passed even though calling the donuts(4)
> alone returns the expected value?

And there's even an unambiguous way to indicate that you're responding
to the original poster, but not the original post. Watch!

On Thu, Oct 2, 2014 at 6:46 PM, Shiva
<shivaji_tn at> wrote:
> * return 'Number of donuts: ',count    returns a tuple like:
> ('Number of donuts: ',9)

I can correctly attribute every piece that I respond to. It's really
not hard. In this particular case, I opened two additional replies,
and copied and pasted the bits I want into this reply. Some people
short-cut it, when they're responding to separate posts, and just do
something like this:

[Rustom Mode]
> Are you for real Steven??

Complete with a demonstration of what happens all too often when
things are done manually: a spelling error in the attribution line.
It's still unambiguous as to who wrote what, though a little less
helpful as regards chronology.

Attribution lines are part of being honest about who said what. I
wouldn't say that your post was evidence of malicious intent, but it
was sloppiness that led to an easily misunderstood post. On rereading,
I can see that you did try to indicate (by your text) that it was
meant to be followed by the OP's words, but you didn't put that into
the structure, and you certainly didn't distinguish between the
original post and the one made a little bit later. Please, if you
don't want to be called out for misattribution, just be a bit more
careful. It doesn't take a huge amount of effort.


More information about the Python-list mailing list