Re: __getattribute__'s error is not available in __getattr__

2017-05-02 Thread Chris Angelico
On Wed, May 3, 2017 at 3:05 PM, Ethan Furman wrote: >> I was going to hardcode AttributeError, which would have made it more >> obvious and simpler, but then a single-purpose decorator (and if you >> do that, why not just wrap your code in try/except manually?). >> Obviously for production it need

Re: getting memory usage of varaibles

2017-05-02 Thread INADA Naoki
I recommend tracemalloc. Start with PYTHONTRACEMALLOC=3, and increase depth only when stack trace is too short. 2017/05/03 午後0:50 "Larry Martell" : > On Tue, May 2, 2017 at 7:01 PM, Erik wrote: > > On 02/05/17 23:28, Larry Martell wrote: > > Anyone have any thoughts on how I can monit

Re: __getattribute__'s error is not available in __getattr__

2017-05-02 Thread Ethan Furman
On 05/02/2017 09:57 PM, Chris Angelico wrote: On Wed, May 3, 2017 at 2:39 PM, Ethan Furman wrote: On 05/02/2017 07:47 PM, Chris Angelico wrote: On Wed, May 3, 2017 at 12:37 PM, Ethan Furman wrote: Until then Chris' decorator is probably the easiest work around -- but you should only catch

Re: getting memory usage of varaibles

2017-05-02 Thread Chris Angelico
On Wed, May 3, 2017 at 5:53 AM, Larry Martell wrote: > And I can see it getting larger and larger. But I want to see what it > is that is causing this. My thought was to put all the objects in a > dict with their sizes and compare them as the program runs and report > on the one that are growing.

Re: __getattribute__'s error is not available in __getattr__

2017-05-02 Thread Chris Angelico
On Wed, May 3, 2017 at 2:39 PM, Ethan Furman wrote: > On 05/02/2017 07:47 PM, Chris Angelico wrote: >> >> On Wed, May 3, 2017 at 12:37 PM, Ethan Furman wrote: > > >>> Until then Chris' decorator is probably the easiest work around -- but >>> you >>> should only catch AttributeError, not everything

Re: __getattribute__'s error is not available in __getattr__

2017-05-02 Thread Ethan Furman
On 05/02/2017 07:47 PM, Chris Angelico wrote: On Wed, May 3, 2017 at 12:37 PM, Ethan Furman wrote: Until then Chris' decorator is probably the easiest work around -- but you should only catch AttributeError, not everything. It does. (Or rather, it catches only those exception(s) listed as pa

Re: getting memory usage of varaibles

2017-05-02 Thread Larry Martell
On Tue, May 2, 2017 at 7:01 PM, Erik wrote: > On 02/05/17 23:28, Larry Martell wrote: Anyone have any thoughts on how I can monitor the variables' memory usage as the script runs? >>> >>> >>> This is application-specific, but sometimes it helps to look at the >>> objects' types, or

Re: __getattribute__'s error is not available in __getattr__

2017-05-02 Thread Chris Angelico
On Wed, May 3, 2017 at 12:37 PM, Ethan Furman wrote: > Until then Chris' decorator is probably the easiest work around -- but you > should only catch AttributeError, not everything. It does. (Or rather, it catches only those exception(s) listed as parameters.) Any other exceptions pass through un

Re: __getattribute__'s error is not available in __getattr__

2017-05-02 Thread Ethan Furman
On 05/02/2017 05:59 PM, Jason Maldonis wrote: @Steve they asked me to move it here because it was more fitting. I hope that's okay? Yes, it's okay. ;) After some testing, it looks like I'm okay with how things work if the problem-object isn't a descriptor (although I do still things it's

Re: __getattribute__'s error is not available in __getattr__

2017-05-02 Thread Chris Angelico
On Wed, May 3, 2017 at 10:59 AM, Jason Maldonis wrote: > Here's an example where the underlying error is completely hidden: > > class A(object): > def _some_complex_code_hidden_from_the_user(self): > # Run a bunch of complex stuff that raises an attribute error > internally > #

Re: __getattribute__'s error is not available in __getattr__

2017-05-02 Thread Jason Maldonis
@Steve they asked me to move it here because it was more fitting. I hope that's okay? After some testing, it looks like I'm okay with how things work if the problem-object isn't a descriptor (although I do still things it's a bit odd that an error gets squashed, but it's no big deal). However, I

Re: __getattribute__'s error is not available in __getattr__

2017-05-02 Thread Steve D'Aprano
On Wed, 3 May 2017 10:11 am, Ethan Furman wrote: > On 05/02/2017 11:16 AM, Jason Maldonis wrote: > >> Here is the simplest example showing what I mean (there are many more >> complicating variations this, and unfortunately I'm running into some of >> them): [...] I believe this is the wrong li

Re: tempname.mktemp functionality deprecation

2017-05-02 Thread Cameron Simpson
On 01May2017 14:31, Tim Chase wrote: On 2017-05-01 18:40, Gregory Ewing wrote: The following function should be immune to race conditions and doesn't use mktemp. [loop trying names until os.link does not fail die to an existing name] Ah, this is a good alternative and solves the problem at h

Re: Python package to accept payments in Internet

2017-05-02 Thread Steve D'Aprano
On Wed, 3 May 2017 02:19 am, Victor Porton wrote: > I have created a full featured package to accept payments in Internet > (currently supports PayPal). [...] > Buy the commercial version and support scientific research and a new > principle of the Web I am working on. What licence is your packag

Re: __getattribute__'s error is not available in __getattr__

2017-05-02 Thread Ethan Furman
On 05/02/2017 11:16 AM, Jason Maldonis wrote: Here is the simplest example showing what I mean (there are many more complicating variations this, and unfortunately I'm running into some of them): class A(object): def __getattr__(self, attr): raise AttributeError("raised from A.__g

Re: getting memory usage of varaibles

2017-05-02 Thread Erik
On 02/05/17 23:28, Larry Martell wrote: Anyone have any thoughts on how I can monitor the variables' memory usage as the script runs? This is application-specific, but sometimes it helps to look at the objects' types, or even their values. The types are dict and list, so they are not very use

Re: getting memory usage of varaibles

2017-05-02 Thread Larry Martell
On Tue, May 2, 2017 at 5:57 PM, Dan Stromberg wrote: > On Tue, May 2, 2017 at 12:53 PM, Larry Martell > wrote: >> I have a script that consumes more and more memory as it runs. It has >> no globals and the large data structures go out of scope often so >> should be garbage collected. I've looked

Re: getting memory usage of varaibles

2017-05-02 Thread breamoreboy
On Tuesday, May 2, 2017 at 8:54:46 PM UTC+1, larry@gmail.com wrote: > I have a script that consumes more and more memory as it runs. It has > no globals and the large data structures go out of scope often so > should be garbage collected. I've looked at the most likely suspects > with sys.getsi

Re: getting memory usage of varaibles

2017-05-02 Thread Dan Stromberg
On Tue, May 2, 2017 at 12:53 PM, Larry Martell wrote: > I have a script that consumes more and more memory as it runs. It has > no globals and the large data structures go out of scope often so > should be garbage collected. I've looked at the most likely suspects > with sys.getsizeof and they are

Re: Rosetta: Sequence of non-squares

2017-05-02 Thread breamoreboy
On Tuesday, May 2, 2017 at 12:15:02 PM UTC+1, Tim Golden wrote: > On 02/05/2017 11:18, Rhodri James wrote: > > On 02/05/17 08:20, Mark Summerfield via Python-list wrote: > >> > >> (The posts are already filtered out of the official comp.lang.python > >> list, but they can't do this for the Google G

getting memory usage of varaibles

2017-05-02 Thread Larry Martell
I have a script that consumes more and more memory as it runs. It has no globals and the large data structures go out of scope often so should be garbage collected. I've looked at the most likely suspects with sys.getsizeof and they are not growing in size. I did this: sum([sys.getsizeof(o) for o

__getattribute__'s error is not available in __getattr__

2017-05-02 Thread Jason Maldonis
Moving this conversation from python-dev to here because I shouldn't have sent it to python-dev. My original message: I'm working on a large class architecture and I find myself often overloading __getattr__. I am continuously running into the issue where I want __getattr__ to have access to the

When and how to subclass Enum vs EnumMeta?

2017-05-02 Thread Ethan Furman
As more folks start using the Enum data type (introduced in 3.4) there are more questions on how extend them beyond "just" a name-value pair. This question/answer on Stackoverflow: http://stackoverflow.com/q/43730305/208880 speaks to the issue of when it is appropriate to subclass EnumMeta,

Python package to accept payments in Internet

2017-05-02 Thread Victor Porton
I have created a full featured package to accept payments in Internet (currently supports PayPal). It has especially great support for recurring payments. Here it is: http://freesoft.portonvictor.org/django-debits.xml I hope we with community work will turn it into an universal payment gateway

TypeVar single constraint not allowed, why?

2017-05-02 Thread oliver
The documentation for typing.TypeVar gives these two examples: T = TypeVar('T') # Can be anything A = TypeVar('A', str, bytes) # Must be str or bytes I was suprised to find out that the following does not work, exception says that TypeVar is not definable with only one constraint:

Re: Help Please ! Undocumented ERROR message so dont know how to fix the problem

2017-05-02 Thread Rhodri James
On 02/05/17 03:57, murdock wrote: I am having a problem that seems to persist. I have written a program that makes a mathematical calculation and uses a uses library that I have written. It had been working but somehow in playing around with it, it stoppedgo figure! But here is the thing,

RE: EXTERNAL: downloading python 3.6.0 with pygame

2017-05-02 Thread Joaquin Henriquez
>please i need tour help,how can i download python 3.6.0 together with >pygame? Dwnload and install python 3.6 and then with the pip module - pip install pygame You can also download pygame from pypi and install it manually. -- https://mail.python.org/mailman/listinfo/python-list

downloading python 3.6.0 with pygame

2017-05-02 Thread tamale JIMMY
please i need tour help,how can i download python 3.6.0 together with pygame? -- https://mail.python.org/mailman/listinfo/python-list

Re: Help Please ! Undocumented ERROR message so dont know how to fix the problem

2017-05-02 Thread Steve D'Aprano
On Tue, 2 May 2017 12:57 pm, murdock wrote: > I am having a problem that seems to persist. I have written a program that > makes a mathematical calculation and uses a uses library that I have > written. It had been working but somehow in playing around with it, it > stoppedgo figure! But here

Re: Rosetta: Sequence of non-squares

2017-05-02 Thread Tim Golden
On 02/05/2017 11:18, Rhodri James wrote: On 02/05/17 08:20, Mark Summerfield via Python-list wrote: (The posts are already filtered out of the official comp.lang.python list, but they can't do this for the Google Groups version.) Careful! The posts are filtered out of the official Python mail

Re: Rosetta: Sequence of non-squares

2017-05-02 Thread Rhodri James
On 02/05/17 08:20, Mark Summerfield via Python-list wrote: (The posts are already filtered out of the official comp.lang.python list, but they can't do this for the Google Groups version.) Careful! The posts are filtered out of the official Python mailing list, but the comp.lang.python newsg

Re: Rosetta: Sequence of non-squares

2017-05-02 Thread Mark Summerfield via Python-list
On Monday, May 1, 2017 at 9:47:10 PM UTC+1, jlad...@itu.edu wrote: > On Monday, May 1, 2017 at 11:27:01 AM UTC-7, Robert L. wrote: > [no Python] > > Do you ever plan to ask any questions about Python? Or are you just using a > few lines of code as a fig leaf for the race baiting that you post in