-
Notifications
You must be signed in to change notification settings - Fork 224
Input() function #259
Copy link
Copy link
Open
Labels
easyDifficulty level is easy and good for starting into this projectDifficulty level is easy and good for starting into this projectenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomerstopic: utilitiescontainers, strings, files, OS/environment integration, unit testing, assertions, logging, ...containers, strings, files, OS/environment integration, unit testing, assertions, logging, ...
Metadata
Metadata
Assignees
Labels
easyDifficulty level is easy and good for starting into this projectDifficulty level is easy and good for starting into this projectenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomerstopic: utilitiescontainers, strings, files, OS/environment integration, unit testing, assertions, logging, ...containers, strings, files, OS/environment integration, unit testing, assertions, logging, ...
Is there any interest to have a Python-like
input()function?Effectively, this would be a convenience function for the following pattern:
the purpose of which is to collect some user input together with a friendly prompt message. The Fortran interface could be something like:
In Python 2 they used to have two versions,
inputandraw_input. The first would try to evaluate the input argument and return it with the correct type, whileraw_inputwould return a string. In Python 3raw_inputwas removed andinputreturns a string. The user must then explicitly useevalor a type-conversion routine likeintorfloatto get the desired value.One issue I don't know how to deal with yet in Fortran are trailing whitespaces. The Python function preserves trailing whitespaces:
To achieve this in Fortran it might be necessary to interface with C.