Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ethan Furman Newsgroups: comp.lang.python Subject: Re: Date: Wed, 23 Mar 2016 11:26:46 -0700 Lines: 12 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de DFmGImWlTwgAgaHgUBPoaACTUwqRvDCJNG0QvBNFCKvQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'behavior,': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; '(meaning': 0.16; 'dictionaries': 0.16; 'different?': 0.16; 'nick': 0.16; 'pythonic': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'arguments': 0.22; 'keys': 0.22; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'function': 0.28; 'accepts': 0.29; '~ethan~': 0.29; "i'm": 0.30; 'advice': 0.35; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'desired': 0.37; 'to:addr:python.org': 0.40; 'your': 0.60; 'charset:windows-1252': 0.62; 'different': 0.63; 'subject::': 0.85 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:105566 On 03/22/2016 08:17 PM, Nick Eubank wrote: > Relatedly, if this is a desired behavior, any advice one how best to work > with dictionaries when one wants "True" and 1 to be different? I'm working > on a function that accepts arguments that may be "True" or 1 (meaning very > different things) and am seeking a pythonic solution... If your keys are only numeric and True/False, you can check for and mutate True/False into strings "True"/"False" -- ~Ethan~