Considering migrating to Python from Visual Basic 6 for engineering applications

Chris Angelico rosuav at
Sun Feb 21 08:54:06 EST 2016

On Mon, Feb 22, 2016 at 12:16 AM, BartC <bc at> wrote:
> On 21/02/2016 07:28, Larry Hudson wrote:
>> On 02/20/2016 10:38 AM, wrong.address.1 at wrote:
>>> Or can I write my own reading subroutines which can then be called like
>>> ReadVBstyle 8, ND, NIN, NT
>>> to make the code more readable?
>> ABSOLUTELY!!  Most Python programming consists of defining the functions
>> and classes needed, which definitely makes Python more readable.
>> 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)
> 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).

How about:

a, b, c = readline(f)

> (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.)

You'd still need to solve that, one way or another. But the Pythonic
way is to distinguish between "input" and "output" parameters by
having the input parameters as parameters, and the output parameters
as the return value. And personally, I find it *way* more readable
that way; while it's perfectly possible to pass a list as a parameter
and have the function append to it, it's much clearer if your return
values are on the left of the equals sign.


More information about the Python-list mailing list