Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #87955
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <webmailgroups@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.028 |
| X-Spam-Evidence | '*H*': 0.94; '*S*': 0.00; 'elif': 0.05; 'function:': 0.09; 'subject:Function': 0.09; 'way:': 0.09; 'def': 0.12; '"current': 0.16; '(actually': 0.16; '......': 0.16; "function's": 0.16; 'skip:> 20': 0.16; 'subject:avoiding': 0.16; 'subject:combinations': 0.16; 'instance,': 0.24; 'question': 0.24; 'function': 0.29; 'code': 0.31; 'file:': 0.31; 'common': 0.35; 'received:google.com': 0.35; 'charset:us-ascii': 0.36; 'thanks': 0.36; 'message-id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'little': 0.38; 'to:addr:python.org': 0.39; 'full': 0.61; 'such': 0.63; 'choose': 0.64; 'here': 0.66; 'on...': 0.68; 'default': 0.69; 'condition.': 0.84; 'received:192.114': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type :content-transfer-encoding:thread-index:content-language; bh=yWsblZCvemmADiN3B2vujGfvEZefjIhCKCbnGgJQrVo=; b=dpxGcpagUOWaaUxSrkbfEIXnqQXFGOyrXYDf9UxB6fEuvvc/mtZ6ICAaGrrr1v5lm2 MuWSdOLRVt2dl3Gqw8b1PAi//+uybGhi2P2lxOwPoRcaCQY2MwPIMEzjwH4icktIPF3d A9WbgBY68S8R0vkaCylk1LHf2I/D5VTy8VQYPpUIjAkCrh0U8ckdeN7WQAcsGZyyIuI3 5l6vlIaynSQmIczhebo35cIQ01PT/lomZsfY6i2lqjIVKPee7cNhO/MlEbHAaS5q+Pme 0REgIhk0fvrZBAeosdpON8NWNmCQtk9Fk4I42tIfan2k1XfVO3meO8VgxfA5b0jIRQ4f srWQ== |
| X-Received | by 10.194.61.51 with SMTP id m19mr20348388wjr.39.1427305417723; Wed, 25 Mar 2015 10:43:37 -0700 (PDT) |
| From | "Ivan Evstegneev" <webmailgroups@gmail.com> |
| To | <python-list@python.org> |
| Subject | Function Defaults - avoiding unneccerary combinations of arguments at input |
| Date | Wed, 25 Mar 2015 19:43:34 +0200 |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset="us-ascii" |
| Content-Transfer-Encoding | 7bit |
| X-Mailer | Microsoft Outlook 14.0 |
| Thread-Index | AdBnIseOUtS+o5hEQ+yLx91p6iKzvQ== |
| Content-Language | en-us |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.19 |
| 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> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.146.1427305418.10327.python-list@python.org> (permalink) |
| Lines | 47 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1427305418 news.xs4all.nl 2837 [2001:888:2000:d::a6]:33098 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:87955 |
Show key headers only | View raw
Hello all , Just a little question about function's default arguments. Let's say I have this function: def my_fun(history=False, built=False, current=False, topo=None, full=False, file=None): if currnet and full: do something_1 elif current and file: do something_2 elif history and full and file: do something_3 ...... some code here.............. and so on... I won't cover all the possibilities here (actually I don't use all of them ^_^). The question is about avoiding the response for unnecessary combinations? For instance, if user will call function this way: >>>my_fun(current=True, full=True, topo='some str', file="some_file") That will lead to function's misbehavior. As a particular case it will choose "current and full" condition. What is the common accepted way to deal with such unwanted situations? Thanks a lot in advance, Ivan.
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Function Defaults - avoiding unneccerary combinations of arguments at input "Ivan Evstegneev" <webmailgroups@gmail.com> - 2015-03-25 19:43 +0200
Re: Function Defaults - avoiding unneccerary combinations of arguments at input Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-26 10:48 +1100
RE: Function Defaults - avoiding unneccerary combinations of arguments at input "Ivan Evstegneev" <webmailgroups@gmail.com> - 2015-03-26 11:47 +0200
RE: Function Defaults - avoiding unneccerary combinations of arguments at input Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-26 21:51 +1100
csiph-web