Re: .title() - annoying mistake

2021-03-22 Thread Karen Shaeffer via Python-list
Hi Chris, Thanks for your comment. > Python doesn't work with UTF-8 encoded code points; it works with > Unicode code points. Are you looking for something that checks whether > something is a palindrome, or locates palindromes within it? > > def is_palindrome(txt): >return txt == txt[::-1] >

Re: .title() - annoying mistake

2021-03-19 Thread Karen Shaeffer via Python-list
> On Mar 19, 2021, at 9:42 AM, Grant Edwards wrote: > > On 2021-03-19, Skip Montanaro wrote: >>> >>> That's annoying. You have to roll your own solution! >>> >> >> Certainly seems like a known issue: >> >> https://bugs.python.org/issue12737 > > While that is an issue with string.title(),

Re: What's the meaning the "backlog" in the socket.listen(backlog) is?

2021-02-17 Thread Karen Shaeffer via Python-list
> On Feb 17, 2021, at 12:25 AM, Karen Shaeffer via Python-list > wrote: > > > >> On Feb 16, 2021, at 8:10 PM, Jason Friedman wrote: >> >>> >>> I set listen(2) and expect to see "error" when more clients than "the >>> ma

Re: What's the meaning the "backlog" in the socket.listen(backlog) is?

2021-02-17 Thread Karen Shaeffer via Python-list
> On Feb 16, 2021, at 8:10 PM, Jason Friedman wrote: > >> >> I set listen(2) and expect to see "error" when more clients than "the >> maximum number of queued connections" trying to connect the server. But, no >> error!! Even 4 clients can run normally without problem. >> >> Am I misunderstan

io.TextIOWrapper.readlines

2020-11-11 Thread Karen Shaeffer via Python-list
Hi folks, import io with io.open(filename, ‘r’) as fd: lines = fd.readlines(hint=1000) for line in lines: # do something I was just looking at the io module. io.open(‘file’, ‘r') returns an io.TextIOWrapper object, which has the io.TextIOWrapper.readlines(hint=-1/) method. >>>

Re: Live Write to File with Code That is Reading File and Writing to Serial Port

2020-10-28 Thread Karen Shaeffer via Python-list
> On Oct 28, 2020, at 5:49 AM, ktkelly_1 wrote: > > Currently have a code that takes in a .txt file and submits commands to the > serial. Then it reads the reply from the serial port and writes it to a > hardcoded .txt file. The problem is it doesn't save it live and so if I need > to stop th

Re: Debugging a memory leak

2020-10-22 Thread Karen Shaeffer via Python-list
> On Oct 22, 2020, at 5:51 PM, Pasha Stetsenko wrote: > > Dear Python gurus, > > I'm a maintainer of a python library "datatable" (can be installed from > PyPi), and i've been recently trying to debug a memory leak that occurs in > my library. > The program that exposes the leak is quite simp

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Karen Shaeffer via Python-list
Hi Sam, I’ve been using abseil python API. https://abseil.io/docs/python/guides/flags https://abseil.io/docs/python/quickstart It’s a distributed command line system with features that appear to support you

Re: Threading plus multiprocessing plus cv2 error

2020-08-30 Thread Karen Shaeffer via Python-list
> On Aug 29, 2020, at 10:12 PM, Stephane Tougard via Python-list > wrote: > > On 2020-08-29, Dennis Lee Bieber wrote: >> Under Linux, multiprocessing creates processes using fork(). That means >> that, for some fraction of time, you have TWO processes sharing the same >> thread and all t

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-19 Thread Karen Shaeffer via Python-list
> On Aug 19, 2020, at 8:47 AM, Tim Daneliuk wrote: > > On 8/19/20 8:35 AM, Alexandre Brault wrote: >> I've not seen anyone objecting to the idea of removing the reference to >> Strunk and White in favour of the underlying message of "be understandable >> by others who may read your comments"

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread Karen Shaeffer via Python-list
> On Aug 18, 2020, at 6:13 PM, Richard Damon wrote: > > On 8/18/20 7:34 PM, rmli...@riseup.net wrote: >> I would also caution against relying on the idea of human rights when >> defending against accusations of being political, since they too are >> political. Life is political. We continue to

Re: get the terminal's size

2019-01-15 Thread Karen Shaeffer
That will tell you the terminal size at the time Python was started. If the terminal size has changed while Python was running, those environment variables will be wrong. You need to use the TIOCGWINSZ ioctl call: http://www.delorie.com/djgpp/doc/libc/libc_495.html And to detect the si

Re: Are all items in list the same?

2019-01-08 Thread Karen Shaeffer
False all_equal(tlst) times = [1.3971288939937949e-05] seconds. all_equal_array_list(tlst) times = [2.3801841149106623e-06] seconds. Karen. On Tue, Jan 8, 2019 at 9:01 PM Karen Shaeffer wrote: > There were some issues with my test. After sending the email, I thought > > those ti

Re: Are all items in list the same?

2019-01-08 Thread Karen Shaeffer
t/1e6 for _t in tae]} seconds.\n") taeal = timeit.repeat(timeit_all_equal_array_list,repeat=2,number=100,globals=globals()) print(f"all_equal_array_list(tlst) times = {[_t/1e6 for _t in taeal]} seconds.\n") On Tue, Jan 8, 2019 at 3:11 PM Karen Shaeffer wrote: &

Re: Are all items in list the same?

2019-01-08 Thread Karen Shaeffer
On 08Jan2019 15:28, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: >>>>> a = [1, 1, 1, 1, 1] >>>>> a[1:] == a[:-1] >>True >>>>> a == a[::-1] >>True >> >>>>> a = [1, 2, 3, 4, 3, 2, 1] >>>>> a[1:] == a[:-1] >>False >>>>> a == a[::-1] >>True