On 05/30/2013 08:37 AM, Eternaltheft wrote:
sorry about that, i got confused xD. yeah it works good now.
what i meant to say was can i return a function that i made, if the user inputs 
nothing?


There wouldn't be anything to stop you. However, if you have multiple returns from the same function, it's usually wise to return the same type of information from each of them. That's why Chris suggested simply assigning to filename in the if clause.

But without the whole function, and maybe even a description of what the function is expected to do, we can only guess.

Your comments still make no sense to me,

> filename = input('file name: ')
> if not filename:      #i get filename is not defined

But filename IS defined, immediately above. If it were undefined, you'd not be able to test it here. Big difference between "not defined" and "is empty string".

> return(drawBoard) #possible to return function when no file input from user?

If drawBoard is a function object, it's certainly possible to return it. But again, without seeing the rest of the function, and maybe how it's intended to be used, I can't confirm whether it makes sense.

--
DaveA
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to