Re: Why doesn't my finaliser run here?

2016-09-04 Thread Gregory Ewing
Chris Angelico wrote: There's a reference here somewhere, though. My suspicion is it's in sys.exc_info / sys.last_traceback, It's sys.last_traceback: >>> e = Eggs() instance created successfully ('self definitely exists:', <__main__.Eggs object at 0x2b6670>) Traceback (most recent call last):

Re: manually sorting images?

2016-09-04 Thread Ulli Horlacher
Quivis wrote: > On Sun, 04 Sep 2016 21:32:47 +1000, Steve D'Aprano wrote: > > > What does it mean to sort images visually? > > 1. A directory of images collected over say, five years. > > 2. You want to sort them according to red houses, blue houses, green > trees, yellow trees (that's autumn

Re: Why doesn't my finaliser run here?

2016-09-04 Thread Chris Angelico
On Mon, Sep 5, 2016 at 11:48 AM, Ben Finney wrote: > The larger point which remains true: Don't think of ‘__init__’ as a > constructor, all it does is work on an *already-constructed* instance. > > The ‘__new__’ method is the constructor. The instance doesn't exist > before that method is called;

Re: Why doesn't my finaliser run here?

2016-09-04 Thread Ben Finney
Steve D'Aprano writes: > On Sun, 4 Sep 2016 10:37 pm, Ben Finney wrote: > > > Short anser: because nothing has removed the reference to the > > instance. > > Hmmm. You're probably right, but not for the reason you think :-) Thanks to those who corrected some details in my explanation. > > This

Re: manually sorting images?

2016-09-04 Thread Michael Torrie
On 09/04/2016 04:09 PM, Gregory Ewing wrote: > Quivis wrote: >> 2. You want to sort them according to red houses, blue houses, green >> trees, yellow trees (that's autumn leaves), cats, dogs, children, elderly >> people, > > But... but... what if you have a picture of a child > playing with a do

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Michael Torrie
On 09/04/2016 04:22 PM, Gregory Ewing wrote: > Larry Hudson wrote: >> If you continue to read this forum, you will quickly learn to ignore >> "Pointy-Ears". He rarely has anything worth while to post, and his >> unique fetish about Real Names shows him to be a hypocrite as well. > > To be fair,

Re: Why doesn't my finaliser run here?

2016-09-04 Thread Steve D'Aprano
On Sun, 4 Sep 2016 10:37 pm, Ben Finney wrote: > Steve D'Aprano writes: > >> Why doesn't __del__ run here? > > Short anser: because nothing has removed the reference to the instance. Hmmm. You're probably right, but not for the reason you think :-) >> class Eggs(object): >> def __new__(c

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Ned Batchelder
On Sunday, September 4, 2016 at 7:52:44 PM UTC-4, Chris Angelico wrote: > FWIW, hex is much more common for displaying Unicode codepoints than > decimal is. So I'd print it like this (incorporating the 'not CAPITAL' > filter): You are right, I went too quickly, and didn't realize until after I pos

Re: manually sorting images?

2016-09-04 Thread cs
On 05Sep2016 10:09, Greg Ewing wrote: Quivis wrote: 2. You want to sort them according to red houses, blue houses, green trees, yellow trees (that's autumn leaves), cats, dogs, children, elderly people, But... but... what if you have a picture of a child playing with a dog that's chasing an

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Chris Angelico
On Mon, Sep 5, 2016 at 9:40 AM, Ned Batchelder wrote: > But, 'CAP' appears in 'CAPITAL', which gives more than 1800 matches: > > >>> for c in range(32, 0x11): > ... try: > ... name = unicodedata.name(chr(c)) > ... except ValueError: > ... continue > ... if

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Ned Batchelder
On Saturday, September 3, 2016 at 7:55:48 AM UTC-4, Veek. M wrote: > https://mail.python.org/pipermail//python-ideas/2014-October/029630.htm > > Wanted to know if the above link idea, had been implemented and if > there's a module that accepts a pattern like 'cap' and give you all the > instance

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Gregory Ewing
Larry Hudson wrote: If you continue to read this forum, you will quickly learn to ignore "Pointy-Ears". He rarely has anything worth while to post, and his unique fetish about Real Names shows him to be a hypocrite as well. To be fair, it's likely that Thomas Lahn is his real name, and he's n

Re: manually sorting images?

2016-09-04 Thread Gregory Ewing
Quivis wrote: 2. You want to sort them according to red houses, blue houses, green trees, yellow trees (that's autumn leaves), cats, dogs, children, elderly people, But... but... what if you have a picture of a child playing with a dog that's chasing an elderly cat up a yellow tree in front of

Question about abstract base classes and abstract properties -- Python 2.7

2016-09-04 Thread Gerald Britton
I was rereading the 2.7 docs about abstract base classes the other day. I found this: "This defines a read-only property; you can also define a read-write abstract property using the ‘long’ form of property declaration:" along with an example. so I copied the example and put in a little surrou

Re: *args and **kwargs

2016-09-04 Thread Matt Ruffalo
On 2016-09-02 15:44, Ben Finney wrote: > Note that this has nothing to do with how the function is defined; in > the definition of the function, parameters are neither positional nor > keyword. You name each of them, and you define an order for them; and > neither of those makes any of them “positi

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Larry Hudson via Python-list
On 09/04/2016 09:00 AM, Veek. M wrote: Steve D'Aprano wrote: On Sun, 4 Sep 2016 06:53 pm, Thomas 'PointedEars' Lahn wrote: Regarding the name (From field), my name *is* Veek.M […] Liar. *plonk* You have crossed a line now Thomas. That is absolutely uncalled for. You have absolutely no l

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Veek. M
Steve D'Aprano wrote: > On Sun, 4 Sep 2016 06:53 pm, Thomas 'PointedEars' Lahn wrote: > >>> Regarding the name (From field), my name *is* Veek.M […] >> >> Liar. *plonk* > > You have crossed a line now Thomas. > > That is absolutely uncalled for. You have absolutely no legitimate > reason to b

Re: manually sorting images?

2016-09-04 Thread Christian Gollwitzer
Am 04.09.16 um 10:53 schrieb Ulli Horlacher: I need to sort images (*.jpg), visually, not by file name. It looks, there is no standard UNIX tool for this job? So, I have to write one by myself, using Tkinter. Are there any high-level widgets which can help me, for example a file browser with th

Re: Strange behaviour with numbers in exponential notation

2016-09-04 Thread Christian Gollwitzer
Am 04.09.16 um 10:29 schrieb Nobody: On Fri, 02 Sep 2016 18:18:08 +0200, Christian Gollwitzer wrote: 1e26 denotes a *floating point number* Floating point has finite precision, in CPython it is a 64bit IEEE number. The largest exact integer there is 2**53 (~10^16), everything beyond cannot be a

Re: Why doesn't my finaliser run here?

2016-09-04 Thread Chris Angelico
On Sun, Sep 4, 2016 at 10:37 PM, Ben Finney wrote: >> And an example: >> >> >> py> e = Eggs() >> instance created successfully >> self definitely exists: <__main__.Eggs object at 0xb7bf21ec> >> Traceback (most recent call last): >> File "", line 1, in >> File "", line 8, in __init__ >> Except

Re: Why doesn't my finaliser run here?

2016-09-04 Thread Oscar Benjamin
On 4 Sep 2016 13:27, "Steve D'Aprano" wrote: > > Why doesn't __del__ run here? > > > class Eggs(object): > def __new__(cls): > instance = object.__new__(cls) > print("instance created successfully") > return instance > def __init__(self): > print("self defin

Re: Why doesn't my finaliser run here?

2016-09-04 Thread Ben Finney
Steve D'Aprano writes: > Why doesn't __del__ run here? Short anser: because nothing has removed the reference to the instance. > class Eggs(object): > def __new__(cls): > instance = object.__new__(cls) > print("instance created successfully") > return instance >

Why doesn't my finaliser run here?

2016-09-04 Thread Steve D'Aprano
Here's a finaliser that runs: class Spam(object): def __new__(cls): instance = object.__new__(cls) print("instance created successfully") return instance def __del__(self): print("deleting", repr(self)) An example: py> s = Spam(); del s instance created

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Steve D'Aprano
On Sun, 4 Sep 2016 06:53 pm, Thomas 'PointedEars' Lahn wrote: >> Regarding the name (From field), my name *is* Veek.M […] > > Liar. *plonk* You have crossed a line now Thomas. That is absolutely uncalled for. You have absolutely no legitimate reason to believe that Veek is not his or her real

Re: manually sorting images?

2016-09-04 Thread Steve D'Aprano
On Sun, 4 Sep 2016 06:53 pm, Ulli Horlacher wrote: > I need to sort images (*.jpg), visually, not by file name. I don't even understand this. What does it mean to sort images visually? Which comes first, a 400x500 image of a cat climbing a tree, or a 300x600 image of a toddler playing with a dog?

Re: manually sorting images?

2016-09-04 Thread Thomas 'PointedEars' Lahn
Ulli Horlacher wrote: > I need to sort images (*.jpg), visually, not by file name. > It looks, there is no standard UNIX tool for this job? Depends. What are the sort keys? -- PointedEars Twitter: @PointedEars2 Please do not cc me. / Bitte keine Kopien per E-Mail. -- https://mail.python.org/

manually sorting images?

2016-09-04 Thread Ulli Horlacher
I need to sort images (*.jpg), visually, not by file name. It looks, there is no standard UNIX tool for this job? So, I have to write one by myself, using Tkinter. Are there any high-level widgets which can help me, for example a file browser with thumbnails? -- Ullrich Horlacher

Re: Strange behaviour with numbers in exponential notation

2016-09-04 Thread Nobody
On Fri, 02 Sep 2016 18:18:08 +0200, Christian Gollwitzer wrote: > 1e26 denotes a *floating point number* Floating point has finite > precision, in CPython it is a 64bit IEEE number. The largest exact > integer there is 2**53 (~10^16), everything beyond cannot be accurately > represented. Uh, t

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Rustom Mody
On Sunday, September 4, 2016 at 11:18:07 AM UTC+5:30, Rustom Mody wrote: > On Sunday, September 4, 2016 at 9:32:28 AM UTC+5:30, Veek. M wrote: > > Regarding the name (From field), my name *is* Veek.M though I tend to > > shorten it to Vek.M on Google (i think Veek was taken or some such > > thing