Re: on the popularity of loops while and for

2021-08-28 Thread Stestagg
On Sun, 29 Aug 2021 at 00:04, Stefan Ram wrote: > Stestagg writes: > >If you're doing this analysis, I'd be pretty interested in how many of > >those while loops where 'while True:' > > Here, about 40 %. Thanks! That's an interesting stat.

Re: on the popularity of loops while and for

2021-08-28 Thread Stestagg
If you're doing this analysis, I'd be pretty interested in how many of those while loops where 'while True:' I'd wager 75%. But may be completely off Steve On Sat, 28 Aug 2021 at 23:03, Hope Rouselle wrote: > r...@zedat.fu-berlin.de (Stefan Ram) writes: > > > Hope Rouselle writes: > >>Have y

Re: i just moved from bottleframework to flask. I changes what needed to be altered to convert the code and when i run it i just get "Internal server error" Running tail -f ../logs/error_log i get no

2021-07-08 Thread Stestagg
unt its evene worse > as the file flask is not entered into PATH. > > So i guess as root i have to install flask, but then why cant it import > 'run" ? > > [root@superhost ~]# whereis flask > flask: /usr/local/bin/flask > > Στις Πέμ, 8 Ιουλ 2021 στις 7:02 μ.

Re: i just moved from bottleframework to flask. I changes what needed to be altered to convert the code and when i run it i just get "Internal server error" Running tail -f ../logs/error_log i get no

2021-07-08 Thread Stestagg
Hi Do you have a file or folder named 'flask' in the same directory as www.py by any chance? Steve On Thu, Jul 8, 2021 at 4:50 PM vergos@gmail.com < vergos.niko...@gmail.com> wrote: > i just moved from bottleframework to flask. I changes what needed to be > altered to convert the code and w

Re: Behaviour of pop() for dictionaries

2021-06-14 Thread Stestagg
You can do the following: _,v = d.popitem() Or: key, value = d.popitem() Steve On Mon, 14 Jun 2021 at 20:10, Greg Ewing wrote: > On 14/06/21 4:19 am, BlindAnagram wrote: > > Am I missing the obvious way to obtain the value (or the key) from a > > dictionary that is known to hold only one ite

Re: learning python ...

2021-05-23 Thread Stestagg
On Sun, 23 May 2021 at 20:37, hw wrote: > On 5/23/21 7:28 PM, Peter Otten wrote: > > On 23/05/2021 06:37, hw wrote: > >> > >> Hi, > >> > >> I'm starting to learn python and have made a little example program > >> following a tutorial[1] I'm attaching. > >> > >> Running it, I'm getting: > >> > >>

Re: Python script accessing own source code

2021-05-12 Thread Stestagg
On 2021-05-12 15:48, Michael F. Stemper wrote: > > On 12/05/2021 08.26, Dino wrote: > > > >> Hi, here's my (probably unusual) problem. Can a Python (3.7+) script > >> access its own source code? > > > > Here is a fairly simple python program that reads itself: > > > > =

Re: Proposal: Disconnect comp.lang.python from python-list

2021-05-06 Thread Stestagg
Where's this discussion going? Let's not get too caught up on definitions or the sizes of everyone's respective .. newsgroups. Which of the practically possible options are best for this list <-> newsgroup setup? Thanks Steve On Thu, May 6, 2021 at 6:47 PM Jon Ribbens via Python-list < python-

Re: Not found in the documentation

2021-04-27 Thread Stestagg
On Tue, Apr 27, 2021 at 12:52 PM elas tica wrote: > > > However, in this case, the general information in the docs is > > absolutely sufficient, and the basic principle that the repr should > > (where possible) be a valid literal should explain what's needed. > > > This is a subjective statement.

Re: ipython display figure

2021-04-13 Thread Stestagg
I'm guessing here a little bit, but it looks like the author expects you to run this code in a jupyter notebook, rather than in an ipython interactive console. The jupyter and ipython projects are related (the same?) which can cause some confusion, but if you run the code you shared in a jupyter l

Re: Yield after the return in Python function.

2021-04-07 Thread Stestagg
On Wed, Apr 7, 2021 at 12:31 PM Chris Angelico wrote: > > I just realised that the whole eval/exec/namespace stuff is massive > overkill. All you need is an object that is inconsistent in its > boolification... > > Somewhat related: https://bugs.python.org/issue42899 Steve -- https://mail.pytho

Re: Canonical conversion of dict of dicts to list of dicts

2021-03-30 Thread Stestagg
For completeness, from 3.5 onwards, you can also do the following: [{'name': n, **d} for n, d in dod.items()] On Tue, Mar 30, 2021 at 1:06 PM Chris Angelico wrote: > On Tue, Mar 30, 2021 at 11:01 PM Jon Ribbens via Python-list > wrote: > > > > On 2021-03-30, Chris Angelico wrote: > > > I dunn

Re: Canonical conversion of dict of dicts to list of dicts

2021-03-30 Thread Stestagg
I'm not certain this is the clearest possible code pattern to use, but depending on the structure of your larger code, it's possible to do this, and the compactness may help with understandability (that's a judgement call!): [dict(d, name=n) for n, d in dod.items()] On Tue, Mar 30, 2021 at 12:42

Re: memory consumption

2021-03-30 Thread Stestagg
> I'm sorry. I didn't understand your question right. If I have 4 workers, > they require 4Gb > in idle state and some extra memory when they execute other tasks. If I > increase workers > count up to 16, they`ll eat all the memory I have (16GB) on my machine and > will crash as soon > as system ge

Re: memory consumption

2021-03-29 Thread Stestagg
> > 2. Can you try a test with 16 or 32 active workers (i.e. number of > > workers=2x available memory in GB), do they all still end up with 1gb > > usage? or do you get any other memory-related issues running this? > Yes. They will consume 1Gb each. It doesn't matter how many workers I > have, > t

Re: memory consumption

2021-03-29 Thread Stestagg
On Mon, Mar 29, 2021 at 2:32 PM Alexey wrote: > понедельник, 29 марта 2021 г. в 15:57:43 UTC+3, Julio Oña: > > It looks like the problem is on celery. > > The mentioned issue is still open, so not sure if it was corrected. > > > > https://manhtai.github.io/posts/memory-leak-in-celery/ > > As I me

Re: port to PDOS (especially mainframe)

2021-03-23 Thread Stestagg
On Tue, Mar 23, 2021 at 3:20 PM Michael Torrie wrote: > On 3/23/21 5:19 AM, Paul Edwards wrote: > > Thanks for the tip. I don't actually need it to be > > light. I just need it to be C90-compliant. > > I guess the point with MicroPython is that since it can build on all > sorts of microcontroller

Re: Why assert is not a function?

2021-03-02 Thread Stestagg
There is also the, I think seldom used, feature that calling python with '-O' removes all assert statements at parse/compile time (I believe for performance reasons) So for example: $ python -c 'assert False' Traceback (most recent call last): File "", line 1, in AssertionError But: $ python

Re: Is there a way to subtract 3 from every digit of a number?

2021-02-21 Thread Stestagg
With numpy and pandas, it's almost always best to start off with the simple, obvious solution. In your case, I would recommend defining a function, and calling `Series.map`, passing in that function. Sometimes, however, with large datasets, it's possible to use some pandas/numpy tricks to signif

Re: I need some help interpreting this error

2021-02-17 Thread Stestagg
/cd80f430daa7dfe7feeb431ed34f88db5f64aa30/Lib/email/utils.py#L51 On Wed, Feb 17, 2021 at 5:42 PM Stestagg wrote: > I don't particularly like to encourage this shotgun help request because, > as previous commenter suggests, debugging this yourself is best. > > Sometimes debugging is super hard, and e

Re: I need some help interpreting this error

2021-02-17 Thread Stestagg
I don't particularly like to encourage this shotgun help request because, as previous commenter suggests, debugging this yourself is best. Sometimes debugging is super hard, and especially so when uncommon situations occur, but it's always far easier to debug things when you have visibility into t

Re: UTF-16 or something else?

2021-02-09 Thread Stestagg
Try setting encoding to: "utf-8-sig". 'eb bb bf' is the byte order mark for UTF8 (most systems do not include this in UTF-8 encoded files) Python will correctly read UTF8 BOMs if you use the 'utf-8-sig' encoding when reading files Steve On Tue, Feb 9, 2021 at 2:56 PM Skip Montanaro wrote: >

Re: advice on debugging a segfault

2021-01-17 Thread Stestagg
I would normally agree, except... This is a refcount issue (I was able to reproduce the problem, gbd shows a free error ) And I wouldn't recommend DGBing a refcount issue as a beginner to debugging. The other mailing list identified a PIL bug that messes up the refcount for True, but this refcou

constructor classmethods

2016-11-02 Thread stestagg
Hi I was hoping to canvas opinion on using classmethods as constructors over __init__. We've got a colleague who is very keen that __init__ methods don't contain any logic/implementation at all, and if there is any, then it should be moved to a create() classmethod. As a concrete example, one