function returning a list beliavsky at
Wed Sep 1 20:12:14 CEST 2004

Brad Tilley <bradtilley at> wrote:
>Can a function return a list?

Yes, it can return anything. Here is a trivial example:

def twice(x):
    return 2*x

print twice(1.0)   # 2.0
print twice([1.0]) # [1.0, 1.0]

Note that "2*x" has a very different effect, depending on what "x" is.

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---

More information about the Python-list mailing list