Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #103115
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | <grsmith@atlanticbb.net> |
| Newsgroups | comp.lang.python |
| Subject | Question on keyword arguments |
| Date | Thu, 18 Feb 2016 09:00:10 -0500 |
| Lines | 23 |
| Message-ID | <mailman.2.1455804706.2289.python-list@python.org> (permalink) |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="iso-8859-1" |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | news.uni-berlin.de YFxaxuDfPg/TLz2Tzxv5aQW/34+vOrEM+ocv2nNF/ZJQ== |
| Return-Path | <grsmith@atlanticbb.net> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; '"""': 0.05; 'subject:Question': 0.05; '__name__': 0.07; 'preferable': 0.09; 'python': 0.10; 'def': 0.13; 'result.': 0.15; "'__main__':": 0.16; 'programmer)': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'thanks,': 0.24; 'correct': 0.28; 'to:name:python-list': 0.30; 'received:10.0': 0.34; 'list': 0.34; 'to:addr:python-list': 0.36; 'received:10': 0.37; 'to:addr:python.org': 0.40; 'from:no real name:2**0': 0.60; 'default': 0.61; 'received:38': 0.81; 'received:38.111': 0.84 |
| X-Scanner-Info | Cloudmark - http://www.cloudmark.com |
| X-CNFS-Analysis | v=2.1 cv=eq4itddX c=1 sm=1 tr=0 a=wmZXJE1MrsZYcnKSeUNejA==:117 a=wmZXJE1MrsZYcnKSeUNejA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=r77TgQKjGQsHNAKrUKIA:9 a=pwq2097MI4YzyTye-zcA:9 a=wPNLvfGTeEIA:10 a=G0k64VlqXco3sfAqzk4A:9 a=lTLXaqXgNAEAIREd:21 a=_W_S_7VecoQA:10 |
| X-CMAE-Score | 0.00 |
| X-Scanned-by | CMAE |
| X-AUTH-ID | grsmith@atlanticbb.net |
| X-Priority | 3 |
| X-MSMail-Priority | Normal |
| Importance | Normal |
| X-Mailer | Microsoft Windows Live Mail 15.4.3555.308 |
| X-MimeOLE | Produced By Microsoft MimeOLE V15.4.3555.308 |
| X-CMAE-Envelope | MS4wfNqWBoaa8YSFRGOHLW6SZfSAeLcsl0W0AkMepsCGi80BbzhAu9gYm3LYNOGOSV5lGz2z9mylBC2wMvttHomU4D4r11SUqxdy1DwQZblMFZw1HsiDmXU2isCIbNY81RBS/nM6/+aTsvzg9nq/FqQN1Khzg8bq2ht4yCwwa3hfwQ67wCwk9pQhH/J4jMt0HrrDP+z4JU9URPHEOStcWu+8w04= |
| X-Mailman-Approved-At | Thu, 18 Feb 2016 09:11:45 -0500 |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.21rc2 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.21rc2 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Xref | csiph.com comp.lang.python:103115 |
Show key headers only | View raw
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 comp.lang.python | Previous | Next | Find similar | Unroll thread
Question on keyword arguments <grsmith@atlanticbb.net> - 2016-02-18 09:00 -0500
csiph-web