Re: argparse support of/by argparse

2021-07-23 Thread Chris Angelico
On Fri, Jul 23, 2021 at 5:34 PM Albert-Jan Roskam wrote: > > >>> [1] https://pypi.org/project/clize/ > > > I use and like docopt (https://github.com/docopt/docopt). Is clize a better > choice? > Not necessarily. Both are good. Explore both, see which one makes more sense. ChrisA --

Re: Python and Ubuntu versions

2021-07-23 Thread Chris Angelico
‪On Fri, Jul 23, 2021 at 2:55 PM ‫אורי‬‎ wrote:‬ > > Hi, > > I have a production server with Ubuntu 18.04 LTS (currently upgraded to > Ubuntu 18.04.5 LTS) and I use Python in virtualenv - currently Python > 3.6.9. I'm using Django and I read that from Django 4.0, a minimal version > of Python 3.8

Re: argparse support of/by argparse

2021-07-14 Thread Chris Angelico
On Thu, Jul 15, 2021 at 2:57 PM Dan Stromberg wrote: > > > On Mon, Jul 12, 2021 at 12:34 PM Chris Angelico wrote: >> >> On Tue, Jul 13, 2021 at 5:22 AM lucas wrote: >> > Running CPython on it will raise a TypeError, and running Mypy on it >> >

Re: argparse support of/by argparse

2021-07-12 Thread Chris Angelico
On Tue, Jul 13, 2021 at 5:22 AM lucas wrote: > > Hello everyone, > > Let us consider this patch of code: > > import argparse > > def parse_cli() -> argparse.Namespace: > parser = argparse.ArgumentParser() > parser.add_argument('n', type=int) > return

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-09 Thread Chris Angelico
On Fri, Jul 9, 2021 at 11:07 PM vergos@gmail.com wrote: > please tell me what i need to do to be able to see error messages in browser > and not only via console: > > app = Flask(__name__) > app.debug = True > application = app > > The above only displays error via console into the

Re: Unfindable module: code

2021-07-02 Thread Chris Angelico
On Fri, Jul 2, 2021 at 11:01 PM Peter Otten <__pete...@web.de> wrote: > > On 02/07/2021 11:44, Chris Angelico wrote: > > I've just spent half an hour trying to figure out how to mess with the > > Python REPL (specifically, how to implement a line-by-line interactive > &g

Unfindable module: code

2021-07-02 Thread Chris Angelico
I've just spent half an hour trying to figure out how to mess with the Python REPL (specifically, how to implement a line-by-line interactive interpreter within a larger app). It's rather hard to find it, but the key module is "code". https://docs.python.org/3/library/code.html (How did I end up

Re: python: server is not receiving input from client flask

2021-06-29 Thread Chris Angelico
On Wed, Jun 30, 2021 at 6:21 AM Jerry Thefilmmaker wrote: > @app.route("/check_answer/", methods = ['POST']) > def check_answer(ans): > > > Enter your answer: > > What you're creating here is a route with a placeholder. The

Re: python: server is not receiving input from client flask

2021-06-29 Thread Chris Angelico
On Wed, Jun 30, 2021 at 3:38 AM Jerry Thefilmmaker wrote: > Thanks for taking the time to explained, Chris. Believe me, it helps. It had > me thinking for a while. So, All the stuff about HTTP makes sense. I've been > studying and trying to wrap my head around the rest of your explanation and

Re: python: server is not receiving input from client flask

2021-06-28 Thread Chris Angelico
On Tue, Jun 29, 2021 at 5:43 AM Jerry Thefilmmaker wrote: > > Do you mind elaborating a bit more on making one function for any given > request? > > As far as defining a bunch of functions that get called when particular > requests come in I thought that's what I had going on in my codes. No? >

Re: python: server is not receiving input from client flask

2021-06-28 Thread Chris Angelico
On Tue, Jun 29, 2021 at 4:36 AM Jerry Thefilmmaker wrote: > @app.route("/", methods = ['POST', 'GET']) > def play(): > > @app.route("/", methods = ['POST', 'GET']) > def check_answer(ans, user): When you're building a Flask app, you're defining a bunch of functions that get called when

Re: How to iterate through maildir messages in python 3?

2021-06-25 Thread Chris Angelico
On Sat, Jun 26, 2021 at 12:28 AM Chris Green wrote: > > Greg Ewing wrote: > > On 25/06/21 7:06 am, Chris Green wrote: > > > In python 2 one can do:- > > > > > > for msg in maildir: > > >print msg # or whatever you want to do with the message > > > > > > > > > However in

Re: Python threading comparison

2021-06-22 Thread Chris Angelico
On Wed, Jun 23, 2021 at 5:34 AM Dan Stromberg wrote: > > I put together a little python runtime comparison, with an embarallel, > cpu-heavy threading microbenchmark. > > It turns out that the performance-oriented Python implementations, Pypy3 > and Nuitka3, are both poor at threading, as is

Re: Strange disassembly

2021-06-19 Thread Chris Angelico
On Sat, Jun 19, 2021 at 5:13 PM Rob Cliffe via Python-list wrote: > > > > On 19/06/2021 07:50, Chris Angelico wrote: > > On Sat, Jun 19, 2021 at 4:16 PM Rob Cliffe via Python-list > > wrote: > >> > >> > >> On 18/06/2021 11:04, Chris Angelico

Re: Strange disassembly

2021-06-19 Thread Chris Angelico
On Sat, Jun 19, 2021 at 4:16 PM Rob Cliffe via Python-list wrote: > > > > On 18/06/2021 11:04, Chris Angelico wrote: > >>>> sys.version > > '3.10.0b2+ (heads/3.10:33a7a24288, Jun 9 2021, 20:47:39) [GCC 8.3.0]' > >>>> def chk(x):

Re: Strange disassembly

2021-06-18 Thread Chris Angelico
On Sat, Jun 19, 2021 at 9:50 AM Terry Reedy wrote: > > Why are there two separate bytecode blocks for the "raise Exception"? > > Because one block must POP_TOP and other must not. > > > I'd have thought that the double condition would still be evaluated as > > one thing, or at least that the jump

Strange disassembly

2021-06-18 Thread Chris Angelico
>>> sys.version '3.10.0b2+ (heads/3.10:33a7a24288, Jun 9 2021, 20:47:39) [GCC 8.3.0]' >>> def chk(x): ... if not(0 < x < 10): raise Exception ... >>> dis.dis(chk) 2 0 LOAD_CONST 1 (0) 2 LOAD_FAST0 (x) 4 DUP_TOP

Re: How to check if an image contains an element I am searchig for

2021-06-17 Thread Chris Angelico
On Thu, Jun 17, 2021 at 4:43 PM Dan Stromberg wrote: > > > > On Wed, Jun 16, 2021 at 2:44 PM Chris Angelico wrote: >> >> On Thu, Jun 17, 2021 at 7:35 AM Dan Stromberg wrote: >> > > >> How well can you define the things you're looking for?

Re: How to check if an image contains an element I am searchig for

2021-06-16 Thread Chris Angelico
On Thu, Jun 17, 2021 at 7:35 AM Dan Stromberg wrote: > > On Wed, Jun 16, 2021 at 2:04 PM Barry wrote: > > > >>> On Thu, Jun 17, 2021 at 6:06 AM Arak Rachael > > wrote: > > >>> > > >>> Hi guys, > > >>> > > >>> I have an image from google maps to say and I need to check if it has > > road

Re: How to check if an image contains an element I am searchig for

2021-06-16 Thread Chris Angelico
On Thu, Jun 17, 2021 at 7:25 AM Dennis Lee Bieber wrote: > > On Thu, 17 Jun 2021 06:07:59 +1000, Chris Angelico > declaimed the following: > > > >How well can you define the things you're looking for? > > > >https://xkcd.com/1425/ > > Non sequitur c

Re: How to check if an image contains an element I am searchig for

2021-06-16 Thread Chris Angelico
On Thu, Jun 17, 2021 at 6:44 AM Arak Rachael wrote: > > On Wednesday, 16 June 2021 at 22:08:31 UTC+2, Chris Angelico wrote: > > On Thu, Jun 17, 2021 at 6:06 AM Arak Rachael wrote: > > > > > > Hi guys, > > > > > > I have an image from google maps

Re: How to check if an image contains an element I am searchig for

2021-06-16 Thread Chris Angelico
On Thu, Jun 17, 2021 at 6:06 AM Arak Rachael wrote: > > Hi guys, > > I have an image from google maps to say and I need to check if it has road > markings, in order to do that, I believe I need to change the effects on the > image so the markings and road can be white or something and the

Re: Why the list creates in two different ways? Does it cause by the mutability of its elements? Where the Python document explains it?

2021-06-16 Thread Chris Angelico
On Thu, Jun 17, 2021 at 2:32 AM Dieter Maurer wrote: > > Chris Angelico wrote at 2021-6-16 02:20 +1000: > >On Wed, Jun 16, 2021 at 2:18 AM Dieter Maurer wrote: > >> As far as I know, there are no guarantees are the language level. > >> There are some (partially docu

Re: Why the list creates in two different ways? Does it cause by the mutability of its elements? Where the Python document explains it?

2021-06-15 Thread Chris Angelico
On Wed, Jun 16, 2021 at 12:44 PM Avi Gross via Python-list wrote: > > Greg, > > My point was not to ASK what python does as much as to ask why it matters to > anyone which way it does it. Using less space at absolutely no real expense > is generally a plus. Having a compiler work too hard, or

Re: Why the list creates in two different ways? Does it cause by the mutability of its elements? Where the Python document explains it?

2021-06-15 Thread Chris Angelico
On Wed, Jun 16, 2021 at 10:17 AM Avi Gross via Python-list wrote: > > May I ask if there are any PRACTICAL differences if multiple immutable > tuples share the same address or not? No, there aren't. It's nothing more than an (optional) optimization. This is true of every immutable type,

Re: Help with Python circular error

2021-06-15 Thread Chris Angelico
On Wed, Jun 16, 2021 at 3:17 AM MRAB wrote: > > On 2021-06-15 17:49, Chris Angelico wrote: > > On Wed, Jun 16, 2021 at 2:45 AM Arak Rachael > > wrote: > >> > >> Hi to everyone, > >> > >> I am having a problem with this error, I created a

Re: Help with Python circular error

2021-06-15 Thread Chris Angelico
On Wed, Jun 16, 2021 at 2:45 AM Arak Rachael wrote: > > Hi to everyone, > > I am having a problem with this error, I created a package and uploaded it to > Test PyPi, but I can not get it to work, can someone help me please? > > https://test.pypi.org/manage/project/videotesting/releases/' > >

Re: Where did the message go?

2021-06-15 Thread Chris Angelico
On Wed, Jun 16, 2021 at 2:41 AM Grimble wrote: > Thanks for reminding me of the log files. I've worked out that the > message on machine H (for haydn, which shows my preferred music genre) > was bouncing because haydn.. was not a registered subdomain with > my ISP, whereas bach..

Re: Why the list creates in two different ways? Does it cause by the mutability of its elements? Where the Python document explains it?

2021-06-15 Thread Chris Angelico
On Wed, Jun 16, 2021 at 2:18 AM Dieter Maurer wrote: > > Chris Angelico wrote at 2021-6-15 19:08 +1000: > >On Tue, Jun 15, 2021 at 6:32 PM Dieter Maurer wrote: > >> > >> Chris Angelico wrote at 2021-6-15 05:35 +1000: > >> >On Tue, Jun 15, 2021 at 5:12

Re: Why the list creates in two different ways? Does it cause by the mutability of its elements? Where the Python document explains it?

2021-06-15 Thread Chris Angelico
On Tue, Jun 15, 2021 at 6:32 PM Dieter Maurer wrote: > > Chris Angelico wrote at 2021-6-15 05:35 +1000: > >On Tue, Jun 15, 2021 at 5:12 AM Jach Feng wrote: > >> > >> >>> n = [(1,2) for i in range(3)] > >> >>> n > >> [(1, 2), (1

Re: Why the list creates in two different ways? Does it cause by the mutability of its elements? Where the Python document explains it?

2021-06-14 Thread Chris Angelico
On Tue, Jun 15, 2021 at 7:11 AM Rob Cliffe via Python-list wrote: > > This puzzled me, so I played around with it a bit (Python 3.8.3): > > n = [] > for i in range(3): > n.append((1,7,-3,None,"x")) > for i in range(3): > n.append((1,7,-3,None,"x")) > print([id(x) for x in n]) > > a = 4

Re: Behaviour of pop() for dictionaries

2021-06-14 Thread Chris Angelico
On Tue, Jun 15, 2021 at 5:41 AM BlindAnagram wrote: > However, d.pop(key, [default]) returns the value (or the default) and > consistency with other pops (a good thing in my view) would suggest that > d.pop() could return a random value, which would serve my purpose when > there is only one

Re: Is there a way to get the following result in Python?

2021-06-14 Thread Chris Angelico
On Tue, Jun 15, 2021 at 5:23 AM Jach Feng wrote: > > >>> def foo(): > ... # do something > ... > >>> a = [] > >>> for i in range(3): > ... a.append(foo()) > ... > >>> a > [] > >>> > Barring shenanigans like messing with globals, no, there is no way for a function to return a lack of

Re: Why the list creates in two different ways? Does it cause by the mutability of its elements? Where the Python document explains it?

2021-06-14 Thread Chris Angelico
On Tue, Jun 15, 2021 at 5:12 AM Jach Feng wrote: > > >>> n = [(1,2) for i in range(3)] > >>> n > [(1, 2), (1, 2), (1, 2)] > >>> id(n[0]) == id(n[1]) == id(n[2]) > True This is three tuples. Tuples are immutable and you get three references to the same thing. > >>> m = [[1,2] for i in range(3)]

Re: Replacement for Mailman

2021-06-08 Thread Chris Angelico
On Wed, Jun 9, 2021 at 8:46 AM Jon Ribbens via Python-list wrote: > > On 2021-06-08, Grant Edwards wrote: > > On 2021-06-08, Paul Bryan wrote: > >> How about Mailman 3.x on Python 3.x? > > > > According to https://www.gnu.org/software/mailman/requirements.html > > mailman 3.x still requires

Re: Embedding Python

2021-06-02 Thread Chris Angelico
On Thu, Jun 3, 2021 at 4:05 AM Faraaz Mohammed wrote: > > On Tuesday, 1 July 2008 at 21:37:49 UTC+5:30, mk wrote: > > Carsten Haese wrote: > > > python_code is a C string containing the raw bytes from your pyc file. > > > Casting that to a PyObject pointer will not magically transform it into > >

Re: How to debug python + curses? [was: RE: Applying winpdb_reborn]

2021-05-30 Thread Chris Angelico
On Mon, May 31, 2021 at 7:03 AM Alan Gauld via Python-list wrote: > > On 30/05/2021 18:26, pjfarl...@earthlink.net wrote: > > I tried winpdb-reborn some time last year on my Win10 system (python 3.8.3 > > at that time), but could not figure out how to use it to debug a python > > script that uses

Re: Definition of "property"

2021-05-30 Thread Chris Angelico
On Mon, May 31, 2021 at 2:58 AM Irv Kalb wrote: > > I am doing some writing (for an upcoming book on OOP), and I'm a little stuck. > > I understand what a "property" is, how it is used and the benefits, but > apparently my explanation hasn't made the light bulb go on for my editor. > The

Re: Applying winpdb_reborn

2021-05-29 Thread Chris Angelico
On Sun, May 30, 2021 at 9:53 AM Rich Shepard wrote: > > On Sun, 30 May 2021, Chris Angelico wrote: > > > (Plus, there's not always an opportunity to use a debug harness. Sometimes > > you just have to put your prints into production and let it run for two > > wee

Re: Applying winpdb_reborn

2021-05-29 Thread Chris Angelico
On Sun, May 30, 2021 at 9:19 AM Cameron Simpson wrote: > > On 29May2021 09:51, Rich Shepard wrote: > >I knew the debugging process with Fortran and C, but haven't learned how to > >effectively use pdb to find bugs that don't issue a traceback or obvious > >wrong answer such as my module

Re: imaplib: is this really so unwieldy?

2021-05-27 Thread Chris Angelico
On Fri, May 28, 2021 at 4:04 AM Peter J. Holzer wrote: > > On 2021-05-26 08:34:28 +1000, Chris Angelico wrote: > > Yes, any given string has a single width, which makes indexing fast. > > The memory cost you're describing can happen, but apart from a BOM > > widening a

Re: string storage [was: Re: imaplib: is this really so unwieldy?]

2021-05-27 Thread Chris Angelico
On Thu, May 27, 2021 at 1:56 PM Cameron Simpson wrote: > > On 26May2021 12:11, Jon Ribbens wrote: > >On 2021-05-26, Alan Gauld wrote: > >> I confess I had just assumed the unicode strings were stored > >> in native unicode UTF8 format. > > > >If you do that then indexing and slicing strings

Re: Turtle module

2021-05-26 Thread Chris Angelico
On Thu, May 27, 2021 at 6:51 AM Michael F. Stemper wrote: > > On 26/05/2021 11.17, Chris Angelico wrote: > > On Thu, May 27, 2021 at 1:59 AM Michael F. Stemper > > wrote: > > > >>What I would like to do is capture the > >> angle-representat

Re: Turtle module

2021-05-26 Thread Chris Angelico
On Thu, May 27, 2021 at 1:59 AM Michael F. Stemper wrote: > In order to turn the turtle, I need to select a way to represent > angles. I could use either degrees or radians (or, I suppose, > grads). However, for my functions to work, I need to set the > turtle to that mode. This means that I

Re: string storage [was: Re: imaplib: is this really so unwieldy?]

2021-05-26 Thread Chris Angelico
On Thu, May 27, 2021 at 1:59 AM Jon Ribbens via Python-list wrote: > > On 2021-05-26, Alan Gauld wrote: > > On 25/05/2021 23:23, Terry Reedy wrote: > >> In CPython's Flexible String Representation all characters in a string > >> are stored with the same number of bytes, depending on the largest

Re: string storage [was: Re: imaplib: is this really so unwieldy?]

2021-05-26 Thread Chris Angelico
On Wed, May 26, 2021 at 10:04 PM Alan Gauld via Python-list wrote: > > On 25/05/2021 23:23, Terry Reedy wrote: > > > In CPython's Flexible String Representation all characters in a string > > are stored with the same number of bytes, depending on the largest > > codepoint. > > I'm learning lots

Re: learning python ...

2021-05-26 Thread Chris Angelico
On Wed, May 26, 2021 at 5:49 PM hw wrote: > > On 5/25/21 10:32 AM, Chris Angelico wrote: > > On Tue, May 25, 2021 at 1:00 PM hw wrote: > >> > >> On 5/24/21 3:54 PM, Chris Angelico wrote: > >>> You keep using that word "unfinished".

Re: imaplib: is this really so unwieldy?

2021-05-26 Thread Chris Angelico
On Wed, May 26, 2021 at 4:21 PM Grant Edwards wrote: > > On 2021-05-25, Dennis Lee Bieber wrote: > > >>Oh ok, it seemed to be fine. Would it be the right way to do it with > >>sys.exit()? Having to import another library just to end a program > >>might not be ideal. > > > > I've never

Re: imaplib: is this really so unwieldy?

2021-05-25 Thread Chris Angelico
On Wed, May 26, 2021 at 8:27 AM Grant Edwards wrote: > > On 2021-05-25, MRAB wrote: > > On 2021-05-25 16:41, Dennis Lee Bieber wrote: > > >> In Python 3, strings are UNICODE, using 1, 2, or 4 bytes PER > >> CHARACTER (I don't recall if there is a 3-byte version). If your > >> input bytes are all

Re: imaplib: is this really so unwieldy?

2021-05-25 Thread Chris Angelico
On Tue, May 25, 2021 at 8:21 PM Cameron Simpson wrote: > When you go: > > text = str(data) > > that is _assuming_ a particular text encoding stored in the data. You > really ought to specify an encoding here. If you've not specified the > CHARSET for things, 'ascii' would be a conservative

Re: learning python ...

2021-05-25 Thread Chris Angelico
On Tue, May 25, 2021 at 1:00 PM hw wrote: > > On 5/24/21 3:54 PM, Chris Angelico wrote: > > You keep using that word "unfinished". I do not think it means what > > you think it does. > > What do you think I think it means? I think it means that the langua

Re: learning python ...

2021-05-24 Thread Chris Angelico
On Tue, May 25, 2021 at 12:31 AM Michael Torrie wrote: > > On 5/24/21 8:24 AM, Chris Angelico wrote: > > On Tue, May 25, 2021 at 12:18 AM hw wrote: > >> There are more alternatives: Python might create a new variable with > >> the same name and forget about the

Re: learning python ...

2021-05-24 Thread Chris Angelico
On Tue, May 25, 2021 at 12:18 AM hw wrote: > There are more alternatives: Python might create a new variable with > the same name and forget about the old one. Or it doesn't forget about > the old one and the old one becomes inaccessible (unless you have a > reference to it, if there is such a

Re: learning python ...

2021-05-24 Thread Chris Angelico
On Mon, May 24, 2021 at 11:35 PM hw wrote: > > On 5/24/21 9:52 AM, Chris Angelico wrote: > > Does C give you a warning if you create a function-local variable > > called "printf"? No, and it shouldn't. Does any other language > > complain if you use its scoping

Re: learning python ...

2021-05-24 Thread Chris Angelico
On Mon, May 24, 2021 at 3:25 PM hw wrote: > > On 5/23/21 10:02 PM, Stestagg wrote: > > > > > > 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, > >

Re: Use Chrome's / Firefox's dev-tools in python

2021-05-21 Thread Chris Angelico
On Sat, May 22, 2021 at 3:55 AM max pothier wrote: > > Hello, > Thanks for you answer! > Actually my goal is not to automatically get the file once I open the page, > but more to periodically check the site and get a notification when there's > new homework or, at the morning, know when an hour

Re: Use Chrome's / Firefox's dev-tools in python

2021-05-20 Thread Chris Angelico
On Fri, May 21, 2021 at 4:59 AM max pothier wrote: > > > > My school has a website for homework called pronote (no problem if you don't > know it). After logging in on parisclassenumerique.fr (works with selenium > but I cant get requests to work), I want to read one of the packets that is >

Re: Unexpected Inheritance Problem

2021-05-20 Thread Chris Angelico
On Thu, May 20, 2021 at 2:02 PM Richard Damon wrote: > > Given the following definition of classes, I am getting an unexpected > error of : > > TypeError: __init__() missing 2 required keyword-only arguments: > 'idcode' and 'tag' > > On the call to create a GedcomHead in the call to GedcomHead()

Re: How to build stable 3.9 branch from fork and clone of cpython

2021-05-19 Thread Chris Angelico
On Wed, May 19, 2021 at 1:37 PM wrote: > > > -Original Message- > > From: Chris Angelico > > Sent: Tuesday, May 18, 2021 3:01 AM > > To: Python > > Subject: Re: How to build stable 3.9 branch from fork and clone of cpython > > > > On Tue, May

Re: How to build stable 3.9 branch from fork and clone of cpython

2021-05-18 Thread Chris Angelico
On Tue, May 18, 2021 at 4:33 PM wrote: > > I am following the "Getting Started" section of the Python Developers Guide, > but when I build the first version to verify everything builds, it builds > branch 3.11. > > > > If I want to build and contribute to branch 3.9, how do I set that up >

Re: Python script accessing own source code

2021-05-13 Thread Chris Angelico
On Thu, May 13, 2021 at 5:27 PM Robin Becker wrote: > > On 12/05/2021 20:17, Mirko via Python-list wrote: > > Am 12.05.2021 um 20:41 schrieb Robin Becker: > >> ... > >>> > >... > >> since GvR has been shown to have time traveling abilities such a > >> script could paradoxically appear

Re: OT: Autism in discussion groups (was: Re: Proposal: Disconnect comp.lang.python from python-list)

2021-05-08 Thread Chris Angelico
On Sun, May 9, 2021 at 11:10 AM Michael Torrie wrote: > > On 5/8/21 6:23 PM, Jason C. McDonald wrote: > > Usually, I find when people dump on CoCs, they're just angry at > > accountability. I haven't known anyone yet who was a productive > > member of Python and opposed to the CoC, at least in

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

2021-05-05 Thread Chris Angelico
On Thu, May 6, 2021 at 10:43 AM Avi Gross via Python-list wrote: > > Chris, > > Given some notice, what stops anyone from joining the mailing list before > there is a divorce between the forums? Nothing! Nothing at all. That is, if you're talking about *people*. People are absolutely welcome to

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

2021-05-05 Thread Chris Angelico
On Thu, May 6, 2021 at 10:32 AM Paul Bryan wrote: > > Given the ease of spoofing sender addresses, and its propensity for use > in anonymous spamming and trolling (thanks python-list-owner for > staying on top of that!), I propose to disconnect comp.lang.python from > the python-list mailing

Re: neoPython : Fastest Python Implementation: Coming Soon

2021-05-05 Thread Chris Angelico
On Thu, May 6, 2021 at 2:01 AM Mr Flibble wrote: > > neoPython : Fastest Python Implementation: Coming Soon > > Message ends. > > /Flibble > My breath: not being held. Message ends. ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: Not found in the documentation

2021-04-29 Thread Chris Angelico
On Thu, Apr 29, 2021 at 4:56 PM elas tica wrote: > > Le mercredi 28 avril 2021 à 17:36:32 UTC+2, Chris Angelico a écrit : > > > In what sense of the word "token" are you asking? The parser? You can > > play around with the low-level tokenizer with the a

Re: Not found in the documentation

2021-04-28 Thread Chris Angelico
On Thu, Apr 29, 2021 at 5:16 AM elas tica wrote: > > > Le mercredi 28 avril 2021 à 17:36:32 UTC+2, Chris Angelico a écrit : > > > > if a string or a range object is a container or not. For instance, > > > can we say that range(100) contains 42 ? > > Not by tha

Re: Not found in the documentation

2021-04-28 Thread Chris Angelico
On Thu, Apr 29, 2021 at 1:21 AM elas tica wrote: > > Peter J. Holzer a écrit : > > > That's why it's called a container. But it also says *what* an object > > must contain to be called a container. You could say that an int object > > contains an integer value and a str object contains a

Re: Not found in the documentation

2021-04-27 Thread Chris Angelico
On Tue, Apr 27, 2021 at 9:51 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

Re: Not found in the documentation

2021-04-27 Thread Chris Angelico
On Tue, Apr 27, 2021 at 6:11 PM elas tica wrote: > > > > Python has this thing called interactive mode that makes it possible to > > discover answers even faster than looking in the docs > > To go further : > Python has this thing called source code that makes it possible to discover > answers

Re: Are there Python modules that allow a program to write to the screen?

2021-04-26 Thread Chris Angelico
On Mon, Apr 26, 2021 at 4:40 PM Stephen Tucker wrote: > > Hi, > > I have old software written in GWBASIC that I use to plot diagrams on the > screen. > > In Windows 10, I have to resort to using the DOSBox emulator to run it. > "The screen" isn't really a viable target in a modern world, so it

Re: async watch directory for new files

2021-04-25 Thread Chris Angelico
On Mon, Apr 26, 2021 at 4:56 AM Zoran wrote: > > > > > > > Implementations are usually just callback-based. (Apologies for the > > generic link, I haven't needed this in Python yet: anyway, those are the > > keywords.) > > :) before asking a

Re: async watch directory for new files

2021-04-24 Thread Chris Angelico
On Sun, Apr 25, 2021 at 6:16 AM Zoran wrote: > > On Saturday, 24 April 2021 at 18:52:24 UTC+2, Dieter Maurer wrote: > > Zoran wrote at 2021-4-23 14:31 -0700: > > >I need to watch for new files in directory, and when it shows up, I should > > >create async task with file's full path for it, and

Re: "py.ini" question

2021-04-24 Thread Chris Angelico
On Sun, Apr 25, 2021 at 5:57 AM Gisle Vanem wrote: > > With 'py -3.6' or 'py 3.8' I get the expected. > But with 'py -3': >Python 3.8.9 (default, Apr 13 2021, 15:54:59) [GCC 10.2.0 64 bit (AMD64)] > on win32 > I believe that's because you're asking for "the latest in the 3.x series".

Re: Current thinking on required options

2021-04-19 Thread Chris Angelico
On Tue, Apr 20, 2021 at 4:18 AM Bill Campbell wrote: > > On Mon, Apr 19, 2021, Loris Bennett wrote: > >Hi, > > > >I have various small programs which tend to have an interface like the > >following example: > > > > usage: grocli [-h] [-o {check,add,delete}] [-u USERS [USERS ...]] [-g > > GROUP]

Re: need help with a translation issue

2021-04-17 Thread Chris Angelico
On Sun, Apr 18, 2021 at 9:58 AM dn via Python-list wrote: > Alternately, what's there to stop some nefarious/stupid user (like me!) > entering "gobbledegook" and complaining that the program fails? "What is the French for fiddle-de-dee?" -- the Red Queen, to Alice (Incidentally, Google attempts

Re: TIME IN XARRAY

2021-04-15 Thread Chris Angelico
On Fri, Apr 16, 2021 at 4:16 AM Jorge Conforte wrote: > I'm using xarray to read netcdf data and I had to time in my data the > values: > > xarray.DataArray 'time' (time: 507)> > array(['1979-01-01T00:00:00.0', '1979-02-01T00:00:00.0', > '1979-03-01T00:00:00.0',

Re: Style qeustion: Multiple return values

2021-04-13 Thread Chris Angelico
On Tue, Apr 13, 2021 at 4:26 PM dn via Python-list wrote: > > On 12/04/2021 22.32, Chris Angelico wrote: > > On Mon, Apr 12, 2021 at 8:20 PM dn via Python-list > > wrote: > >> > >> On 12/04/2021 20.29, Steve Keller wrote: > >>> Just a short style

Re: Comparing text strings

2021-04-12 Thread Chris Angelico
On Tue, Apr 13, 2021 at 9:54 AM Cameron Simpson wrote: > Note that this depends on sorting by version. A lexical sort (eg > "ls|sort") will look good intil a package version crosses a boundary > like this: > > 1.9.1 > 1.10.0 > > A lexical sort will put those the other way around because

Re: How does "__doc__ % globals()" work?

2021-04-12 Thread Chris Angelico
On Tue, Apr 13, 2021 at 8:57 AM Jaime wrote: > > Hi all. Line 102 of https://github.com/python/peps/blob/master/pep2html.py > says: > > print(__doc__ % globals(), file=out) > > and I've just spent all day trying to understand "__doc__ % > globals()". The docstring for any function, class, or

Re: Style qeustion: Multiple return values

2021-04-12 Thread Chris Angelico
On Mon, Apr 12, 2021 at 8:20 PM dn via Python-list wrote: > > On 12/04/2021 20.29, Steve Keller wrote: > > Just a short style question: When returning multiple return values, do > > you use parenthesis? > > Thus, the answer to your question is a matter of style, and thus the > understanding of

Re: PyWin32 : When using Microsoft Word in code , opening it doesn't work

2021-04-08 Thread Chris Angelico
On Fri, Apr 9, 2021 at 8:26 AM VISHESH MANGLA wrote: > > Please help with this . > > https://github.com/mhammond/pywin32/issues/1689 Did you follow the instructions in the first line of the issue, saying how you should seek support? ChrisA --

Re: question about basics of creating a PROXY to MONITOR network activity

2021-04-08 Thread Chris Angelico
On Fri, Apr 9, 2021 at 12:42 AM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > On 2021-04-09 at 00:17:59 +1000, > Chris Angelico wrote: > > > Also, you'd better be really REALLY sure that your monitoring is > > legal, ethical, and not deceptive. > > No

Re: question about basics of creating a PROXY to MONITOR network activity

2021-04-08 Thread Chris Angelico
On Fri, Apr 9, 2021 at 12:11 AM cseb...@gmail.com wrote: > > I'm trying to create an application that stands in between all > connections to a remote server to monitor behavior for > security and compliance reasons. > > I'm guessing I'll have all users log into this middle man proxy > application

Re: Yield after the return in Python function.

2021-04-07 Thread Chris Angelico
On Wed, Apr 7, 2021 at 10:30 PM Stestagg wrote: > > > > 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

Re: Yield after the return in Python function.

2021-04-07 Thread Chris Angelico
On Tue, Apr 6, 2021 at 12:40 PM Terry Reedy wrote: > > On 4/5/2021 3:32 PM, Chris Angelico wrote: > > > On Tue, Apr 6, 2021 at 5:14 AM Terry Reedy wrote: > >> Python *could* do the same for expresssions: load 'a' (in this case) > >> once into a register

Re: Friday Finking: initialising values and implied tuples

2021-04-05 Thread Chris Angelico
On Tue, Apr 6, 2021 at 5:36 AM Rob Cliffe via Python-list wrote: > > > > On 05/04/2021 18:33, Chris Angelico wrote: > > > > Firstly, anything with any variable at all can involve a lookup, which > > can trigger arbitrary code (so "variables which do not occu

Re: Yield after the return in Python function.

2021-04-05 Thread Chris Angelico
On Tue, Apr 6, 2021 at 5:14 AM Terry Reedy wrote: > > On 4/5/2021 1:53 PM, Chris Angelico wrote: > > On Tue, Apr 6, 2021 at 3:46 AM Terry Reedy wrote: > >> *While 'a and not a' == False in logic, in Python it might raise > >> NameError. But that would still mean

Re: error on os.open API

2021-04-05 Thread Chris Angelico
On Tue, Apr 6, 2021 at 3:50 AM Rami Khaldi wrote: > > Hello, > > It seems that the os.open API cannot distinguish between a permission error > and the fact that a directory cannot be opened like files. > The following script reproduces the scenario (tested on Python 3.8.2 > (tags/v3.8.2:7b3ab59,

Re: Yield after the return in Python function.

2021-04-05 Thread Chris Angelico
On Tue, Apr 6, 2021 at 3:46 AM Terry Reedy wrote: > *While 'a and not a' == False in logic, in Python it might raise > NameError. But that would still mean that it is never True, making > 'yield 0' still unreachable. > And even just the lookup can have side effects, if your code is

Re: Friday Finking: initialising values and implied tuples

2021-04-05 Thread Chris Angelico
On Tue, Apr 6, 2021 at 3:26 AM Rob Cliffe via Python-list wrote: > > > > On 05/04/2021 17:52, Chris Angelico wrote: > > On Tue, Apr 6, 2021 at 2:32 AM Rob Cliffe via Python-list > > wrote: > >> > >> > >> It doesn't appear to, at least not

Re: Friday Finking: initialising values and implied tuples

2021-04-05 Thread Chris Angelico
On Tue, Apr 6, 2021 at 2:32 AM Rob Cliffe via Python-list wrote: > > > > It doesn't appear to, at least not always. In Python 3.8.3: > from dis import dis > def f(): x = 1 ; y = 2 > def g(): (x,y) = (1,2) > dis(f) > dis(g) > > Output: >2 0 LOAD_CONST 1 (1) >

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-04-04 Thread Chris Angelico
On Mon, Apr 5, 2021 at 2:21 AM jak wrote: > > I modified your code in the following way: > > line 65-66: > from: > > if (qty <= alternate["per_minute"] > and (costs[Extractor], costs) > (alternate["costs"][Extractor], > alternate["costs"]) > > to: > if (qty <=

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-04-04 Thread Chris Angelico
On Sun, Apr 4, 2021 at 6:26 PM jak wrote: > > Il 01/04/2021 01:14, Chris Angelico ha scritto: > > I think this code makes some sort of argument in the debate about > > whether Python has too much flexibility or if it's the best > > metaprogramming toolset in the world.

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-04-02 Thread Chris Angelico
On Sat, Apr 3, 2021 at 8:16 AM dn via Python-list wrote: > Is there such a thing as F/LOSS in the chocolate world? What does it > mean to fork a block of chocolate? Where is their repository? > It means exactly what you'd expect. The tricky part comes when you try to knife the block of

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-04-02 Thread Chris Angelico
On Sat, Apr 3, 2021 at 3:51 AM Avi Gross via Python-list wrote: > > Chris, > > Now that it is April 2, I have to ask which of the methods for dealing with > chocolate is more pythonic and is there a module for that? I have a JavaScript front end package called "Chocolate Factory", which works

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-04-02 Thread Chris Angelico
On Fri, Apr 2, 2021 at 10:43 AM dn via Python-list wrote: > > On 02/04/2021 10.13, Chris Angelico wrote: > > Well, it's a simple matter of chronology. First you have crude oil, > > then time passes, and then you have plastic and residue. It makes > > sense ONLY if you thi

Re: A 35mm film camera represented in Python object

2021-04-01 Thread Chris Angelico
On Fri, Apr 2, 2021 at 9:43 AM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > On 2021-04-01 at 18:10:46 -0400, > Richard Damon wrote: > > > On 4/1/21 5:47 PM, D.M. Procida wrote: > > > D.M. Procida wrote: > > > > > >> Hi everyone, I've created - > >

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-04-01 Thread Chris Angelico
going. :) > On 01/04/2021 19.25, Chris Angelico wrote: > > On Thu, Apr 1, 2021 at 3:36 PM dn via Python-list > > wrote: > >> > >> On 01/04/2021 13.54, Chris Angelico wrote: > >>> Real and imaginary are the same thing, just rotated a quarter turn > >&

Re: XanaNews Statistic for comp.lang.python. 4/1/2021 5:52:47 AM

2021-04-01 Thread Chris Angelico
On Fri, Apr 2, 2021 at 7:55 AM dn via Python-list wrote: > > On 02/04/2021 01.19, Chris Angelico wrote: > > On Thu, Apr 1, 2021 at 10:56 PM The Doctor via Python-list > > wrote: > >> Top Posters > >> > >> Ranking Articles Nam

<    5   6   7   8   9   10   11   12   13   14   >