Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: 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; 'binary': 0.07; 'duplicate': 0.07; 'interpreter.': 0.07; 'setup.': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'repeated': 0.09; 'subject:Function': 0.09; 'try:': 0.09; 'python': 0.11; 'jan': 0.12; '__future__': 0.16; 'check.': 0.16; 'division,': 0.16; 'docstring': 0.16; 'nameerror:': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'threads.': 0.16; 'wrote:': 0.18; 'file,': 0.19; 'command': 0.22; 'input': 0.22; 'import': 0.22; 'header:User- Agent:1': 0.23; '2.x': 0.24; 'apply.': 0.24; 'specify': 0.24; 'initial': 0.24; 'first,': 0.26; 'pass': 0.26; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'strongly': 0.30; 'especially': 0.30; 'code': 0.31; '3.x': 0.31; 'file': 0.32; 'option': 0.32; 'run': 0.32; 'open': 0.33; 'alone': 0.33; 'checking': 0.33; 'packaging': 0.33; 'core': 0.34; "i'd": 0.34; 'except': 0.35; 'there': 0.35; 'version': 0.36; 'installing': 0.36; 'subject:Simple': 0.36; 'doing': 0.36; 'so,': 0.37; 'machines': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'recent': 0.39; 'does': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'users': 0.40; 'easy': 0.60; 'future': 0.60; 'most': 0.60; 'numbers': 0.61; 'received:173': 0.61; 'simple': 0.61; 'further': 0.61; 'such': 0.63; 'decided': 0.64; 'more': 0.64; 'latest': 0.67; 'line,': 0.68; 'prompt': 0.68; '7:00': 0.84; 'received:fios.verizon.net': 0.84; 'together,': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Creating a Simple User Interface for a Function Date: Thu, 25 Jul 2013 19:46:44 -0400 References: <97f8224f-e73b-4a4b-bf05-7cc3dba4e9d9@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-251-66.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 48 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1374796020 news.xs4all.nl 15876 [2001:888:2000:d::a6]:60447 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:51267 Some additional comments. On 7/25/2013 7:00 PM, Terry Reedy wrote: > On 7/25/2013 4:58 PM, CTSB01 wrote: > >> 1) I decided to use Python 2.7, and I will be sure to specify this in >> all future threads. > > Given that you are not using any libraries, let alone one that does not > run on Python 3, I strongly recommend using the latest version (3.3). It would be pretty easy to make your simple code run on both 3.x and 2.6/7. Start your file (after any docstring or initial comment) with from __future__ import division, print_function Use "except XyxError as e:" instead of "except XyzError, e:". > If users start the program at a command line, the core of an input > function would be > numbers = input('Enter digits: ') # see below > You would need a more elaborate prompt printed first, and input checking > with the request repeated if the input does not pass the check. # To run on both 2.x and 3.x, put this after the __future__ import: try: input = raw_input except NameError: pass >> I'd like to be >> able to run send a .exe file that the user can just open up and use >> with no further setup. > > There are programs that will package your code with an interpreter. A Python pre-built binary is overkill for such a small function. The reason for doing so, packaging all dependencies together, does not apply. Any binary is limited to what machines it will run on. > do give people the option to get just the program without installing a > duplicate interpreter. A Python file, especially if designed to run on 2.6, will run on most any recent installation. -- Terry Jan Reedy