[issue34953] Implement `mmap.mmap.__repr__`

2019-10-17 Thread Xiang Zhang


Xiang Zhang  added the comment:


New changeset d8ca2354ed30c12b9ce37c4535222b700a727b32 by Xiang Zhang (Taine 
Zhao) in branch 'master':
bpo-34953: Implement `mmap.mmap.__repr__` (GH-9891)
https://github.com/python/cpython/commit/d8ca2354ed30c12b9ce37c4535222b700a727b32


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34953] Implement `mmap.mmap.__repr__`

2019-10-17 Thread Xiang Zhang


Change by Xiang Zhang :


--
components: +Extension Modules -Interpreter Core
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.9 -Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34953] Implement `mmap.mmap.__repr__`

2018-10-16 Thread thautwarm


thautwarm  added the comment:

I think it depends on the use case. If `repr` wouldn't be invoked except 
debugging,some IO operations might not be that bad.

I'm to make some adjustments to avoid displaying the contents if nothing 
evidence that IO operations is not bad.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34953] Implement `mmap.mmap.__repr__`

2018-10-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I think that performing any IO operations in repr() is not a good idea.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34953] Implement `mmap.mmap.__repr__`

2018-10-15 Thread Eric V. Smith


Eric V. Smith  added the comment:

I agree with Xiang Zhang: I don't think we should show any content. Especially 
since basically every file will be truncated, and more often than not the 
interesting content isn't at the start or end of the file.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34953] Implement `mmap.mmap.__repr__`

2018-10-15 Thread Xiang Zhang


Xiang Zhang  added the comment:

I don't like the idea to display the contents in the repr, no matter entire or 
clipped. I think it's not suitable and for contents, just read the object 
manually. For me, a closed status plus the constructor arguments is a good 
choice.

--
nosy: +xiang.zhang

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34953] Implement `mmap.mmap.__repr__`

2018-10-15 Thread thautwarm


thautwarm  added the comment:

@Ram Rachum

Yes yes yes, actually the entire contents will be truncated when its length is 
bigger than a specific integer(now it's 50). For we use `...` to represent the 
ignored contents, `start ... end` could also be called *entire_contents* :-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34953] Implement `mmap.mmap.__repr__`

2018-10-15 Thread Ram Rachum


Ram Rachum  added the comment:

thautwarm, your suggestions look good. I'm not sure why you used
`entire_contents`, do you want to show the entire content there? Because I saw 
that the sample you used had truncation. It might be unsafe to show the entire 
mmap, because it could be huge. I'd truncate in some way or other. (Either show 
just the beginning, or just the beginning and the end.)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34953] Implement `mmap.mmap.__repr__`

2018-10-15 Thread thautwarm


Change by thautwarm :


--
keywords: +patch
pull_requests: +9254
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34953] Implement `mmap.mmap.__repr__`

2018-10-15 Thread thautwarm


thautwarm  added the comment:

How about this:

```
# opened


# closed


```

--
nosy: +thautwarm

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34953] Implement `mmap.mmap.__repr__`

2018-10-13 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +pablogsal

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34953] Implement `mmap.mmap.__repr__`

2018-10-10 Thread Ram Rachum


Ram Rachum  added the comment:

There are a few ways we can go with this, depending on how verbose we want to 
be and how willing we are to make calls to the data. Here are a few pieces of 
information we could expose:

 - Length
 - Whether it's a file or anonymous memory
 - The entire contents
 - The clipped contents
 - Whether it's opened or closed
 - The access type

So here's an example:



And another: 



I don't know whether we're able to include the file name on there, that would 
be nice.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34953] Implement `mmap.mmap.__repr__`

2018-10-10 Thread Eric V. Smith


New submission from Eric V. Smith :

What do you propose the repr would look like?

--
components: +Interpreter Core -Library (Lib)
nosy: +eric.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34953] Implement `mmap.mmap.__repr__`

2018-10-10 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34953] Implement `mmap.mmap.__repr__`

2018-10-10 Thread Ram Rachum


Change by Ram Rachum :


--
components: Library (Lib)
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Implement `mmap.mmap.__repr__`
type: enhancement
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com