Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #51267

Re: Creating a Simple User Interface for a Function

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 <python-python-list@m.gmane.org>
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 <tjreedy@udel.edu>
Subject Re: Creating a Simple User Interface for a Function
Date Thu, 25 Jul 2013 19:46:44 -0400
References <cebb4f86-c546-4283-a839-46393571cbb0@googlegroups.com> <mailman.5116.1374779986.3114.python-list@python.org> <97f8224f-e73b-4a4b-bf05-7cc3dba4e9d9@googlegroups.com> <kssamv$jam$1@ger.gmane.org>
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 <kssamv$jam$1@ger.gmane.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5124.1374796020.3114.python-list@python.org> (permalink)
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

Show key headers only | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Creating a Simple User Interface for a Function CTSB01 <scott.moore270@gmail.com> - 2013-07-25 09:03 -0700
  Re: Creating a Simple User Interface for a Function Dave Angel <davea@davea.name> - 2013-07-25 15:19 -0400
    Re: Creating a Simple User Interface for a Function CTSB01 <scott.moore270@gmail.com> - 2013-07-25 13:58 -0700
      Re: Creating a Simple User Interface for a Function Terry Reedy <tjreedy@udel.edu> - 2013-07-25 19:00 -0400
      Re: Creating a Simple User Interface for a Function Dave Angel <davea@davea.name> - 2013-07-25 19:01 -0400
      Re: Creating a Simple User Interface for a Function Terry Reedy <tjreedy@udel.edu> - 2013-07-25 19:46 -0400
      RE: Creating a Simple User Interface for a Function "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2013-07-26 14:08 +0000

csiph-web