-
Notifications
You must be signed in to change notification settings - Fork 7
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request : slicing with lists #2
Conversation
(works with numpy ndarrays too)
@@ -125,22 +135,22 @@ def __mul__(self, multiplier): | |||
|
|||
def count(self, value): | |||
''' | |||
return number of occurrences of value | |||
Return the number of occurrences of value. |
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 don't recall now, but I think I copied the language from the official documentation for list
...
> pydoc list | fgrep -A1 count
| count(...)
| L.count(value) -> integer -- return number of occurrences of value
|
> pydoc sparse_list | fgrep -A1 count
| count(self, value)
| return number of occurrences of value
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.
Urgh. I hesitated for a while before changing the text, but then my inner grammarian assumed control, i guess. I can revert it back, I don't know how to choose between consistency with the existing doc and literacy. You choose. :)
Hi @Goutte! Thank you very much for this PR! It has been nice to revisit this project after having neglected it for so long. I don't think I've written any Python code since I wrote this module about three years ago, so my memory around this is a little faded. Apologies for my vagueness. To address your questions and remarks:
I think the convention at my previous employer was to use single quotes for strings wherever possible. I've been doing Ruby for so long now, I can't recall whether there was any difference in Python (like there is in Ruby). Were I to start again, I would probably adhere to http://legacy.python.org/dev/peps/pep-0257/ 馃槃
Interesting. I wonder how I didn't pick that up. Perhaps I was using an older version of Python 2.7 than we have now.
Thanks for this. I would certainly use
馃槉
He he. Thanks for reading that article! |
Looks like https://github.com/Goutte/python_sparse_vector is the bomb when it comes to numpy! 馃挜 |
Great lib ! I really like the elegance of it. That's good cheese. 馃嵎
I hacked support for the following tests :
I wrote tests for
numpy
too (just to be sure) but decided against including them in a PR, unless you want them :I have a bunch of questions and remarks, while I'm at it (you don't have to answer, but given your SO score I guess explaining does not bother you too much :3) :
'''
and not double quotes"""
for doctrings ?SyntaxError
insetup.py
with python2.7
, because of the positional argumentinstall_requires('future', 'six'),
benchmark
whose simplicity and absence of code in multiline strings you might enjoy, if you don't already know about it.