Skip to content

Improve csv module and float() signature#1418

Merged
matthiaskramm merged 4 commits intomasterfrom
cvs-and-float
Jun 20, 2017
Merged

Improve csv module and float() signature#1418
matthiaskramm merged 4 commits intomasterfrom
cvs-and-float

Conversation

@gvanrossum
Copy link
Copy Markdown
Member

The most recent changes to the csv stubs (#1398) introduced more precise types but also some problems. I am fixing those problems here:

  • DictReader accidentally became an abstract class. I made it concrete again by adding definitions for __iter__() and next().
  • The restval argument to DictWriter.__init__() accidentally became mandatory. I made it Optional again.
  • The first argument to reader() should be Iterable, not Iterator.

Running with these improvements against our internal codebase also revealed a problem when float() is called with an argument of type Union[str, int]. I fixed this by switching the signature of float.__init__() from using @overload to using Union.

@gvanrossum gvanrossum requested a review from matthiaskramm June 20, 2017 18:20
@matthiaskramm matthiaskramm merged commit 8607064 into master Jun 20, 2017
@gvanrossum gvanrossum deleted the cvs-and-float branch June 20, 2017 20:12
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.

2 participants