Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Tim Chase Newsgroups: comp.lang.python Subject: Re: Considering migrating to Python from Visual Basic 6 for engineering applications Date: Sun, 21 Feb 2016 12:19:06 -0600 Lines: 52 Message-ID: References: <90cc50d2-1ce5-4588-9bfd-a49d439f00dd@googlegroups.com> <14c75a68-0d2e-45cc-8d73-0d71b6a6aea6@googlegroups.com> <9e57761f-26e1-41c5-8e71-23800de1fdd3@googlegroups.com> <7f9c473e-b0c2-4d77-91d1-d0733c93b12d@googlegroups.com> <23d8156f-1808-4395-9c04-27d2984fe67c@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 0lSwDXvlzoNFj9RF+E1BkAxEHZy9VwSSdOn1GgfLTJvw== 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; 'subject:Python': 0.05; 'float': 0.05; 'integer,': 0.09; 'subject:Visual': 0.09; 'python': 0.10; 'files.': 0.13; 'read.': 0.13; 'syntax': 0.13; 'subject: \n ': 0.15; "(it's": 0.16; '(there': 0.16; '-tkc': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'map(int,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'thread.': 0.16; 'wrote:': 0.16; 'string': 0.17; ';-)': 0.18; 'accepting': 0.18; 'imposed': 0.22; 'file.': 0.22; 'seems': 0.23; "python's": 0.23; 'this:': 0.23; 'somewhere': 0.24; 'written': 0.24; 'header:In- Reply-To:1': 0.24; "i've": 0.25; 'define': 0.27; 'parameters': 0.27; 'question': 0.27; 'forgive': 0.27; 'specify': 0.27; 'values': 0.28; "i'm": 0.30; 'anywhere': 0.30; 'code': 0.30; 'anyone': 0.32; "can't": 0.32; 'limitations': 0.33; 'done': 0.35; 'quite': 0.35; 'level': 0.35; 'but': 0.36; 'instead': 0.36; 'needed': 0.36; 'possible': 0.36; 'basic': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'charset:us- ascii': 0.37; 'starting': 0.37; 'does': 0.39; 'subject:from': 0.39; 'well.': 0.40; 'to:addr:python.org': 0.40; 'where': 0.40; 'still': 0.40; 'making': 0.62; 'information': 0.63; "they're": 0.66; 'obvious': 0.76; 'sounds': 0.76; 'as:': 0.79; 'received:23': 0.84; 'touched': 0.84; 'wheel': 0.84 X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-MC-Relay: Neutral X-MailChannels-SenderId: wwwh|x-authuser|tim@thechases.com X-MailChannels-Auth-Id: wwwh X-MC-Loop-Signature: 1456078916767:1290761615 X-MC-Ingress-Time: 1456078916767 In-Reply-To: X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) X-AuthUser: tim@thechases.com X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21rc2 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:103313 On 2016-02-21 13:16, BartC wrote: > > No need for anyone to re-invent the > > wheel! ;-) > > I keep seeing this in the thread. Python has all this capability, > yet it still requires a lot of fiddly code to be added to get > anywhere near as simple as this: > > read f, a, b, c > > And this is code that is not going to be obvious to anyone starting > out. Even accepting that syntax limitations might require this to > be written as: > > readline(f, a, b, c) Well, if you know what the line is going to contain, that can be written as a, b, c = f.readline().split() > I can't see a straightforward way of making this possible while > still keeping a, b and c simple integer, float or string types > (because Python's reference parameters don't work quite the right > way). However, that does give you byte-strings since that's what comes out of files. If you know they're ints, you can force that: a, b, c = map(int, f.readline().split()) > (There is also the question of 'readline' knowing what types of > values to read. This information would not be needed in Fortran or > Basic but somehow needs to be supplied here, if a particular set of > types is to imposed on the input.) > > In other words, it seems this particular wheel does require > re-inventing! In both Fortran & BASIC, you specify that information somewhere as well. However, it sounds like you define those at the variable-definition level (it's been over a decade since I done any BASIC and far longer since I've even touched any Fortran, so forgive me if I'm a tad rusty) instead of where its read from the file. -tkc