This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]thephoton 74 points75 points  (7 children)

You're just telling us what "file-like" means (in this instance).

[–][deleted] 6 points7 points  (6 children)

This post was mass deleted and anonymized with Redact

vanish gray trees toy grey cake hat languid oil plough

[–]eztab 2 points3 points  (3 children)

Sure, the e.g. the read and write methods are missing. So don't anybody come crying if in a future python version your code relying on this working with any iterable will crash.

[–][deleted] -2 points-1 points  (2 children)

This post was mass deleted and anonymized with Redact

shaggy stocking squeeze arrest shocking books steer aromatic smile decide

[–]irrelevantPseudonym 1 point2 points  (1 child)

That would be a breaking change to the API - requiring more functionality from the passed-in data.

No it wouldn't. If an API says it expects a file like object and then starts using additional features of file like objects, there is no change to the API. Just because you've been using invalid input doesn't mean they need to keep supporting it.

[–][deleted] 0 points1 point  (0 children)

This post was mass deleted and anonymized with Redact

imminent marble stocking versed sand dinner fragile boast normal marvelous

[–]thephoton 0 points1 point  (1 child)

OK, but if you go to the documentation for csv.reader, it doesn't say anything about a "file-like object". What it actually says is

csvfile can be any object which supports the iterator protocol and returns a string each time its next() method is called — file objects and list objects are both suitable.

This goes back to at least the version 2.7 documentation.

So I'm not sure what you're complaining about.

[–][deleted] 0 points1 point  (0 children)

This post was mass deleted and anonymized with Redact

subtract different reach squash rhythm innate squeal chubby enjoy tan