-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
paasio: implement exercise #751
Comments
This issue has been automatically marked as |
I've been looking at this and have a few notes I'd like broader insight on.
|
Admittedly I don't work with raw sockets very often, but why can socket.socket not be subclassed? I see that the file descriptor it creates is non-inheritable, but that's about is ability to be passed between processes and doesn't obviously preclude subclasses of socket.socket itself. That said, I'll admit that subclassing it well looks like a lot of work, since various methods currently use socket.socket internally and you'd need to rewrite those to reference your subclass as well. I would think, though, that for the purposes of this exercise, we could simply require a Same with the file-like object ... a So I'd say a rather simplistic delegation is more than enough ... while exhaustively wrapping the full pantheon of IO classes is certainly a heck of a good learning exercise I'd say it's well beyond the scope of Exercism's "fluency" mandate. |
I appreciate your insight. To answer your first question, maybe saying you cannot wrap any socket, whether SOCK_RAW or not, might be a bit too hyperbolic. But, you cannot wrap any socket without doing large amounts of Python and bit of C. Unlike file-like objects, As to the rest and with your thoughts in mind, I'll look at some sort of delegation pattern with a passed-in parent. My initial thought would be to follow your suggestion giving the |
I'd say that having the student support the context manager and iterator protocols is perfectly valid and relatively easy to test as well. I'd be fine with adding the various socket methods, but be careful to remember that we're not trying to teach fluency in sockets, but in Python ... so if the method doesn't really rely on new or different concepts in Python then I'd consider it for a bonus task, or elide it altogether. |
There are exercises that are not yet implemented in Python track (the full list of them - #417 (comment)).
You can help us change this situation by implementing this one. Ref #417
The guide "Implement an exercise from specification" will help you succeed.
If you still have questions, I encourage you to ask them before starting working on the issue.
I also suggest claiming the issue by creating an empty PR as stated here
Please note that there are some special 'closing issue' keywords that you can put in description of your PR and Github will take care of closing the corresponding issue automatically after merge.
This simple thing helps us a lot, and makes our life a bit easier
The text was updated successfully, but these errors were encountered: