Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #103115 > unrolled thread
| Started by | <grsmith@atlanticbb.net> |
|---|---|
| First post | 2016-02-18 09:00 -0500 |
| Last post | 2016-02-18 09:00 -0500 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
Question on keyword arguments <grsmith@atlanticbb.net> - 2016-02-18 09:00 -0500
| From | <grsmith@atlanticbb.net> |
|---|---|
| Date | 2016-02-18 09:00 -0500 |
| Subject | Question on keyword arguments |
| Message-ID | <mailman.2.1455804706.2289.python-list@python.org> |
Would this be the correct way to return
a list as a default result.
Also, would the list be the preferable result (to a python programmer) ?
def test(command, return_type='LIST'):
""" Go to database and return data"""
if return_type == 'LIST':
result = ['ONE', 'TWO', 'THREE']
else:
result = r'0xfeONE\0exfeTWO\0xfeTHREE'
return result
if __name__ == '__main__':
print(test('cmd'))
print(test('cmd', 'LIST'))
print(test('cmd', None))
print(test('cmd', 'string'))
thanks,
george
Back to top | Article view | comp.lang.python
csiph-web