Conversation
|
That's a great idea! |
|
Currently, this doesn't work on Python 2.6, see my comments on 98f2131. |
|
Sorry for the close. I confused my branches with this one. |
|
2.6 compatibility should be fixed now. I think that |
pysoundfile.py
Outdated
There was a problem hiding this comment.
I think it would be better to replace "%s" with %r.
This would use the typical quotes, in this case single quotes instead of double quotes.
I think we should try, wherever possible, to raise awareness about the When people save float arrays to WAV files, they will loose precision by default.
Sure, it works, but it may not be the most appropriate piece of information to return. I think it would be best if we change We can also do this in a separate PR.
Me, too. I think it's just more accurate and helpful to show the And it's actually not providing a valid constructor argument, because it will be something like |
|
The file repr includes quotes, which messes up too many things. For the time being at least, Can we merge this? |
What exactly does that mess up? The file repr only contains single quotes, as should all our string fields (https://github.com/bastibe/PySoundFile/pull/76#discussion_r21603138). Even if the repr would contain both kinds of quotes (which it doesn't, except the file name itself contains them) or our other strings would use double quotes (which they shouldn't), the string formatting mechanism would be intelligent enough to escape the quotes where necessary.
What about showing |
__repr__ now returns a nice description of the SoundFile closes #76
|
Re: repr: Apparently I do not know how you would like to incorporate
I am not in favor of this. As I said before, I would prefer not to show |
... instead of storing only the "name" attribute of the file-like object. __repr__() shows the repr() of the file name/file descriptor/file-like object and the repr() of the mode and format strings.
Sure. I pushed a commit (5e9a075) which implements this. Now, instead of holding the file name of the original file, This is IMHO a consistent extension of the behavior of Python's file objects, where the
We have to draw the line somewhere ... but I think we shouldn't separate What I want to say with that is, that if you want to drop
True, except in the very unlikely case it's different from
That sounds like a good guideline. I think currently the two most promising solutions would be to show all three of I'd prefer former, which also happens to be the current state of this PR. |
|
Just for reference: There might be some overlap with #58. |
|
OK, looks good to me. Merge if you agree. I don't see why we need |
OK, I'm merging this. > I don't see why we need `format` should require `subtype` and `endian`, but if you insist on it, we'll do it that way. I'd rather have always too much information than a different amount of information for different files. If we get annoyed by the large amount of information, we can still remove the `format`/`subtype`/`endian` triple at a later point. Also, let's see if the implementation of #58 sheds a different light on this.
|
I inadvertently added this to the merge commit message, I actually wanted to post this comment here: OK, I'm merging this.
If we get annoyed by the large amount of information, we can still remove the Also, let's see if the implementation of #58 sheds a different light on this. |
__repr__could include the file name, samplerate and number of channels, and possibly the open mode.