Re: Decoding bytes to text strings in Python 2

2024-06-21 Thread Chris Angelico via Python-list
On Sat, 22 Jun 2024 at 03:28, Rayner Lucas via Python-list wrote: > I'm curious about something I've encountered while updating a very old > Tk app (originally written in Python 1, but I've ported it to Python 2 > as a first step towards getting it running on modern systems). > > I am using

Decoding bytes to text strings in Python 2

2024-06-21 Thread Rayner Lucas via Python-list
I'm curious about something I've encountered while updating a very old Tk app (originally written in Python 1, but I've ported it to Python 2 as a first step towards getting it running on modern systems). The app downloads emails from a POP server and displays them. At the moment, the code

glibc strverscmp called from python

2024-06-20 Thread vallor via Python-list
So there's been discussion in comp.lang.c and comp.unix.shell about doing a "versionsort(3)" type sort on a list of parameters. glibc offers strverscmp(3) for this type of sort, and here I am posting a q python program to expose that to its sort routine for commentary and future reference.

Re: Timezone in HH:MM Format

2024-06-18 Thread Ivan "Rambius" Ivanov via Python-list
Thank you all for your responses! On Tue, Jun 18, 2024 at 9:54 PM Jon Ribbens via Python-list wrote: > > datetime.now(ZoneInfo("America/New_York")).isoformat() Both .isoformat() and "%:z" work. -- Tangra Mega Rock: http://www.radiotangra.com --

Re: Timezone in HH:MM Format

2024-06-18 Thread Jon Ribbens via Python-list
On 2024-06-18, Ivan "Rambius" Ivanov wrote: > Hello, > > How can I convert a date, usually datetime.now(), into a format where > the timezone is in hours:minutes format. I was able to get that format > in shell: > > $ date +%Y-%m-%dT%H:%M:%S%:z > 2024-06-18T19:24:09-04:00 > > The closest I got in

Re: Timezone in HH:MM Format

2024-06-18 Thread MRAB via Python-list
On 2024-06-19 00:32, Ivan "Rambius" Ivanov via Python-list wrote: Hello, How can I convert a date, usually datetime.now(), into a format where the timezone is in hours:minutes format. I was able to get that format in shell: $ date +%Y-%m-%dT%H:%M:%S%:z 2024-06-18T19:24:09-04:00 The closest I

Timezone in HH:MM Format

2024-06-18 Thread Ivan "Rambius" Ivanov via Python-list
Hello, How can I convert a date, usually datetime.now(), into a format where the timezone is in hours:minutes format. I was able to get that format in shell: $ date +%Y-%m-%dT%H:%M:%S%:z 2024-06-18T19:24:09-04:00 The closest I got in python is from datetime import datetime from zoneinfo import

Re: in Python: (101 102 103 201 202 203 301 302 303 401 402 403 )

2024-06-18 Thread Peter J. Holzer via Python-list
On 2024-06-14 06:10:06 -, candycanearter07 via Python-list wrote: > Phil Carmody wrote at 12:01 this Thursday (GMT): > > I'd say you can't beat the verbosity, or lack thereof of just plain > > zsh/bash: > > $ echo {1,2,3,4}0{1,2,3} > > 101 102 103 201 202 203 301 302 303 401 402 403 > >

Re: Anonymous email users

2024-06-18 Thread Grant Edwards via Python-list
On 2024-06-18, Mats Wichmann via Python-list wrote: > On 6/17/24 17:51, dn via Python-list wrote: > >> +1 >> >> The "public" part is not to embarrass posters, but recognition that >> there are likely other people 'out there' (or arriving in-future if they >> care to read the archives)

Re: Anonymous email users

2024-06-18 Thread Mats Wichmann via Python-list
On 6/17/24 17:51, dn via Python-list wrote: +1 The "public" part is not to embarrass posters, but recognition that there are likely other people 'out there' (or arriving in-future if they care to read the archives) experiencing a similar problem. (hence need for descriptive Subject lines -

Re: win32clipboard writing to clipboard on Windows 11

2024-06-18 Thread Eryk Sun via Python-list
On Tue, Jun 18, 2024 at 2:19 AM Eryk Sun wrote: > > > def set_clipboard_text(text): > hMem = global_alloc_text(text) > try: > win32clipboard.SetClipboardData(win32clipboard.CF_UNICODETEXT, > hMem) > # Now the

Re: win32clipboard writing to clipboard on Windows 11

2024-06-18 Thread Eryk Sun via Python-list
On Mon, Jun 17, 2024 at 8:36 PM MRAB via Python-list wrote: > On 2024-06-17 20:27, Rob Cliffe via Python-list wrote: > > > SetClipboardData(CF_UNICODETEXT, "0") > > CloseClipboard() win32clipboard.SetClipboardData() first tries to covert the second argument as an integer handle to global memory,

Re: win32clipboard writing to clipboard on Windows 11

2024-06-17 Thread Thomas Passin via Python-list
On 6/17/2024 9:30 PM, MRAB via Python-list wrote: On 2024-06-17 20:27, Rob Cliffe via Python-list wrote: Recently I acquired a new laptop running WIndows 11; my previous one uses WIndows 10.  I encountered a strange problem: I am using the win32clipboard backage (part of pywin32), and when I

Re: win32clipboard writing to clipboard on Windows 11

2024-06-17 Thread MRAB via Python-list
On 2024-06-17 20:27, Rob Cliffe via Python-list wrote: Recently I acquired a new laptop running WIndows 11; my previous one uses WIndows 10.  I encountered a strange problem: I am using the win32clipboard backage (part of pywin32), and when I use SetClipboardData() to write text which consists

Re: Anonymous email users

2024-06-17 Thread dn via Python-list
On 18/06/24 05:29, Roel Schroeven via Python-list wrote: AVI GROSS via Python-list schreef op 17/06/2024 om 17:03: I simply am thinking that people who do not allow me to easily reply to them directly, should be ignored by me and not get my cooperation that way. FWIW, personally I (mostly)

RE: Anonymous email users

2024-06-17 Thread AVI GROSS via Python-list
It seems clear we have people on mailing lists that see it as a purely public forum, and that is fine for them. I have found plenty of times I choose not to continue in public and waste time for people as in this reply on a topic I raised and now will move away from. I have in the past, for

Re: Anonymous email users

2024-06-17 Thread Grant Edwards via Python-list
On 2024-06-17, Roel Schroeven via Python-list wrote: > FWIW, personally I (mostly) don't see the point of replying to people > personally. To me a public mailing list is much like any public forum, > where my expectation is that conversations happen in public. To me it > always feels weird

win32clipboard writing to clipboard on Windows 11

2024-06-17 Thread Rob Cliffe via Python-list
Recently I acquired a new laptop running WIndows 11; my previous one uses WIndows 10.  I encountered a strange problem: I am using the win32clipboard backage (part of pywin32), and when I use SetClipboardData() to write text which consists ***entirely of digits*** to the clipboard, I either get

Re: Anonymous email users

2024-06-17 Thread Roel Schroeven via Python-list
AVI GROSS via Python-list schreef op 17/06/2024 om 17:03: I simply am thinking that people who do not allow me to easily reply to them directly, should be ignored by me and not get my cooperation that way. FWIW, personally I (mostly) don't see the point of replying to people personally. To me a

RE: Anonymous email users

2024-06-17 Thread AVI GROSS via Python-list
Thanks, Marco, for explaining. I, personally, have no interest in finding out who people are in this case. I simply am thinking that people who do not allow me to easily reply to them directly, should be ignored by me and not get my cooperation that way. I do understand reasons people use fake

Re: Anonymous email users

2024-06-17 Thread Marco Moock via Python-list
On 15.06.2024 um 10:30 Uhr dn wrote: > These mailing-lists all run under the Python Code of Conduct. > > This also effects a conundrum. Firstly, that someone abusing others > (for example) shall be held responsible. Secondly, that in order to > hold someone responsible, he/she/... must be

Re: Suggested python feature: allowing except in context maneger

2024-06-17 Thread j via Python-list
On 2024-06-13 23:49, Cameron Simpson via Python-list wrote: On 13Jun2024 19:44, dieter.mau...@online.de wrote: Why not use: ``` try:  with open()...    ... except FileNotFoundError:  ... ``` This is exactly what the OP was expressing dissatisfaction with. I'm -1 on the idea myself - not

Re: Suggested python feature: allowing except in context maneger

2024-06-16 Thread Albert-Jan Roskam via Python-list
The example exception is not what bothers me. The syntax change is nowhere near as useful as `with` and context managers. They provide an excellent idiom for resource usage and release. Your suggestion complicates the `with` statement and brings only a tiny indentation

Re: Suggested python feature: allowing except in context maneger

2024-06-14 Thread Cameron Simpson via Python-list
On 14Jun2024 09:07, Yair Eshel wrote: Cameron, I'm not really sure I got your point. I've used the "file not found" exception as an example for a behavior typical on context managers. This could be a failure to connect to DB, or threads. It also applies to any kind of possible exception,

Re: Anonymous email users

2024-06-14 Thread Cameron Simpson via Python-list
On 14Jun2024 18:00, avi.e.gr...@gmail.com wrote: I notice that in some recent discussions, we have users who cannot be replied to directly as their email addresses are not valid ones, and I believe on purpose. Examples in the thread I was going to reply to are:

Re: Anonymous email users

2024-06-14 Thread Chris Angelico via Python-list
On Sat, 15 Jun 2024 at 08:32, dn via Python-list wrote: > These mailing-lists all run under the Python Code of Conduct. > The newsgroup, however, is not. Which means that anyone who posts on the newsgroup is subject to no such restrictions - and that might explain the, shall we say, quite

Re: Anonymous email users

2024-06-14 Thread dn via Python-list
On 15/06/24 10:00, AVI GROSS via Python-list wrote: I notice that in some recent discussions, we have users who cannot be replied to directly as their email addresses are not valid ones, and I believe on purpose. Examples in the thread I was going to reply to are: ... It's an interesting

Anonymous email users

2024-06-14 Thread AVI GROSS via Python-list
I notice that in some recent discussions, we have users who cannot be replied to directly as their email addresses are not valid ones, and I believe on purpose. Examples in the thread I was going to reply to are: henha...@devnull.tb

Re: in Python: (101 102 103 201 202 203 301 302 303 401 402 403 )

2024-06-14 Thread candycanearter07 via Python-list
Phil Carmody wrote at 12:01 this Thursday (GMT): > Paul Rubin writes: >> HenHanna writes: >>> is there another (simple) way to write this? >> >> Yes, but please consider doing these easy exercises yourself instead of >> fobbing them onto other people. > > Hen's probably just an experimental

Re: Suggested python feature: allowing except in context maneger

2024-06-14 Thread Yair Eshel via Python-list
Cameron, I'm not really sure I got your point. I've used the "file not found" exception as an example for a behavior typical on context managers. This could be a failure to connect to DB, or threads. It also applies to any kind of possible exception, whether cased by the context manager itself or

Re: Suggested python feature: allowing except in context maneger

2024-06-13 Thread Cameron Simpson via Python-list
On 13Jun2024 19:44, dieter.mau...@online.de wrote: Why not use: ``` try: with open()... ... except FileNotFoundError: ... ``` This is exactly what the OP was expressing dissatisfaction with. I'm -1 on the idea myself - not every combination of things needs additional syntactic support,

Suggested python feature: allowing except in context maneger

2024-06-13 Thread Dieter Maurer via Python-list
Yair Eshel wrote at 2024-6-13 13:01 +0300: > ... >I would like to suggest an alternative syntax, that will, in a sense, apply >the best of both worlds: > >import logging >with open('sample_data/README.md') as f: > print (len(f.read())) >except FileNotFoundError: > logging.error("File not") Are

Re: Couldn't install numpy on Python 2.7

2024-06-13 Thread Ethan Furman via Python-list
Hey, everyone! I believe the original question has been answered, and tempers seem to be flaring in sub-threads, so let's call this thread done and move on to other interesting topics. Thank you for your support! -- ~Ethan~ Moderator -- https://mail.python.org/mailman/listinfo/python-list

Re: Suggested python feature: allowing except in context maneger

2024-06-13 Thread Barry Scott via Python-list
> On 13 Jun 2024, at 11:01, Yair Eshel via Python-list > wrote: > > I read this is a good place to give some suggestions for features in > python. Best place these days is to raise an idea on https://discuss.python.org/ Beware that this idea has come up in the past and was rejected. Barry

Re: in Python: (101 102 103 201 202 203 301 302 303 401 402 403 )

2024-06-13 Thread Phil Carmody via Python-list
Paul Rubin writes: > HenHanna writes: >> is there another (simple) way to write this? > > Yes, but please consider doing these easy exercises yourself instead of > fobbing them onto other people. Hen's probably just an experimental GPT. You, with your limited resources, can never train it. I'd

Re: Couldn't install numpy on Python 2.7

2024-06-13 Thread Chris Green via Python-list
Chris Angelico wrote: > On Thu, 13 Jun 2024 at 10:58, wrote: > > > > Chris, > > > > You seem to have perceived an insult that I remain unaware of. > > If you're not aware that you're saying this, then don't say it. > Er, um, that really makes no sense! :-) How can one not say something that

Suggested python feature: allowing except in context maneger

2024-06-13 Thread Yair Eshel via Python-list
Hello. I read this is a good place to give some suggestions for features in python. If not, please let me know. This is an example of a code I normally use in my everyday work: import logging try: with open('sample_data/READM.md') as f: print (len(f.read())) except FileNotFoundError:

Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Chris Angelico via Python-list
On Thu, 13 Jun 2024 at 10:58, wrote: > > Chris, > > You seem to have perceived an insult that I remain unaware of. If you're not aware that you're saying this, then don't say it. > I looked up FUD and sharply disagree with suggestions I am trying to somehow > cause Fear, Uncertainty or Doubt. I

RE: Couldn't install numpy on Python 2.7

2024-06-12 Thread AVI GROSS via Python-list
Chris, You seem to have perceived an insult that I remain unaware of. I have no special knowledge, like you do, of plans made for changes to the pthon language and implementation. I was asking a hypothetical question about what some users would do if python came out with a newer major version.

Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Chris Angelico via Python-list
On Thu, 13 Jun 2024 at 09:20, wrote: > My point was that version 4 COULD HAPPEN one day and I meant INCOMPATIBLE > version not 4. Obviously we can make a version 4 that is not incompatible > too. This is still FUD. Back your words with something, or stop trying to imply that there's another

RE: Couldn't install numpy on Python 2.7

2024-06-12 Thread AVI GROSS via Python-list
Chris, I don't want to get off message and debate whether my "jokes" are jokes, let alone funny. Obviously, they often aren't. What I meant by joking here does seem relevant. As the years pass, there can come a time when it is suggested that a language (any language including python) is no

Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Oscar Benjamin via Python-list
On Wed, 12 Jun 2024 at 23:52, Greg Ewing via Python-list wrote: > On 13/06/24 10:09 am, Chris Angelico wrote: > > So if anyone > > actually does need to use pip with Python 2.7, they probably need to > > set up a local server > > You should also be able to download a .tar.gz from PyPI and use

Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Chris Angelico via Python-list
On Thu, 13 Jun 2024 at 08:46, Oscar Benjamin via Python-list wrote: > I don't know much about SSL and related networking things especially > on Windows. I would be surprised if pip on old Python can't install > from current PyPI though. I imagine that something strange has > happened like a new

Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Greg Ewing via Python-list
On 13/06/24 4:31 am, avi.e.gr...@gmail.com wrote: It seems Microsoft is having a problem where something lik 2/3 of Windows users have not upgraded from Windows 10 after many years At least Python 3 is a clear improvement over Python 2 in many ways. Whereas the only thing Microsoft seems to

Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Oscar Benjamin via Python-list
On Wed, 12 Jun 2024 at 23:11, Chris Angelico via Python-list wrote: > > On Thu, 13 Jun 2024 at 07:57, Oscar Benjamin via Python-list > wrote: > > They are seeing a warning that explicitly says "You can upgrade to a > > newer version of Python to solve this". I don't know whether that SSL > >

Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Chris Angelico via Python-list
On Thu, 13 Jun 2024 at 07:57, Oscar Benjamin via Python-list wrote: > They are seeing a warning that explicitly says "You can upgrade to a > newer version of Python to solve this". I don't know whether that SSL > warning is directly connected to pip not finding any versions of numpy > but with

Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Oscar Benjamin via Python-list
On Wed, 12 Jun 2024 at 22:38, AVI GROSS via Python-list wrote: > > The discussion though was about a specific OP asking if they can fix their > problem. One solution being suggested is to fix a deeper problem and simply > make their code work with a recent version of python 3. The OP has not

Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Chris Angelico via Python-list
On Thu, 13 Jun 2024 at 07:36, wrote: > But if the goal was to deprecate python 2 and in some sense phase it out, it > is perhaps not working well for some. Frankly, issuing so many updates like > 2.7 and including backporting of new features has helped make it possible to > delay any upgrade.

RE: Couldn't install numpy on Python 2.7

2024-06-12 Thread AVI GROSS via Python-list
Chris, Since you misunderstood, my statement was that making an incompatible set of changes to create Python 3 in the first place was a decision made by some and perhaps not one that thrilled others who already had an embedded base of programs or ones in the pipeline that would need much work to

Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Chris Angelico via Python-list
On Thu, 13 Jun 2024 at 06:55, Thomas Passin via Python-list wrote: > The project cannot move to a Python-3 compatible version because Jython > 3.xx doesn't exist and may never exist. The saving grace is that my > project doesn't have to use packages like numpy, scipy, and so forth. Exactly. If

Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Thomas Passin via Python-list
On 6/12/2024 1:59 PM, Chris Angelico via Python-list wrote: On Thu, 13 Jun 2024 at 03:41, AVI GROSS via Python-list wrote: Change is hard even when it may be necessary. The argument often is about whether some things are necessary or not. Python made a decision but clearly not a unanimous

Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Chris Angelico via Python-list
On Thu, 13 Jun 2024 at 03:41, AVI GROSS via Python-list wrote: > > Change is hard even when it may be necessary. > > The argument often is about whether some things are necessary or not. > > Python made a decision but clearly not a unanimous one. What decision? To not release any new versions of

RE: Couldn't install numpy on Python 2.7

2024-06-12 Thread AVI GROSS via Python-list
Change is hard even when it may be necessary. The argument often is about whether some things are necessary or not. Python made a decision but clearly not a unanimous one. My current PC was not upgradable because of the new hardware requirement Microsoft decided was needed for Windows 11. I

Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread MRAB via Python-list
On 2024-06-12 17:31, AVI GROSS via Python-list wrote: I am sure there is inertia to move from an older product and some people need a reason like this where the old becomes untenable. It seems Microsoft is having a problem where something lik 2/3 of Windows users have not upgraded from Windows

RE: Couldn't install numpy on Python 2.7

2024-06-12 Thread AVI GROSS via Python-list
I am sure there is inertia to move from an older product and some people need a reason like this where the old becomes untenable. It seems Microsoft is having a problem where something lik 2/3 of Windows users have not upgraded from Windows 10 after many years and have set a deadline in a year or

Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Gordinator via Python-list
On 12/06/2024 12:30, marc nicole wrote: I am trying to install numpy library on Python 2.7.15 in PyCharm but the error message I get is: ERROR: Could not find a version that satisfies the requirement numpy (from versions: none) ERROR: No matching distribution found for numpy

Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Chris Angelico via Python-list
On Wed, 12 Jun 2024 at 21:32, marc nicole via Python-list wrote: > > I am trying to install numpy library on Python 2.7.15 in PyCharm but the > error message I get is: > > You can upgrade to a newer version of Python to solve this. The answer is right there in the error message. ChrisA --

Couldn't install numpy on Python 2.7

2024-06-12 Thread marc nicole via Python-list
I am trying to install numpy library on Python 2.7.15 in PyCharm but the error message I get is: ERROR: Could not find a version that satisfies the requirement numpy (from > versions: none) > ERROR: No matching distribution found for numpy >

Re: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))

2024-06-11 Thread HenHanna via Python-list
On 6/10/2024 6:29 AM, Rob Cliffe wrote: import itertools def chunk1(seq):     return [ ch * len(list(grp)) for (ch, grp) in itertools.groupby(s) ] def chunk2(seq):     return [ (ch, len(list(grp))) for (ch, grp) in itertools.groupby(s) ] s='aaabbaa' print(chunk1(s)) print(chunk2(s))

RE: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))

2024-06-11 Thread AVI GROSS via Python-list
Rob, That is a fairly straightforward and elegant solution if using an added mode called itertools. I went a different way by creating my own focused iterator and calling it, when needed, to produce one or the other of the results requested in the functions named chunk() and chunkc(). But

Re: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))

2024-06-11 Thread Rob Cliffe via Python-list
import itertools def chunk1(seq):     return [ ch * len(list(grp)) for (ch, grp) in itertools.groupby(s) ] def chunk2(seq):     return [ (ch, len(list(grp))) for (ch, grp) in itertools.groupby(s) ] s='aaabbaa' print(chunk1(s)) print(chunk2(s)) ### Program

RE: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))

2024-06-10 Thread AVI GROSS via Python-list
> i was just curiuos about simple, clever way to write it in Python It depends on what you mean by "clever". For some, it was like a suggestion on using something already available such as itertools.groupby, perhaps even better if it is actually compiled in from a language like C and perhaps

Re: IDLE: clearing the screen

2024-06-10 Thread Michael F. Stemper via Python-list
On 08/06/2024 14.18, Rob Cliffe wrote: OK, here is the advanced version: import os class _cls(object):     def __repr__(self):         os.system('cls')         return '' cls = _cls() Now when you type cls it clears the screen.  The only flaw is that there is a blank line at the very top of

Re: IDLE: clearing the screen

2024-06-10 Thread Michael F. Stemper via Python-list
On 10/06/2024 09.32, Stefan Ram wrote: "Michael F. Stemper" wrote or quoted: On 08/06/2024 14.18, Rob Cliffe wrote: OK, here is the advanced version: import os class _cls(object):     def __repr__(self):         os.system('cls')         return '' cls = _cls() ... Why have it return

Re: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))

2024-06-10 Thread HenHanna via Python-list
On 6/9/2024 7:05 PM, avi.e.gr...@gmail.com wrote: I remembered that HenHanna had been hard to deal with in the past and when my reply to him/her/them bounced as a bad/fake address it came back to me that I am better off not participating in this latest attempt to get us to perform then probably

Re: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))

2024-06-10 Thread HenHanna via Python-list
On 6/9/2024 3:50 PM, MRAB wrote: On 2024-06-09 22:20, HenHanna via Python-list wrote: Chunk, ChunkC -- nice simple way(s) to write these in Python? (Chunk  '(a a   b    a a a   b b))   ==> ((a a) (b)  (a a a) (b b)) (Chunk  '(a a a a   b   c c   a a   d   e e e e))   ==> ((a a a a)

RE: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))

2024-06-09 Thread AVI GROSS via Python-list
I remembered that HenHanna had been hard to deal with in the past and when my reply to him/her/them bounced as a bad/fake address it came back to me that I am better off not participating in this latest attempt to get us to perform then probably shoot whatever we say down. A considerate person

RE: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))

2024-06-09 Thread AVI GROSS via Python-list
HH, Before bothering, it might be helpful if you spelled out a bit more in the way of requirements that would satisfy you and perhaps show your attempts. Your examples suggest it would be fairly simple to create an iterator, for example, that would yield as it examined one item at a time until

Re: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))

2024-06-09 Thread MRAB via Python-list
On 2024-06-09 22:20, HenHanna via Python-list wrote: Chunk, ChunkC -- nice simple way(s) to write these in Python? (Chunk '(a a ba a a b b)) ==> ((a a) (b) (a a a) (b b)) (Chunk '(a a a a b c c a a d e e e e)) ==> ((a a a a) (b) (c c) (a a) (d) (e e e e))

in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))

2024-06-09 Thread HenHanna via Python-list
Chunk, ChunkC -- nice simple way(s) to write these in Python? (Chunk '(a a ba a a b b)) ==> ((a a) (b) (a a a) (b b)) (Chunk '(a a a a b c c a a d e e e e)) ==> ((a a a a) (b) (c c) (a a) (d) (e e e e)) (Chunk '(2 2 foo bar bar j j j k baz baz))

Re: IDLE: clearing the screen

2024-06-09 Thread Alan Gauld via Python-list
On 08/06/2024 20:18, Rob Cliffe via Python-list wrote: > OK, here is the advanced version: > import os > class _cls(object): >     def __repr__(self): >         os.system('cls') >         return '' > cls = _cls() > > Now when you type > cls > it clears the screen.  For me on a Mac it clears

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-06-08 Thread Grant Edwards via Python-list
On 2024-06-08, Larry Martell via Python-list wrote: > The original question struck me as homework or an interview question for a > junior position. But having no clear requirements or specifications is good > training for the real world where that is often the case. When you question > that, you

RE: From JoyceUlysses.txt -- words occurring exactly once

2024-06-08 Thread AVI GROSS via Python-list
I agree with Larry that the OP was asking something that might be fair to use in an interview process where perhaps an exact answer is not as important as showing how the person thinks about a process. The original question can be incomplete or vague. Do they give up? Do they ask careful

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-06-08 Thread Thomas Passin via Python-list
On 6/8/2024 2:46 PM, avi.e.gr...@gmail.com wrote: Agreed, Thomas. As someone who has spent lots of time writing code OR requirements of various levels or having to deal with the bugs afterwards, there can be a huge disconnect between the people trying to decide what to do and the people

Re: IDLE: clearing the screen

2024-06-08 Thread Rob Cliffe via Python-list
OK, here is the advanced version: import os class _cls(object):     def __repr__(self):         os.system('cls')         return '' cls = _cls() Now when you type cls it clears the screen.  The only flaw is that there is a blank line at the very top of the screen, and the ">>>" prompt appears on

RE: From JoyceUlysses.txt -- words occurring exactly once

2024-06-08 Thread AVI GROSS via Python-list
Agreed, Thomas. As someone who has spent lots of time writing code OR requirements of various levels or having to deal with the bugs afterwards, there can be a huge disconnect between the people trying to decide what to do and the people having to do it. It is not necessarily easy to come

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-06-08 Thread Thomas Passin via Python-list
On 6/8/2024 11:54 AM, Larry Martell via Python-list wrote: On Sat, Jun 8, 2024 at 10:39 AM Mats Wichmann via Python-list < python-list@python.org> wrote: On 6/5/24 05:10, Thomas Passin via Python-list wrote: Of course, we see this lack of clarity all the time in questions to the list. I

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-06-08 Thread Larry Martell via Python-list
On Sat, Jun 8, 2024 at 10:39 AM Mats Wichmann via Python-list < python-list@python.org> wrote: > On 6/5/24 05:10, Thomas Passin via Python-list wrote: > > > Of course, we see this lack of clarity all the time in questions to the > > list. I often wonder how these askers can possibly come up with

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-06-08 Thread Mats Wichmann via Python-list
On 6/5/24 05:10, Thomas Passin via Python-list wrote: Of course, we see this lack of clarity all the time in questions to the list.  I often wonder how these askers can possibly come up with acceptable code if they don't realize they don't truly know what it's supposed to do. Fortunately,

[RELEASE] Python 3.12.4 released

2024-06-06 Thread Thomas Wouters via Python-list
Last minute bugs in test environments notwithstanding, 3.12.4 is now available! https://www.python.org/downloads/release/python-3124/

[RELEASE] Python 3.13.0 beta 2 released.

2024-06-06 Thread Thomas Wouters via Python-list
After a little bit of a delay (I blame the flat tire on my rental car), 3.13.0b2 is released: https://www.python.org/downloads/release/python-3130b2/

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-06-06 Thread Thomas Passin via Python-list
On 6/5/2024 12:33 AM, dn via Python-list wrote: On 31/05/24 14:26, HenHanna via Python-list wrote: On 5/30/2024 2:18 PM, dn wrote: On 31/05/24 08:03, HenHanna via Python-list wrote: Given a text file of a novel (JoyceUlysses.txt) ... could someone give me a pretty fast (and simple) Python

Re: Fwd: IDLE: clearing the screen

2024-06-05 Thread Rob Cliffe via Python-list
On 05/06/2024 04:09, Cameron Simpson wrote: On 04Jun2024 22:43, Rob Cliffe wrote: import os def cls(): x=os.system("cls") Now whenever you type cls() it will clear the screen and show the prompt at the top of the screen. (The reason for the "x=" is: os.system returns a result, in this case

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-06-05 Thread Grant Edwards via Python-list
On 2024-06-05, dn via Python-list wrote: > If you/your teacher can't define a "word", the code, any code, will > almost-certainly be wrong! Back when I was a student... When there was a homework/project assignemnt with a vague requirement (and it wasn't practical to get the requirement

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-06-04 Thread dn via Python-list
On 31/05/24 14:26, HenHanna via Python-list wrote: On 5/30/2024 2:18 PM, dn wrote: On 31/05/24 08:03, HenHanna via Python-list wrote: Given a text file of a novel (JoyceUlysses.txt) ... could someone give me a pretty fast (and simple) Python program that'd give me a list of all words

Re: Fwd: IDLE: clearing the screen

2024-06-04 Thread Cameron Simpson via Python-list
On 04Jun2024 22:43, Rob Cliffe wrote: import os def cls(): x=os.system("cls") Now whenever you type cls() it will clear the screen and show the prompt at the top of the screen. (The reason for the "x=" is: os.system returns a result, in this case 0.  When you evaluate an expression in the

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-06-04 Thread Chris Angelico via Python-list
On Wed, 5 Jun 2024 at 02:49, Edward Teach via Python-list wrote: > > On Mon, 03 Jun 2024 14:58:26 -0400 (EDT) > Grant Edwards wrote: > > > On 2024-06-03, Edward Teach via Python-list > > wrote: > > > > > The Gutenburg Project publishes "plain text". That's another > > > problem, because "plain

Fwd: IDLE: clearing the screen

2024-06-04 Thread Rob Cliffe via Python-list
Welcome to Python!  A great language for program development. Answers might be platform-dependent (are you using WIndows, Linux, etc.). However, the following works for me on WIndows.  You can put it in the startup.py file so you don't have to type it every time you start up the IDLE. import

RE: From JoyceUlysses.txt -- words occurring exactly once

2024-06-04 Thread AVI GROSS via Python-list
>> Well.when using the file linux.words as a useful master list of >> "words".linux.words is strict ASCII The meaning of "words" depends on the context. The contents of the file mentioned are a minor attempt to capture a common subset of words in English but probably are not what

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-06-04 Thread Grant Edwards via Python-list
On 2024-06-04, Edward Teach via Python-list wrote: > On Mon, 03 Jun 2024 14:58:26 -0400 (EDT) > Grant Edwards wrote: > >> On 2024-06-03, Edward Teach via Python-list >> wrote: >> >> > The Gutenburg Project publishes "plain text". That's another >> > problem, because "plain text" means

IDLE: clearing the screen

2024-06-04 Thread Cave Man via Python-list
Hello everyone, I am new to Python, and I have been using IDLE (v3.10.11) to run small Python code. However, I have seen that the output scrolls to the bottom in the output window. Is there a way to clear the output window (something like cls in command prompt or clear in terminal), so

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-06-04 Thread Edward Teach via Python-list
On Mon, 03 Jun 2024 14:58:26 -0400 (EDT) Grant Edwards wrote: > On 2024-06-03, Edward Teach via Python-list > wrote: > > > The Gutenburg Project publishes "plain text". That's another > > problem, because "plain text" means UTF-8and that means > > unicode...and that means running some

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-06-04 Thread Dieter Maurer via Python-list
Edward Teach wrote at 2024-6-3 10:47 +0100: > ... >The Gutenburg Project publishes "plain text". That's another problem, >because "plain text" means UTF-8and that means unicode...and that >means running some sort of unicode-to-ascii conversion in order to get >something like "words". A

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-06-03 Thread Grant Edwards via Python-list
On 2024-06-03, Edward Teach via Python-list wrote: > The Gutenburg Project publishes "plain text". That's another > problem, because "plain text" means UTF-8and that means > unicode...and that means running some sort of unicode-to-ascii > conversion in order to get something like "words".

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-06-03 Thread Edward Teach via Python-list
On Sat, 1 Jun 2024 13:34:11 -0600 Mats Wichmann wrote: > On 5/31/24 11:59, Dieter Maurer via Python-list wrote: > > hmmm, I "sent" this but there was some problem and it remained > unsent. Just in case it hasn't All Been Said Already, here's the > retry: > > > HenHanna wrote at 2024-5-30 13:03

Cannot install python properly - python310.dll not found - no pip

2024-06-03 Thread Jay Cadet | Studio JPC via Python-list
Hi. I'm attempting to install and use stable diffusion. However, while installing python 3.10.6, I'm getting the error that the python 310.dll is not found. I've made sure the PATH option is enabled, but it makes no difference. I've also removed and reinstalled python multiple times. Even

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-06-01 Thread Mats Wichmann via Python-list
On 5/31/24 11:59, Dieter Maurer via Python-list wrote: hmmm, I "sent" this but there was some problem and it remained unsent. Just in case it hasn't All Been Said Already, here's the retry: HenHanna wrote at 2024-5-30 13:03 -0700: Given a text file of a novel (JoyceUlysses.txt) ... could

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-06-01 Thread Thomas Passin via Python-list
On 6/1/2024 4:04 AM, Peter J. Holzer via Python-list wrote: On 2024-05-30 19:26:37 -0700, HenHanna via Python-list wrote: hard to decide what to do with hyphens and apostrophes (I'd, he's, can't, haven't, A's and B's) Especially since the same character is

Re: Lprint = ( Lisp-style printing ( of lists and strings (etc.) ) in Python )

2024-06-01 Thread Peter J. Holzer via Python-list
On 2024-05-30 21:47:14 -0700, HenHanna via Python-list wrote: > [('the', 36225), ('and', 17551), ('of', 16759), ('i', 16696), ('a', 15816), > ('to', 15722), ('that', 11252), ('in', 10743), ('it', 10687)] > > ((the 36225) (and 17551) (of 16759) (i 16696) (a 15816) (to 15722) (that > 11252) (in

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-06-01 Thread Peter J. Holzer via Python-list
On 2024-05-30 19:26:37 -0700, HenHanna via Python-list wrote: > hard to decide what to do with hyphens >and apostrophes > (I'd, he's, can't, haven't, A's and B's) Especially since the same character is used as both an apostrophe and a closing quotation mark. And

  1   2   3   4   5   6   7   8   9   10   >