Skip to content
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

added support for optional args for parity with newest C library #11

Closed
wants to merge 2 commits into from

Conversation

dmalan
Copy link
Member

@dmalan dmalan commented Apr 9, 2017

Equivalent to cs50/libcs50#64.

Copy link
Member

@kzidane kzidane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this should PR develop instead of master now?

cs50/cs50.py Outdated
"""Read a line of text from standard input and return it as a string."""
try:
if prompt is not None:
print(prompt, end="")
s = sys.stdin.readline()
return re.sub(r"(?:\r|\r\n|\n)$", "", s)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should return None if not s, since sys.stdin.readline returns "" on EOF?

f.readline() returns an empty string, the end of the file has been reached

https://docs.python.org/2/tutorial/inputoutput.html#methods-of-file-objects

@dmalan
Copy link
Member Author

dmalan commented Apr 14, 2017

Will ponder and loop back!

@dmalan
Copy link
Member Author

dmalan commented Apr 29, 2017

d8a74a3

@dmalan
Copy link
Member Author

dmalan commented May 7, 2017

Closing in favor of #17.

@dmalan dmalan closed this May 7, 2017
@dmalan dmalan deleted the optional-args branch May 21, 2017 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants