-
Notifications
You must be signed in to change notification settings - Fork 188
stdlib_experimental_io: addition of a spec and extension of loadtxt and savetxt to support integers #120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…nd savetxt to support integers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is excellent! Thank you for doing it. I don't have any objections, this seems like a strict improvement.
src/stdlib_experimental_io.md
Outdated
| `r` | open for reading (default) | | ||
| `w` | open for writing, truncating the file first | | ||
| `x` | open for exclusive creation, failing if the file already exists | | ||
| `a` | open for writing, appending to the end of the file if it exists | | ||
| `b` | binary mode | | ||
| `t` | text mode (default) | | ||
| `+` | open for updating (reading and writing) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe an extra sentence would be helpful to indicate which of these can be used together? I had to look at the code, to know I can select one letter r, w, x, a; one from b,t; and optionally the +. But perhaps this is not yet so critical as long as we are in the experimental stage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I think it is important that we get a correct spec at this stage already. Otherwise it will lead to other PRs.
Would the following sentence be enough:
mode
may include one character to define which mode you want to open the file in (i.e.,r
,w
,x
, anda
) and one character to specify if the file should be handled as a binary or a text file (i.e.,b
, ort
).mode
may optionally include a third character+
to open the file for updating. The defaultmode
isrt
(i.e. open for reading a text file).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will reply later, however before I forget I think the characters in the table should be enclosed with quotation marks (single or double?) so they get rendered in Markdown as a character literals?
| r
| open for reading (default) |
| 'r'
| open for reading (default) | <-- like this
The same follow for the modes mentioned in the text, e.g. The default mode
is 'rt'
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ivan-pi I modified the spec following your comments. Please let me know if it is now clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quotes should be inside the inline code block, not outside. So, 'r'
, not 'r
' as it is now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quotes should be inside the inline code block, not outside. So,
'r'
, not 'r
' as it is now.
Good. And modified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compared to the Python documentation (e.g. open), the current explanation is relatively short and does not cover precisely what are the meanings of binary and text format and how they interact with the platform.
But I do not want to hinder progress, so good to go from my side too. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic, thank you @jvdp1. Good to go in my opinion, pending any edits suggested by others.
It's a start. We can improve upon it with subsequent PRs. Thanks for the review and merging!
…On Sat, Jan 25, 2020, at 6:00 AM, Ivan wrote:
***@***.**** commented on this pull request.
In src/stdlib_experimental_io.md
<#120 (comment)>:
> +| `r` | open for reading (default) |
+| `w` | open for writing, truncating the file first |
+| `x` | open for exclusive creation, failing if the file already
exists |
+| `a` | open for writing, appending to the end of the file if it
exists |
+| `b` | binary mode |
+| `t` | text mode (default) |
+| `+` | open for updating (reading and writing) |
Compared to the Python documentation (e.g. open
<https://docs.python.org/3/library/functions.html#open>), the current
explanation is relatively short and does not cover precisely what are
the meanings of binary and text format and how they interact with the
platform.
But I do not want to hinder progress, so good to go from my side too. 👍
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#120?email_source=notifications&email_token=AAAFAWAS7RYRS7JSXEMP64LQ7QZV5A5CNFSM4KKJLD4KYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCTBQJDI#discussion_r370932349>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAAFAWFRGDAUYAJIXZ2GSBLQ7QZV5ANCNFSM4KKJLD4A>.
|
stdlib_experimental_io.md
) for the procedures instdlib_experimental_io.f90
(loadtxt
,savetxt
, andopen
). This spec is different than previously because it also describes subroutines.loadtxt
andsavetxt
to supportinteger
.stdlib_experimental_io.f90
was generated from the filestdlib_experimental_io.fypp
usingfypp
.