Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Cecil Westerhof via Python-list
s_running = True self._next() def stop(self): if self._is_running: self._timer.cancel() self._timer = None self._is_running = False -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Data unchanged when passing data to Python in multiprocessing shared memory

2022-02-02 Thread Avi Gross via Python-list
aside and the string use a null terminator if shorter. Of course if this big-endian issue also scrambles bytes used in strings, forget it. Or, maybe shared memory is not the easy way to go, even it it might be faster. -Original Message- From: Jen Kris To: Avi Gross Cc: python-list

Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Cecil Westerhof via Python-list
nce(interval, (int,float)): > > which handles subclasses of these types (but note that bool subclasses > int :-) Done, thanks. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Cecil Westerhof via Python-list
e > default; you don't need to say "class X(object)"), which will > automatically give your object all the methods of a timer. Of-course. I should have thought about that. :'-( -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Cecil Westerhof via Python-list
ng? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Cecil Westerhof via Python-list
> self._next() > self._is_running = True > > def stop(self): > if self._is_running: > self._timer.cancel() > self._timer = None > self._is_running = False -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Cecil Westerhof via Python-list
Chris Angelico writes: > On Thu, 3 Feb 2022 at 15:43, Cecil Westerhof via Python-list > wrote: >> >> Chris Angelico writes: >> >> >> > (Side point: The OP's code is quite inefficient, as it creates a new >> >> > thread for each reitera

Re: Waht do you think about my repeated_timer class

2022-02-03 Thread Cecil Westerhof via Python-list
Barry writes: >> On 3 Feb 2022, at 04:45, Cecil Westerhof via Python-list >> wrote: >> >> Have to be careful that timing keeps correct when target takes a 'lot' >> of time. >> Something to ponder about, but can wait. > > You have noticed

Re: Waht do you think about my repeated_timer class

2022-02-04 Thread Cecil Westerhof via Python-list
name … The class starts a thread where every by the user defined interval a by the user define function is called. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Waht do you think about my repeated_timer class

2022-02-04 Thread Cecil Westerhof via Python-list
Ethan Furman writes: > On 2/4/22 6:28 AM, Cecil Westerhof via Python-list wrote: > >> It was already not a good name, but I am rewriting the class >> completely, so now the name is a complete bumper. (No more timer.) I >> am thinking about naming the class repeating_

Re: Waht do you think about my repeated_timer class

2022-02-04 Thread Cecil Westerhof via Python-list
Igor Berger writes: > On Friday, February 4, 2022 at 12:28:53 PM UTC-5, Cecil Westerhof wrote: >> Ethan Furman writes: >> >> > On 2/4/22 6:28 AM, Cecil Westerhof via Python-list wrote: >> > >> >> It was already not a good name, but I am rewriting

RuntimeError, or user defined exception

2022-02-04 Thread Cecil Westerhof via Python-list
Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Waht do you think about my repeated_timer class

2022-02-04 Thread Cecil Westerhof via Python-list
Chris Angelico writes: > On Sat, 5 Feb 2022 at 04:33, Cecil Westerhof via Python-list > wrote: >> >> Ethan Furman writes: >> >> > On 2/4/22 6:28 AM, Cecil Westerhof via Python-list wrote: >> > >> >> It was already not a good name, but I am

Re: Waht do you think about my repeated_timer class

2022-02-04 Thread Avi Gross via Python-list
time_after_time But to be more pythonic, throw some double underscores before and after. -Original Message- From: Igor Berger To: [email protected] Sent: Fri, Feb 4, 2022 12:40 pm Subject: Re: Waht do you think about my repeated_timer class On Friday, February 4, 2022 at 12:28:53

Re: Openning Python program

2022-02-07 Thread Cecil Westerhof via Python-list
I think he did a great job of showing a vulnerability. But it was not appreciated and he was fired. :'-( -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Openning Python program

2022-02-07 Thread Cecil Westerhof via Python-list
t his little experiment showed. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Openning Python program

2022-02-08 Thread Cecil Westerhof via Python-list
Chris Angelico writes: > On Tue, 8 Feb 2022 at 06:51, Cecil Westerhof via Python-list > wrote: >> >> Chris Angelico writes: >> >> >> > How difficult would it be to get people to read those lines, though? >> >> >> >> That d

Can't get iterator in the C API

2022-02-08 Thread Jen Kris via Python-list
= PySeqIter_Check(pFidMod); pFidSeqIter  = PySeqIter_New(pFidMod); So the C API thinks gutenberg.fileids is not iterable, but it is.  What am I doing wrong? -- https://mail.python.org/mailman/listinfo/python-list

Re: Kind Remainder: How do Practitioners Approach towards Requirements Engineering?

2022-02-08 Thread Avi Gross via Python-list
? -Original Message- From: ETEM ÇETİN TOPTANİ To: [email protected] Sent: Tue, Feb 8, 2022 3:52 am Subject: Kind Remainder: How do Practitioners Approach towards Requirements Engineering? Dear Sir or Madam, We prepared a short survey to understand practitioners’ perspectives towards the

Re: Can't get iterator in the C API

2022-02-09 Thread Jen Kris via Python-list
Thank you for clarifying that.  Now on to getting the iterator from the method.  Jen Feb 8, 2022, 18:10 by [email protected]: > On 2022-02-09 01:12, Jen Kris via Python-list wrote: > >> I am using the Python C API to load the Gutenberg corpus from the nltk >> l

C API PyObject_Call segfaults with string

2022-02-09 Thread Jen Kris via Python-list
lib/x86_64-linux-gnu/libpython3.8.so.1.0 My guess is the problem is in Py_BuildValue, which returns a pointer but it may not be constructed correctly.  I also tried it with "O" and it doesn't segfault but it returns 0x0.  I'm new to using the C API.  Thanks for any help.  Jen -- https://mail.python.org/mailman/listinfo/python-list

Re: C API PyObject_Call segfaults with string

2022-02-09 Thread Jen Kris via Python-list
/vrut/python/ext/buildValue.html, PyBuildValue "builds a tuple only if its format string contains two or more format units" and that doc contains examples.  Feb 9, 2022, 16:52 by [email protected]: > On Thu, Feb 10, 2022 at 9:42 AM Jen Kris via Python-list > wrote: >

Re: C API PyObject_Call segfaults with string

2022-02-09 Thread Jen Kris via Python-list
_Call accept tuple, not str. > > > https://docs.python.org/3/c-api/call.html#c.PyObject_Call > >> >> Feb 9, 2022, 16:52 by [email protected]: >> >> On Thu, Feb 10, 2022 at 9:42 AM Jen Kris via Python-list >> wrote: >> >> >> I have everythi

Re: C API PyObject_Call segfaults with string

2022-02-09 Thread Jen Kris via Python-list
ple/amliu/vrut/python/ext/buildValue.html, >> PyBuildValue "builds a tuple only if its format string contains two or more >> format units" and that doc contains examples. >> >> >> Yes, and PyObject_Call accept tuple, not str. >> >> >> ht

Re: Best way to check if there is internet?

2022-02-09 Thread Avi Gross via Python-list
nhangeer about <https://compileralchemy.github.io/> | blog <https://www.pythonkitchen.com> github <https://github.com/Abdur-RahmaanJ> Mauritius -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list

Re: C API PyObject_Call segfaults with string

2022-02-09 Thread Jen Kris via Python-list
if (pSents == > NULL) return NULL`) > Then Python show the exception and traceback for you. > > -- > Inada Naoki > -- https://mail.python.org/mailman/listinfo/python-list

Re: Global VS Local Subroutines

2022-02-10 Thread Rob Cliffe via Python-list
things. But of course, performance is not the only consideration, as per Chris Angelico's answer. Best wishes Rob Cliffe -- https://mail.python.org/mailman/listinfo/python-list

Re: C API PyObject_Call segfaults with string

2022-02-10 Thread Jen Kris via Python-list
turn NULL (e.g. `if (pSents == > NULL) return NULL`) > Then Python show the exception and traceback for you. > > -- > Inada Naoki > -- https://mail.python.org/mailman/listinfo/python-list

Re: C API PyObject_Call segfaults with string

2022-02-10 Thread Jen Kris via Python-list
erday.  Thanks much for your help. Jen Feb 9, 2022, 18:43 by [email protected]: > On 2022-02-10 01:37, Jen Kris via Python-list wrote: > >> I'm using Python 3.8 so I tried your second choice: >> >> pSents = PyObject_CallFunctionObjArgs(pSentMod, pListItem); >

Re: C API PyObject_Call segfaults with string

2022-02-10 Thread Jen Kris via Python-list
Thank you for that suggestion.  It allowed me to replace six lines of code with one.  :) Feb 10, 2022, 12:43 by [email protected]: > On 2022-02-10 20:00, Jen Kris via Python-list wrote: > >> With the help of PyErr_Print() I have it solved.  Here is the final code

Re: Global VS Local Subroutines

2022-02-10 Thread Rob Cliffe via Python-list
which circumstances. -- https://mail.python.org/mailman/listinfo/python-list

Re: How to solve the given problem?

2022-02-10 Thread Avi Gross via Python-list
: NArshad To: [email protected] Sent: Thu, Feb 10, 2022 1:40 am Subject: How to solve the given problem? Assume that there is a pattern of feeding for a special fish in a day (10 hours a day) as below:                               150    100    30    30    30    20    20    10    5    5

C API - How to return a Dictionary as a Dictionary type

2022-02-14 Thread Jen Kris via Python-list
dictionary type, enclosed with curly braces.  I found PyObject_GenericGetDict (https://docs.python.org/3.8/c-api/object.html) but I haven't found any documentation or explanation of how it works.  Is PyObject_GenericGetDict what I need, or is there another way to do it? Thanks, Jen -- https://mail.python.org/mailman/listinfo/python-list

Re: C API - How to return a Dictionary as a Dictionary type

2022-02-14 Thread Jen Kris via Python-list
Yes, that works.  This is my first day with C API dictionaries.  Now that you've explained it, it makes perfect sense.  Thanks much.  Jen Feb 14, 2022, 17:24 by [email protected]: > On Tue, 15 Feb 2022 at 12:07, Jen Kris via Python-list > wrote: > >> >> I created a

Re: Long running process - how to speed up?

2022-02-19 Thread Avi Gross via Python-list
sleeping at the same time may be worse! I note badly defined questions get horrible answers. Mine included. -Original Message- From: Alan Gauld To: [email protected] Sent: Sat, Feb 19, 2022 7:33 am Subject: Fwd: Re: Long running process - how to speed up? On 19/02/2022 11:28, Shaozhong

Re: Why does not Python accept functions with no names?

2022-02-20 Thread Avi Gross via Python-list
://www.pythonkitchen.com> github <https://github.com/Abdur-RahmaanJ> Mauritius -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list

Re: Long running process - how to speed up?

2022-02-20 Thread Avi Gross via Python-list
Wichmann Cc: [email protected] Sent: Sun, Feb 20, 2022 1:05 pm Subject: Re: Long running process - how to speed up? On Sat, 19 Feb 2022 at 19:44, Mats Wichmann wrote: > On 2/19/22 05:09, Shaozhong SHI wrote: > > Can it be divided into several processes? > > Regards, > > Da

Re: Why does not Python accept functions with no names?

2022-02-20 Thread Avi Gross via Python-list
be able to make many such pseudo-anonymous functions, in the end, there can only be one. -Original Message- From: Greg Ewing To: [email protected] Sent: Sun, Feb 20, 2022 5:17 pm Subject: Re: Why does not Python accept functions with no names? On 21/02/22 6:27 am, Abdur-Rahmaan

Re: Why does not Python accept functions with no names?

2022-02-21 Thread Avi Gross via Python-list
the user that in case they actually wanted a real function, it is now mxyzptlk666 ... -Original Message----- From: Eryk Sun To: [email protected] Sent: Mon, Feb 21, 2022 2:35 am Subject: Re: Why does not Python accept functions with no names? On 2/20/22, Greg Ewing wrote: > > BTW,

Re: One-liner to merge lists?

2022-02-22 Thread Avi Gross via Python-list
7;, 'ccc'], ['fff', 'ggg']] As shown the list comprehension itself is not returning anything of value and need not be assigned to anything. But it then generally is set to autoprint and that can be supressed by assigning the value to _ or anything you can ignore. I

Re: Best way to check if there is internet?

2022-02-22 Thread Avi Gross via Python-list
e we start. Of course, it can change in the seconds that follow. But it's too much pure logic at work. -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list

Re: One-liner to merge lists?

2022-02-22 Thread Avi Gross via Python-list
27;, 'ggg', 666, 'e', 'u', 'a', 'o', 'i'] The quest for a one-liner sometimes forgets that a typical function call is also a one-liner, with the work hidden elsewhere, often in a module written in python or mainly in C and so on. I suspect m

Re: Long running process - how to speed up?

2022-02-23 Thread Robert Latest via Python-list
Shaozhong SHI wrote: > Can it be divided into several processes? I'd do it like this: from time import sleep from threading import Thread t = Thread(target=lambda: sleep(1)) t.run() # do your work here t.wait() -- https://mail.python.org/mailman/listinfo/python-list

Coding help

2022-02-23 Thread Richard Pullin via Python-list
, Richard -- https://mail.python.org/mailman/listinfo/python-list

Re: Best way to check if there is internet?

2022-02-23 Thread Robert Latest via Python-list
we check for the ability to do it > before we start. Nothing wrong with checking before. > Of course, it can change in the seconds that follow. But it's too much pure > logic at work. No. It's the correct way of doing it. -- https://mail.python.org/mailman/listinfo/python-list

Re: Best way to check if there is internet?

2022-02-23 Thread Robert Latest via Python-list
tion. > So it detected that there is or there is no internet ... Your application obviously needs to make a certain network connection. Why don't you just check if the connection can be made? Why would you care if it's via cable or Wifi? -- https://mail.python.org/mailman/listinfo/python-list

Threading question .. am I doing this right?

2022-02-24 Thread Robert Latest via Python-list
ache.append() because _update() can ever only run in one thread at a time. But maybe I'm overlooking something. -- https://mail.python.org/mailman/listinfo/python-list

Re: Threading question .. am I doing this right?

2022-02-25 Thread Robert Latest via Python-list
se, so that some screens displayed error messages for a minute or two. Nobody cares but my pride was piqued and the error logs filled up. I've had my proposed solution running for a few days now without errors. For me that's enough but I wanted to ask you guys if I made some logical mistakes. -- https://mail.python.org/mailman/listinfo/python-list

Re: Threading question .. am I doing this right?

2022-02-25 Thread Robert Latest via Python-list
a future update. I don't think that's a problem. If it turns out to be one I'll create a copy of the data while I hold the lock and pass that back. > -- https://mail.python.org/mailman/listinfo/python-list

Re: C is it always faster than nump?

2022-02-25 Thread Avi Gross via Python-list
C. It may well be optimized in some places but there are constraints that may well make it hard to optimize compared to some other implementation without those constraints. In particular, it interfaces with standard Python data structures at times such as when initializing from a Python List,

Re: C is it always faster than nump?

2022-02-25 Thread Avi Gross via Python-list
used by so many languages cannot be made part of python such as a vector/array that holds exactly one kind of data structure and not force use of things like a list when that is more than is needed? -Original Message- From: Grant Edwards To: [email protected] Sent: Fri, Feb 25, 20

Re: C is it always faster than nump?

2022-02-25 Thread Avi Gross via Python-list
other scientific and machine learning modules. Of course not everyone needs or even wants this. Many simply use base Python techniques even if they are low for larger amounts of data. -- https://mail.python.org/mailman/listinfo/python-list

Re: C is it always faster than nump?

2022-02-25 Thread Avi Gross via Python-list
g on the same language, Python? -Original Message----- From: Chris Angelico To: [email protected] Sent: Fri, Feb 25, 2022 2:58 pm Subject: Re: C is it always faster than nump? On Sat, 26 Feb 2022 at 06:44, Avi Gross via Python-list wrote: > > I agree with Richard. > > Some people m

Re: C is it always faster than nump?

2022-02-25 Thread Avi Gross via Python-list
problems. -Original Message- From: Chris Angelico To: [email protected] Sent: Fri, Feb 25, 2022 11:16 pm Subject: Re: C is it always faster than nump? On Sat, 26 Feb 2022 at 14:35, Avi Gross via Python-list wrote: > But with numpy and more available anyway, it may not be necessary

Re: Best way to check if there is internet?

2022-02-26 Thread Robert Latest via Python-list
Chris Angelico wrote: > Every language learns from every other. Except Visual Basic, which didn't learn anything from anywhere, and all that can be learned from it is how not to do it. Ugh. -- https://mail.python.org/mailman/listinfo/python-list

Getting Syslog working on OSX Monterey

2022-02-27 Thread Philip Bloom via Python-list
)-338-1439 <786-338-1439> [image: LinkedIn] <https://www.linkedin.com/company/applovin> [image: Twitter] <https://twitter.com/AppLovin> [image: Facebook] <https://facebook.com/AppLovin> [image: Instagram] <https://www.instagram.com/applovin/> [image: AppLovin] <https://www.applovin.com/> -- https://mail.python.org/mailman/listinfo/python-list

Re: Getting Syslog working on OSX Monterey

2022-02-27 Thread Philip Bloom via Python-list
;? [CA= Sender appName] file /var/log/appName/appName.log > > > >My end goal is really to get just a working python logging -> > >var/log/appname/appname.log again so glad to just be pointed in the right > >direction if way off base. > > > -- > Wulfra

Re: Threading question .. am I doing this right?

2022-02-28 Thread Robert Latest via Python-list
- https://mail.python.org/mailman/listinfo/python-list

Re: SQLAlchemy: JSON vs. PickleType vs. raw string for serialised data

2022-02-28 Thread Robert Latest via Python-list
o JSON or String. I've done exactly this. Since my data was strictly ASCII I decided to go for JSON. But in the end you're the only one who can decide this because only you know the data. That's why you won't find any hard and fast rule for this. -- https://mail.python.org/mailman/listinfo/python-list

Re: SQLAlchemy: JSON vs. PickleType vs. raw string for serialised data

2022-03-01 Thread Robert Latest via Python-list
acters in utf8mb4 character set. -- https://mail.python.org/mailman/listinfo/python-list

Re: All permutations from 2 lists

2022-03-01 Thread Rob Cliffe via Python-list
t;us-east-2"), ("Windows", "us-east-1"), "Windows", "us-east-2')] The lists can be different lengths or can be 0 length. Tried a few different things with itertools but have not got just what I need. TIA! -- https://mail.python.org/mailman/listinfo/python-list

Re: All permutations from 2 lists

2022-03-02 Thread Avi Gross via Python-list
ind for future questions. -- https://mail.python.org/mailman/listinfo/python-list

Re: Getting Syslog working on OSX Monterey

2022-03-02 Thread Philip Bloom via Python-list
ld expect as the default if you are using the C > API. > > What you do not see used in the SyslogHandler() is the import syslog > and hence its nor using openlog() etc from syslog API. > > Barry > > > > >hp > > > > -- > > _ | Peter J. Holz

Re: All permutations from 2 lists

2022-03-03 Thread Rob Cliffe via Python-list
On 03/03/2022 14:07, Larry Martell wrote: On Wed, Mar 2, 2022 at 9:42 PM Avi Gross via Python-list wrote: Larry, i waited patiently to see what others will write and perhaps see if you explain better what you need. You seem to gleefully swat down anything offered. So I am not tempted to

Re: All permutations from 2 lists

2022-03-03 Thread Avi Gross via Python-list
It is clear that was not quite your real need. -Original Message- From: Larry Martell To: Avi Gross Cc: [email protected] Sent: Thu, Mar 3, 2022 9:07 am Subject: Re: All permutations from 2 lists On Wed, Mar 2, 2022 at 9:42 PM Avi Gross via Python-list wrote: > >

Re: Behavior of the for-else construct

2022-03-03 Thread Rob Cliffe via Python-list
rator), and then -- if there are any elements -- processing the first element separately before the for-loop, which means duplicating the loop body. You can see the whole thing gets really ugly really quickly... What are your thoughts? Do you agree? Or am I just not Dutch enough...? -- https://mail.python.org/mailman/listinfo/python-list

Re: Timezone jokes (was: All permutations from 2 lists)

2022-03-03 Thread Avi Gross via Python-list
: Chris Angelico To: [email protected] Sent: Thu, Mar 3, 2022 12:40 pm Subject: Re: Timezone jokes (was: All permutations from 2 lists) On Fri, 4 Mar 2022 at 03:29, Tim Chase wrote: > > On 2022-03-03 06:27, Grant Edwards wrote: > > On 2022-03-03, Chris Angelico wrote: > > &

Re: Getting Syslog working on OSX Monterey

2022-03-03 Thread Philip Bloom via Python-list
listener on localhost:514. There are no deamons >> listening on port 514 on my Fedora systems or mac OS. >> >> That is not what you would expect as the default if you are using the C >> API. >> >> What you do not see used in the SyslogHandler() is the impor

Re: Behavior of the for-else construct

2022-03-03 Thread Jon Ribbens via Python-list
ng "Re: replacing `else` with `then` in `for` and `try`". I'm not sure any particular conclusion was reached though except that some people think 'else' is more intuitive and some people think 'then' would be more intuitive. -- https://mail.python.org/mailman/listinfo/python-list

Re: Behavior of the for-else construct

2022-03-03 Thread Avi Gross via Python-list
age must be added to sparingly and with so many requests, perhaps only a few non bug-fixes can seriously be considered. -Original Message- From: Akkana Peck To: [email protected] Sent: Thu, Mar 3, 2022 5:33 pm Subject: Re: Behavior of the for-else construct computermaster360 writes

Re: Behavior of the for-else construct

2022-03-03 Thread Rob Cliffe via Python-list
Cliffe On 03/03/2022 23:07, Avi Gross via Python-list wrote: The drumbeat I keep hearing is that some people hear/see the same word as implying something else. ELSE is ambiguous in the context it is used. And naturally, since nobody desperately wants to use non-reserved keywords, nobody seems

Re: Behavior of the for-else construct

2022-03-03 Thread Avi Gross via Python-list
g keyboards is a challenge. Back to the topic, I was thinking wickedly of a way to extend the FOR loop with existing keywords while sounding a tad ominous is not with an ELSE but a FOR ... OR ELSE ... -Original Message- From: Rob Cliffe via Python-list To: [email protected] Sent:

Re: Behavior of the for-else construct

2022-03-03 Thread Avi Gross via Python-list
n NEVERTHELESS. -Original Message- From: Chris Angelico To: [email protected] Sent: Thu, Mar 3, 2022 7:34 pm Subject: Re: Behavior of the for-else construct On Fri, 4 Mar 2022 at 10:09, Avi Gross via Python-list wrote: > > The drumbeat I keep hearing is that some people h

Re: Behavior of the for-else construct

2022-03-03 Thread Rob Cliffe via Python-list
On 04/03/2022 00:34, Chris Angelico wrote: On Fri, 4 Mar 2022 at 10:09, Avi Gross via Python-list wrote: The drumbeat I keep hearing is that some people hear/see the same word as implying something else. ELSE is ambiguous in the context it is used. What I'm hearing is that ther

Re: Behavior of the for-else construct

2022-03-03 Thread Rob Cliffe via Python-list
On 04/03/2022 00:38, Avi Gross via Python-list wrote: Rob, I regularly code with lots of comments like the one you describe, or mark the end of a region that started on an earlier screen such as a deeply nested construct. So do I (and not just in Python).  It's good practice. I hav

Re: Behavior of the for-else construct

2022-03-03 Thread Rob Cliffe via Python-list
On 04/03/2022 00:43, Chris Angelico wrote: On Fri, 4 Mar 2022 at 11:14, Rob Cliffe via Python-list wrote: I find it so hard to remember what `for ... else` means that on the very few occasions I have used it, I ALWAYS put a comment alongside/below the `else` to remind myself (and anyone

Re: Behavior of the for-else construct

2022-03-03 Thread Rob Cliffe via Python-list
On 04/03/2022 01:44, Ethan Furman wrote: On 3/3/22 5:32 PM, Rob Cliffe via Python-list wrote: > There are three types of programmer: those that can count, and those that can't. Actually, there are 10 types of programmer:  those that can count in binary, and those that can't.

Re: Behavior of the for-else construct

2022-03-03 Thread Rob Cliffe via Python-list
#x27;if a break occurred', then at least only one debtor is killed, as an example to the others, and no Exception will occur in the unlikely event of "debtors" being empty. Happy fund-raising! Rob Cliffe There's something in this. ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: Behavior of the for-else construct

2022-03-03 Thread Avi Gross via Python-list
hen you die and it simplifies. -Original Message- From: Rob Cliffe via Python-list To: [email protected] Sent: Thu, Mar 3, 2022 8:41 pm Subject: Re: Behavior of the for-else construct On 04/03/2022 00:38, Avi Gross via Python-list wrote: > Rob, > > I regularly code with l

Re: Behavior of the for-else construct

2022-03-03 Thread Avi Gross via Python-list
an ELSE dangling. -Original Message- From: Jach Feng To: [email protected] Sent: Thu, Mar 3, 2022 9:22 pm Subject: Re: Behavior of the for-else construct I never feel confused by "else" because I always think it in "break...else", not "for...else".

Re: Behavior of the for-else construct

2022-03-04 Thread Avi Gross via Python-list
as discussed, you could do an IF statement to check if closet is empty but for iterators, it gets ... -Original Message- From: Dieter Maurer To: Rob Cliffe Cc: [email protected] Sent: Fri, Mar 4, 2022 2:12 am Subject: Re: Behavior of the for-else construct Rob Cliffe wrote at 2022-3

Re: Behavior of the for-else construct

2022-03-04 Thread Avi Gross via Python-list
t be. I am not one of those that find the current implementation to be the wrong one and will happily use it when I have code that can be done well that way. I am just discussing the issue and wider ones. Languages have an amazing variety of designs that fascinate me. -Original Message

Re: Behavior of the for-else construct

2022-03-04 Thread Avi Gross via Python-list
ye==4 after the loop. The above loop would leave it as aye==None which keeps it from being undefined. To decide if the loop ran at all would thus require further code such as: if aye == None: ... Which leads me right back to wondering why the sentinel approach is so bad! -Origi

Re: Behavior of the for-else construct

2022-03-04 Thread Avi Gross via Python-list
lows something like: result = for ... That might return 0 or None if it was part of the language but it is not. Avi (my current first name) -Original Message- From: Om Joshi To: Avi Gross Cc: python-list Sent: Fri, Mar 4, 2022 3:04 pm Subject: Re: Behavior of the for-else constru

Re: Behavior of the for-else construct

2022-03-04 Thread Rob Cliffe via Python-list
On 04/03/2022 20:52, Avi Gross via Python-list wrote: I have an observation about exception handling in general. Some people use exceptions, including ones they create and throw, for a similar idea. You might for example try to use an exception if your first attempt fails that specifies

Re: Behavior of the for-else construct

2022-03-04 Thread Avi Gross via Python-list
situations where almost all programs are found in the first component of PATH, perhaps the exception approach is not horrible. It may even at times be done with less coding effort than other alternatives. Not my preferred way, of course. -Original Message- From: Rob Cliffe via Python-list

Re: Behavior of the for-else construct

2022-03-04 Thread Avi Gross via Python-list
ing code hard for anyone else to deal with so yes, I would not rewrite key components or do something like make new function names that point to existing standard functions and only use the new (often not pronounceable) names. -Original Message- From: Peter J. Holzer To: pyt

Re: Behavior of the for-else construct

2022-03-05 Thread Rob Cliffe via Python-list
On 05/03/2022 01:15, Cameron Simpson wrote: I sort of wish it had both "used break" and "did not use break" branches, a bit like try/except/else. And "zero iterations". Rob Cliffe -- https://mail.python.org/mailman/listinfo/python-list

Re: Behavior of the for-else construct

2022-03-05 Thread Avi Gross via Python-list
my part of this endless conversation may have gone a bit beyond far enough and I await some new topics. -Original Message- From: Rob Cliffe via Python-list To: [email protected] Sent: Sat, Mar 5, 2022 7:15 am Subject: Re: Behavior of the for-else construct On 05/03/2022 01:15, Camer

Re: Behavior of the for-else construct

2022-03-05 Thread Avi Gross via Python-list
To: [email protected] Sent: Sat, Mar 5, 2022 1:39 pm Subject: Re: Behavior of the for-else construct On 04/03/2022 18.11, Peter J. Holzer wrote: > On 2022-03-04 23:47:09 +, Avi Gross via Python-list wrote: >> I am not sure a reply is needed, Peter, and what you say is true. But

Help: Unable to find IDLE folder inside the Python Lib folder

2022-03-05 Thread Deji Olofinboba via Python-list
IDLE; still the IDLE is still missing. Please. explain to me how I can retrieve the python IDLE. Thank You,   Deji Olofinboba  -- https://mail.python.org/mailman/listinfo/python-list

Re: Behavior of the for-else construct

2022-03-05 Thread Avi Gross via Python-list
and other languages to undergrads ;-) -Original Message- From: Dennis Lee Bieber To: [email protected] Sent: Sat, Mar 5, 2022 7:00 pm Subject: Re: Behavior of the for-else construct On Sat, 5 Mar 2022 21:40:08 + (UTC), Avi Gross declaimed the following: >I am not sure how we end

Re: Behavior of the for-else construct

2022-03-06 Thread Avi Gross via Python-list
orrect, it has a proper spelling. But following that reasoning, why does anyone give an email address of [email protected] or [email protected] instead of ...? -----Original Message- From: Peter J. Holzer To: [email protected] Sent: Sun, Mar 6, 2022 12:48 pm Subject: Re: Behavior

C API PyObject_CallFunctionObjArgs returns incorrect result

2022-03-06 Thread Jen Kris via Python-list
, \',\', "\'Emma", "\'", \',\', "\'by", "\'", \',\', "\'Jane", "\'", \',\', "\'Austen", "\'", \',\', "\'1816", "\'", \',\', "\'", \']\', "\'", \']\']' I also tried this with PyObject_CallMethodObjArgs and PyObject_Call without success.  Thanks for any help on this.  Jen -- https://mail.python.org/mailman/listinfo/python-list

Re: C API PyObject_CallFunctionObjArgs returns incorrect result

2022-03-07 Thread Jen Kris via Python-list
the same way as ‘’.join, and if not then (2) how can I strip characters from a string object in the C API?  Thanks. Mar 6, 2022, 17:42 by [email protected]: > On 2022-03-07 00:32, Jen Kris via Python-list wrote: > >> I am using the C API in Python 3.8 with the nltk

Re: C API PyObject_CallFunctionObjArgs returns incorrect result

2022-03-07 Thread Jen Kris via Python-list
The PyObject str_sentence is a string representation of a list.  I need to convert the list to a string like "".join because that's what the library call takes.  Mar 7, 2022, 09:09 by [email protected]: > On Tue, 8 Mar 2022 at 04:06, Jen Kris via Python-list > wrote: &g

Re: C API PyObject_CallFunctionObjArgs returns incorrect result

2022-03-07 Thread Jen Kris via Python-list
e way as ‘’.join, and if not then (2) how >> can I strip characters from a string object in the C API? >> > Your Python code is joining the list with a space as the separator. > > The equivalent using the C API is: > >     PyObject* separator; >     PyObject*

Problem slicing a list with the C API

2022-03-12 Thread Jen Kris via Python-list
ideas. Jen -- https://mail.python.org/mailman/listinfo/python-list

Re: Problem slicing a list with the C API

2022-03-12 Thread Jen Kris via Python-list
s.com: > On 2022-03-12 21:24, Jen Kris via Python-list wrote: > >> I have a C API project where I have to slice a list into two parts.   >> Unfortunately the documentation on the slice objects is not clear enough for >> me to understand how to do this, and I haven’t found e

Re: Problem slicing a list with the C API

2022-03-12 Thread Jen Kris via Python-list
pDictData, despite the name, is a list of 2-tuples where each 2-tuple is a dictionary object and a string.  Mar 12, 2022, 13:41 by [email protected]: > On Sun, 13 Mar 2022 at 08:25, Jen Kris via Python-list > wrote: > >> PyObject* slice = PySlice_New(PyLong_FromLong(0)

<    26   27   28   29   30   31   32   33   34   35   >