Re: SOLVED! Re: Weird Stuff (Markdown, syntax highlighting and Python)

2024-05-29 Thread dn via Python-list
On 29/05/24 06:49, Gilmeh Serda via Python-list wrote: Solved by using a different method. Hedonist for hire... no job too easy! This combination of sig-file and content seems sadly ironic. How about CONTRIBUTING to the community by explaining 'the solution' to people who may find a simi

Re: SOLVED! Re: Weird Stuff (Markdown, syntax highlighting and Python)

2024-05-29 Thread o1bigtenor via Python-list
On Tue, May 28, 2024 at 9:48 PM Gilmeh Serda via Python-list < python-list@python.org> wrote: > > Solved by using a different method. > > - - - And that was how? TIA -- https://mail.python.org/mailman/listinfo/python-list

Re: Weird Stuff (Markdown, syntax highlighting and Python)

2024-05-27 Thread Thomas Passin via Python-list
On 5/26/2024 2:28 AM, Gilmeh Serda via Python-list wrote: The web claims (I think on all pages I've read about Markdown and Python) that this code should work, with some very minor variants on the topic: ```python import os with open(os.path.join('/home/user/apath', 'somefile')) as f: pri

Re: Weird Stuff (Markdown, syntax highlighting and Python)

2024-05-27 Thread dn via Python-list
ffers single back-ticks for code, triple back-ticks for a code-block, and the latter with or without a language specification which *usually* kicks-in syntax highlighting. ```python import os with open(os.path.join('/home/user/apath', 'somefile')) as f: print(f.read

Re: Weird Stuff (Markdown, syntax highlighting and Python)

2024-05-27 Thread Grant Edwards via Python-list
On 2024-05-26, Gilmeh Serda via Python-list wrote: > The web claims (I think on all pages I've read about Markdown and Python) > that this code should work, with some very minor variants on the topic: > > ```python > > import os > > with open(os.path.join('/home/user/apath', 'somefile')) as f: >

Re: >>> %matplotlib inline results in SyntaxError: invalid syntax

2023-12-25 Thread MRAB via Python-list
On 2023-12-25 19:53, Alan Gauld via Python-list wrote: On 25/12/2023 05:34, geetanajali homes via Python-list wrote: import numpy as np import pandas as pd import random import matplotlib.pyplot as plt %matplotlib inline I get an error on the last line. I am running this code in Idle Pytho

Re: >>> %matplotlib inline results in SyntaxError: invalid syntax

2023-12-25 Thread Chris Angelico via Python-list
On Tue, 26 Dec 2023 at 07:27, Chris Grace via Python-list wrote: > I'd also recommend a newer version of python. Python 3.4 reached end of > life almost 5 years ago. Uhh, putting this in perspective... until a spammer revived the thread just now, it was asked, answered, and finished with, all bac

Re: >>> %matplotlib inline results in SyntaxError: invalid syntax

2023-12-25 Thread Chris Grace via Python-list
"%matplotlib inline" is a magic command that changes how plots render when working with IPython. Read more here: https://stackoverflow.com/a/43028034 The article you linked assumes you are working in an IPython shell, not IDLE. This is common in the data science world. You may already have IPytho

Re: >>> %matplotlib inline results in SyntaxError: invalid syntax

2023-12-25 Thread Alan Gauld via Python-list
On 25/12/2023 05:34, geetanajali homes via Python-list wrote: >> import numpy as np >> import pandas as pd >> import random >> import matplotlib.pyplot as plt >> %matplotlib inline >> >> I get an error on the last line. I am running this code in Idle Python >> 3.4.4 Shell... Python names c

Re: >>> %matplotlib inline results in SyntaxError: invalid syntax

2023-12-25 Thread geetanajali homes via Python-list
copyright", "credits" or "license()" for more information. > >>> import numpy as np > >>> import pandas as pd > >>> import random > >>> import matplotlib.pyplot as plt > >>> %matplotlib inline > SyntaxErr

Re: f-string syntax deficiency?

2023-06-06 Thread Mark Bourne via Python-list
Roel Schroeven wrote: Op 6/06/2023 om 16:08 schreef Chris Angelico: On Wed, 7 Jun 2023 at 00:06, Neal Becker wrote: > > The following f-string does not parse and gives syntax error on 3.11.3: > > f'thruput/{"user" if opt.return else "cell"} vs. elevation\

Re: f-string syntax deficiency?

2023-06-06 Thread Roel Schroeven via Python-list
Error: invalid syntax" doesn't immediately remind me > of that fact that 'return' is a keyword and therefor can't be used as an > attribute.) That's true, but depending on exactly how you're seeing the error, it might highlight the exact part that's a

Re: f-string syntax deficiency?

2023-06-06 Thread Chris Angelico via Python-list
On Wed, 7 Jun 2023 at 00:42, Roel Schroeven wrote: > (Recently there has been an effort to provide clearer and more useful > error messages; this seems to be a case where there is still room for > improvement: "SyntaxError: invalid syntax" doesn't immediately remind me >

Re: f-string syntax deficiency?

2023-06-06 Thread Roel Schroeven
Op 6/06/2023 om 16:41 schreef Roel Schroeven: 'return' being a keyowrd is definitely going to be the problem. *keyword -- "Don't Panic." -- Douglas Adams, The Hitchhiker's Guide to the Galaxy -- https://mail.python.org/mailman/listinfo/python-list

Re: f-string syntax deficiency?

2023-06-06 Thread Roel Schroeven
Op 6/06/2023 om 16:08 schreef Chris Angelico: On Wed, 7 Jun 2023 at 00:06, Neal Becker wrote: > > The following f-string does not parse and gives syntax error on 3.11.3: > > f'thruput/{"user" if opt.return else "cell"} vs. elevation\n' > > Howe

Re: f-string syntax deficiency?

2023-06-06 Thread Chris Angelico
On Wed, 7 Jun 2023 at 00:06, Neal Becker wrote: > > The following f-string does not parse and gives syntax error on 3.11.3: > > f'thruput/{"user" if opt.return else "cell"} vs. elevation\n' > > However this expression, which is similar does par

f-string syntax deficiency?

2023-06-06 Thread Neal Becker
The following f-string does not parse and gives syntax error on 3.11.3: f'thruput/{"user" if opt.return else "cell"} vs. elevation\n' However this expression, which is similar does parse correctly: f'thruput/{"user" if True else "c

Re: double bracket integer index in pandas; Is this a legal syntax

2023-05-03 Thread Cameron Simpson
On 03May2023 17:52, Artie Ziff wrote: The code came from a video course, "Pandas Data Analysis with Python Fundamentals" by Daniel Chen. I am curious why the author may have said this. To avoid attaching screenshots, I'll describe this section of the content. Perhaps someone can say, "oh that's

Re: double bracket integer index in pandas; Is this a legal syntax

2023-05-03 Thread Artie Ziff
I agree with your analysis, Cameron. The code came from a video course, "Pandas Data Analysis with Python Fundamentals" by Daniel Chen. I am curious why the author may have said this. To avoid attaching screenshots, I'll describe this section of the content. Perhaps someone can say, "oh that's ho

Re: double bracket integer index in pandas; Is this a legal syntax

2023-05-03 Thread Cameron Simpson
On 03May2023 03:41, Artie Ziff wrote: I am hope that pandas questions are OK here. There are some pandas users here. In a panda lecture, I did not get the expected result. I tried this on two different platforms (old macOS distro and up-to-date Ubuntu Linux distro, 22.04) The Linux distro h

double bracket integer index in pandas; Is this a legal syntax

2023-05-03 Thread Artie Ziff
Hello, I am hope that pandas questions are OK here. In a panda lecture, I did not get the expected result. I tried this on two different platforms (old macOS distro and up-to-date Ubuntu Linux distro, 22.04) The Linux distro has: python3.10.11 pandas1.5.2

Re: Hide my query about covariance matrix syntax from google

2023-04-14 Thread Keith Thompson
Chris Angelico writes: > On Fri, 14 Apr 2023 at 03:11, Meghna Karkera wrote: >> >> Respected Sir >> >> I kindly request you to hide my query about covariance matrix syntax from >> google which was emailed to you a few years back as it appears on google >

Re: Hide my query about covariance matrix syntax from google

2023-04-13 Thread Chris Angelico
On Fri, 14 Apr 2023 at 03:11, Meghna Karkera wrote: > > Respected Sir > > I kindly request you to hide my query about covariance matrix syntax from > google which was emailed to you a few years back as it appears on google > page. > > Hoping that you do the needful. These

Hide my query about covariance matrix syntax from google

2023-04-13 Thread Meghna Karkera
Respected Sir I kindly request you to hide my query about covariance matrix syntax from google which was emailed to you a few years back as it appears on google page. Hoping that you do the needful. Dr. Meghna Raviraj Karkera -- https://mail.python.org/mailman/listinfo/python-list

Re: What to use for finding as many syntax errors as possible.

2022-11-08 Thread Alex Hall
On Sunday, October 9, 2022 at 12:09:45 PM UTC+2, Antoon Pardon wrote: > I would like a tool that tries to find as many syntax errors as possible > in a python file. I know there is the risk of false positives when a > tool tries to recover from a syntax error and proceeds but I would

Re: What to use for finding as many syntax errors as possible.

2022-10-12 Thread Peter J. Holzer
On 2022-10-11 14:11:56 -0400, Thomas Passin wrote: > To bring things back to the context of the original post, actual web > browsers are extremely tolerant of HTML syntax errors (including incorrect > nesting of tags) in the documents they receive. HTML5 actually specifies exactly how t

Re: What to use for finding as many syntax errors as possible.

2022-10-12 Thread Peter J. Holzer
gt; > > > if condition # no colon > > > code > > > else: > > > code > > > > > > To actually "restart" parsing, you have to make a guess of some sort. > > > > Right. At least one of the papers on parsing I read over

Re: What to use for finding as many syntax errors as possible.

2022-10-12 Thread Chris Angelico
On Thu, 13 Oct 2022 at 11:23, dn wrote: > # add an extra character within identifier, as if 'new' identifier > 28 assert expected_value == fyibonacci_number > UUU > > # these all trivial SYNTAX errors - could have trie

Re: What to use for finding as many syntax errors as possible.

2022-10-12 Thread Chris Angelico
> code > > > > To actually "restart" parsing, you have to make a guess of some sort. > > Right. At least one of the papers on parsing I read over the last few > years (yeah, I really should try to find them again) argued that the > vast majority of syntax

Re: What to use for finding as many syntax errors as possible.

2022-10-12 Thread dn
On 09/10/2022 23.09, Antoon Pardon wrote: I would like a tool that tries to find as many syntax errors as possible in a python file. I know there is the risk of false positives when a tool tries to recover from a syntax error and proceeds but I would prefer that over the current python

Re: What to use for finding as many syntax errors as possible.

2022-10-12 Thread Peter J. Holzer
sort. Right. At least one of the papers on parsing I read over the last few years (yeah, I really should try to find them again) argued that the vast majority of syntax errors is either a missing token, a superfluous token or a combination of the the two. So one strategy with good results is to h

Re: What to use for finding as many syntax errors as possible.

2022-10-11 Thread Cameron Simpson
On 11Oct2022 17:45, Thomas Passin wrote: Personally, I'd most likely go for a decent programming editor that you can set up to run a program on your file, use that to run a checker, like pyflakes for instance, and run that from time to time. You could run it when you save a file. Even if it

Re: What to use for finding as many syntax errors as possible.

2022-10-11 Thread Thomas Passin
parser can do some error correction in mid-flight, for the purposes of a programming editor (as opposed to one that has to build a correct program). One editor that seems to do what the OP wants is Visual Studio Code. It will mark apparent errors - not just syntax errors - not limited to one

Re: What to use for finding as many syntax errors as possible.

2022-10-11 Thread Thomas Passin
resulting treelike structure has names like DOM. To bring things back to the context of the original post, actual web browsers are extremely tolerant of HTML syntax errors (including incorrect nesting of tags) in the documents they receive. They usually recover silently from errors and are able to

Re: What to use for finding as many syntax errors as possible.

2022-10-11 Thread Chris Angelico
resent aspects of what it sees. The resulting treelike structure has > > names like DOM. > > To bring things back to the context of the original post, actual web > browsers are extremely tolerant of HTML syntax errors (including > incorrect nesting of tags) in the documents they recei

Re: What to use for finding as many syntax errors as possible.

2022-10-11 Thread Thomas Passin
, actual web browsers are extremely tolerant of HTML syntax errors (including incorrect nesting of tags) in the documents they receive. They usually recover silently from errors and are able to display the rest of the page. Usually they manage this correctly. The OP would like to have a

Re: What to use for finding as many syntax errors as possible.

2022-10-11 Thread Chris Angelico
On Tue, 11 Oct 2022 at 18:12, wrote: > > Thanks for a rather detailed explanation of some of what we have been > discussing, Chris. The overall outline is about what I assumed was there but > some of the details were, to put it politely, fuzzy. > > I see resemblances to something like how a web pa

Re: What to use for finding as many syntax errors as possible.

2022-10-11 Thread Weatherby,Gerard
thing with DirEntry fields / methods From: Python-list on behalf of avi.e.gr...@gmail.com Date: Monday, October 10, 2022 at 10:11 PM To: python-list@python.org Subject: RE: What to use for finding as many syntax errors as possible. *** Attention: This is an external email. Use caution respondin

Re: What to use for finding as many syntax errors as possible.

2022-10-11 Thread Antoon Pardon
Op 10/10/2022 om 19:08 schreef Robert Latest via Python-list: Antoon Pardon wrote: I would like a tool that tries to find as many syntax errors as possible in a python file. I'm puzzled as to when such a tool would be needed. How many syntax errors can you realistically put into a s

Re: What to use for finding as many syntax errors as possible.

2022-10-11 Thread Roel Schroeven
Op 10/10/2022 om 19:08 schreef Robert Latest via Python-list: Antoon Pardon wrote: > I would like a tool that tries to find as many syntax errors as possible > in a python file. I'm puzzled as to when such a tool would be needed. How many syntax errors can you realistically put in

RE: What to use for finding as many syntax errors as possible.

2022-10-11 Thread avi.e.gross
f Of Chris Angelico Sent: Monday, October 10, 2022 11:55 PM To: python-list@python.org Subject: Re: What to use for finding as many syntax errors as possible. On Tue, 11 Oct 2022 at 14:26, wrote: > > I stand corrected Chris, and others, as I pay the sin tax. > > Yes, there are many kinds of

What to use for finding as many syntax errors as possible.

2022-10-10 Thread avi.e.gross
disparate objects to live together. Python is far from the most complex but as noted, it is not trivial to evaluate even the syntax past errors. But I admit it is fun and a challenge to learn both kinds and I spent much of my time doing so. I like the flexibility of seeing different approaches and

Re: What to use for finding as many syntax errors as possible.

2022-10-10 Thread Chris Angelico
roadly speaking, here's how it goes: 0) Early pre-parse steps that don't really matter to most programs, like checking character set. We'll ignore these. 1) Tokenize the text of the program into a sequence of potentially-meaningful units. 2) Parse those tokens into some sort of me

Re: What to use for finding as many syntax errors as possible.

2022-10-10 Thread Chris Angelico
On Tue, 11 Oct 2022 at 14:13, wrote: > With the internet today, we are used to expecting error correction to come > for free. Do you really need one of every 8 bits to be a parity bit, which > only catches may half of the errors... Fortunately, we have WAY better schemes than simple parity, which

RE: What to use for finding as many syntax errors as possible.

2022-10-10 Thread avi.e.gross
a language based on more mathematical rules including more precisely what is syntax versus ... Suggestions? -Original Message- From: Python-list On Behalf Of Chris Angelico Sent: Monday, October 10, 2022 10:42 PM To: python-list@python.org Subject: Re: What to use for finding as many

RE: What to use for finding as many syntax errors as possible.

2022-10-10 Thread avi.e.gross
st places ... -Original Message- From: Python-list On Behalf Of Cameron Simpson Sent: Monday, October 10, 2022 6:17 PM To: python-list@python.org Subject: Re: What to use for finding as many syntax errors as possible. On 11Oct2022 08:02, Chris Angelico wrote: >There's a huge diff

Re: What to use for finding as many syntax errors as possible.

2022-10-10 Thread Chris Angelico
On Tue, 11 Oct 2022 at 13:10, wrote: > If the above is: > > Import grumpy as np > > Then what happens if the code tries to find a file named "grumpy" somewhere > and cannot locate it and this is considered a syntax error rather than a > run-time error for whateve

RE: What to use for finding as many syntax errors as possible.

2022-10-10 Thread avi.e.gross
happens if the code tries to find a file named "grumpy" somewhere and cannot locate it and this is considered a syntax error rather than a run-time error for whatever reason? Can you continue when all kinds of functionality is missing and code asking to make a np.array([1,2,3]) clearly

Re: What to use for finding as many syntax errors as possible.

2022-10-10 Thread Thomas Passin
o have any typos flagged. I'd love it if there was something similar that I could do in python. The Leo editor (https://github.com/leo-editor/leo-editor) will notify you of undeclared variables (and some syntax errors) each time you save your (Python) file. -- https://mail.python.org/m

Re: What to use for finding as many syntax errors as possible.

2022-10-10 Thread Chris Angelico
s the case, keep going immediately, don't wait for an unindented line. If you want for a blank line followed by an unindented line, that might help with a notion of "next logical unit of code", but it's very much dependent on the coding style, and if you have a codebase that

Re: What to use for finding as many syntax errors as possible.

2022-10-10 Thread Cameron Simpson
change all later ones? Just to this, these are semantic errors, not syntax errors. Linters do an ok job of spotting these. Antoon is after _syntax errors_. On 10Oct2022 08:21, Michael F. Stemper wrote: How does one declare a variable in python? Sometimes it'd be nice to be able to

Re: What to use for finding as many syntax errors as possible.

2022-10-10 Thread Cameron Simpson
didn't stop at the first syntax error. All you need in principle is a parser which goes "report syntax error here, continue assuming ". For Python that might mean "pretend a missing final colon" or "close open brackets" etc, depending on the context.

Re: What to use for finding as many syntax errors as possible.

2022-10-10 Thread Robert Latest via Python-list
Antoon Pardon wrote: > I would like a tool that tries to find as many syntax errors as possible > in a python file. I'm puzzled as to when such a tool would be needed. How many syntax errors can you realistically put into a single Python file before compiling it for the first time?

Re: What to use for finding as many syntax errors as possible.

2022-10-10 Thread Robert Latest via Python-list
Michael F. Stemper wrote: > How does one declare a variable in python? Sometimes it'd be nice to > be able to have declarations and any undeclared variable be flagged. To my knowledge, the closest to that is using __slots__ in class definitions. Many a time have I assigned to misspelled class memb

Re: What to use for finding as many syntax errors as possible.

2022-10-10 Thread Robert Latest via Python-list
wrote: > Cameron, > > Your suggestion makes me shudder! Me, too > Removing all earlier lines of code is often guaranteed to generate errors as > variables you are using are not declared or initiated, modules are not > imported and so on. all of which aren't syntax error

Re: What to use for finding as many syntax errors as possible.

2022-10-10 Thread Michael F. Stemper
On 09/10/2022 10.49, Avi Gross wrote: Anton There likely are such programs out there but are there universal agreements on how to figure out when a new safe zone of code starts where error testing can begin? For example a file full of function definitions might find an error in function 1 and t

Re: What to use for finding as many syntax errors as possible.

2022-10-10 Thread Chris Angelico
On Tue, 11 Oct 2022 at 06:34, Peter J. Holzer wrote: > > On 2022-10-10 09:23:27 +1100, Chris Angelico wrote: > > On Mon, 10 Oct 2022 at 06:50, Antoon Pardon wrote: > > > I just want a parser that doesn't give up on encoutering the first syntax > > > error. M

Re: What to use for finding as many syntax errors as possible.

2022-10-10 Thread Peter J. Holzer
On 2022-10-10 09:23:27 +1100, Chris Angelico wrote: > On Mon, 10 Oct 2022 at 06:50, Antoon Pardon wrote: > > I just want a parser that doesn't give up on encoutering the first syntax > > error. Maybe do some semantic checking like checking the number of > > paramete

Re: What to use for finding as many syntax errors as possible.

2022-10-10 Thread Cameron Simpson
On 10Oct2022 09:04, Antoon Pardon wrote: It is easy to get the syntax right before submitting to such a pipeline.  I usually run a linter on my code for serious commits, and I've got a `lint1` alias which basicly runs the short fast flavour of that which does a syntax check and the very

Re: What to use for finding as many syntax errors as possible.

2022-10-10 Thread Antoon Pardon
with unit tests and other tools that all have to redo their work each time a bug is corrected. It is easy to get the syntax right before submitting to such a pipeline.  I usually run a linter on my code for serious commits, and I've got a `lint1` alias which basicly runs the short fast fl

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Cameron Simpson
erate errors as variables you are using are not declared or initiated, modules are not imported and so on. Antoon's interested in syntax errors. Removing just the line or three where the previous error happened would also have a good chance of invalidating something. Doubtless. He accepts

RE: What to use for finding as many syntax errors as possible.

2022-10-09 Thread avi.e.gross
l goal is to have a chance to detect and maybe fix a few things per round rather than just one. Not a bad wish. Just not a trivial wish to grant and satisfy. -Original Message- From: Python-list On Behalf Of Cameron Simpson Sent: Sunday, October 9, 2022 6:45 PM To: python-list@python.org Su

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Thomas Passin
On 10/9/2022 1:29 PM, Peter J. Holzer wrote: > On 2022-10-09 12:59:09 -0400, Thomas Passin wrote: >> https://stackoverflow.com/questions/4284313/how-can-i-check-the-syntax-of-python-script-without-executing-it >> >> People seemed especially enthusiastic about the one-lin

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Cameron Simpson
their work each time a bug is corrected. It is easy to get the syntax right before submitting to such a pipeline. I usually run a linter on my code for serious commits, and I've got a `lint1` alias which basicly runs the short fast flavour of that which does a syntax check and the very

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Chris Angelico
On Mon, 10 Oct 2022 at 06:50, Antoon Pardon wrote: > I just want a parser that doesn't give up on encoutering the first syntax > error. Maybe do some semantic checking like checking the number of parameters. That doesn't make sense though. It's one thing to keep goin

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Karsten Hilbert
sitives became so high it was useless trying to find the > remaining true ones, but it still was more efficient to correct the > obvious ones, than to only correct the first one. > > I don't need to be sure. Even the occasional wrong correction > is probably still more efficient than quitin

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Barry
nding 100 errors might turn out to be misleading. If you >>>> fix just the first, many others would go away. >>> At this moment I would prefer a tool that reported 100 errors, which would >>> allow me to easily correct 10 real errors, over the python strategy which >

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Antoon Pardon
Op 9/10/2022 om 21:44 schreef Avi Gross: But an error like setting the size of a fixed length data structure to the right size may result in oodles of errors about being out of range that magically get fixed by one change. Sometimes too much info just gives you a headache. So? The user of su

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Peter J. Holzer
ed to byte code before execution starts. It's true that a syntax error before an import prevents that import, but since imports are usually at the start of a file, a syntax error will only rarely prevent the import (and files intended to be imported generally don't have weird side ef

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Antoon Pardon
faster later. I just want a parser that doesn't give up on encoutering the first syntax error. Maybe do some semantic checking like checking the number of parameters. I will say that often enough a program could report more possible errors. Putting your code into multiple files and module

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Antoon Pardon
faster later. I just want a parser that doesn't give up on encoutering the first syntax error. Maybe do some semantic checking like checking the number of parameters. I will say that often enough a program could report more possible errors. Putting your code into multiple files and module

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Avi Gross
rors, which > would > >> allow me to easily correct 10 real errors, over the python strategy > which quits > >> after having found one syntax error. > > But the point is: you can't (there is no way to) be sure the > > 9+ errors really are errors. > >

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Avi Gross
to easily correct 10 real errors, over the python strategy which > quits > after having found one syntax error. > > -- > Antoon. > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread MRAB
, many others would go away. At this moment I would prefer a tool that reported 100 errors, which would allow me to easily correct 10 real errors, over the python strategy which quits after having found one syntax error. But the point is: you can't (there is no way to) be sure the 9+ errors r

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Weatherby,Gerard
: What to use for finding as many syntax errors as possible. *** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. *** I would like a tool that tries to find as many syntax errors as possible in a python file. I know there is the risk of false

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Antoon Pardon
I would prefer a tool that reported 100 errors, which would allow me to easily correct 10 real errors, over the python strategy which quits after having found one syntax error. But the point is: you can't (there is no way to) be sure the 9+ errors really are errors. Unless you further cons

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Peter J. Holzer
, many others would go away. > > > > At this moment I would prefer a tool that reported 100 errors, which would > > allow me to easily correct 10 real errors, over the python strategy which > > quits > > after having found one syntax error. > > But the point is: yo

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Peter J. Holzer
On 2022-10-09 12:59:09 -0400, Thomas Passin wrote: > https://stackoverflow.com/questions/4284313/how-can-i-check-the-syntax-of-python-script-without-executing-it > > People seemed especially enthusiastic about the one-liner from jmd_dk. I don't think that one-liner solves Antoon&#x

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Karsten Hilbert
ool that reported 100 errors, which would > allow me to easily correct 10 real errors, over the python strategy which > quits > after having found one syntax error. But the point is: you can't (there is no way to) be sure the 9+ errors really are errors. Unless you further constrict w

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Thomas Passin
https://stackoverflow.com/questions/4284313/how-can-i-check-the-syntax-of-python-script-without-executing-it People seemed especially enthusiastic about the one-liner from jmd_dk. On 10/9/2022 12:17 PM, Peter J. Holzer wrote: On 2022-10-09 12:09:17 +0200, Antoon Pardon wrote: I would like a

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Antoon Pardon
python strategy which quits after having found one syntax error. -- Antoon. -- https://mail.python.org/mailman/listinfo/python-list

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Peter J. Holzer
On 2022-10-09 12:09:17 +0200, Antoon Pardon wrote: > I would like a tool that tries to find as many syntax errors as possible in > a python file. I know there is the risk of false positives when a tool tries > to recover from a syntax error and proceeds but I would prefer that over the

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Avi Gross
, many others would go away. If you spell a variable name wrong when declaring it, a dozen uses of the right name may cause errors. Should you fix the first or change all later ones? On Sun, Oct 9, 2022, 6:11 AM Antoon Pardon wrote: > I would like a tool that tries to find as many syntax err

What to use for finding as many syntax errors as possible.

2022-10-09 Thread Antoon Pardon
I would like a tool that tries to find as many syntax errors as possible in a python file. I know there is the risk of false positives when a tool tries to recover from a syntax error and proceeds but I would prefer that over the current python strategy of quiting after the first syntax error

Re: Proposal: Syntax for attribute initialisation in __init__ methods

2022-04-20 Thread Sam Ezeh
I'll see if I can find out how positional only and keyword only arguments are used in __init__ methods in the wild and I'll see if there have been any other discussions talking about what this approach could offer. On Sun, 17 Apr 2022 at 02:54, dn wrote: > > On 17/04/2022 09.20, Sam Ezeh wrote: >

Re: Proposal: Syntax for attribute initialisation in __init__ methods

2022-04-16 Thread dn
On 17/04/2022 09.20, Sam Ezeh wrote: >> Perhaps I'm missing the point, but what functionality or advantage(s) >> does this give, over data-classes? > > One advantage is maintaining control over the __init__ function without > having to write extra code to do so. In the linked discussion from > pyt

Fwd: Proposal: Syntax for attribute initialisation in __init__ methods

2022-04-16 Thread Sam Ezeh
t; > On 4/15/22 04:19, Sam Ezeh wrote: > > Elsewhere, the idea of supporting new syntax to automatically initialise > > attributes provided as arguments to __init__ methods was raised. > > [...] > > Good post! You'll want to send this to python-ideas at some p

Fwd: Proposal: Syntax for attribute initialisation in __init__ methods

2022-04-16 Thread Sam Ezeh
> Perhaps I'm missing the point, but what functionality or advantage(s) > does this give, over data-classes? One advantage is maintaining control over the __init__ function without having to write extra code to do so. In the linked discussion from python-ideas, it was mentioned that keyword-only a

Re: Proposal: Syntax for attribute initialisation in __init__ methods

2022-04-15 Thread Ethan Furman
On 4/15/22 04:19, Sam Ezeh wrote: Elsewhere, the idea of supporting new syntax to automatically initialise attributes provided as arguments to __init__ methods was raised. [...] Good post! You'll want to send this to python-ideas at some point (that's where most new python fe

Re: Proposal: Syntax for attribute initialisation in __init__ methods

2022-04-15 Thread dn
On 15/04/2022 23.19, Sam Ezeh wrote: ... Kudos for doing the research! > Some related implementations are attrs, dataclasses and the use of a > decorator. And there's potentially a point to be raised that the results > from the first query indicate that the @dataclasse decorator is not being > u

Proposal: Syntax for attribute initialisation in __init__ methods

2022-04-15 Thread Sam Ezeh
Elsewhere, the idea of supporting new syntax to automatically initialise attributes provided as arguments to __init__ methods was raised. Very often, __init__ functions will take arguments only to assign them as attributes of self. This proposal would remove the need to additionally write

Re: keep getting a syntax error on the very first program I am running

2022-01-14 Thread Jon Ribbens via Python-list
On 2022-01-15, Bob Griffin wrote: >I am running this program and keep getting this error. Is this normal? > > Invalid syntax. Perhaps you forgot a comma? > >Also the t in tags is highlighted. > >I even tried different versions of Python also. > >

Re: keep getting a syntax error on the very first program I am running

2022-01-14 Thread MRAB
On 2022-01-15 01:12, Bob Griffin wrote: I am running this program and keep getting this error. Is this normal? Invalid syntax. Perhaps you forgot a comma? Also the t in tags is highlighted. I even tried different versions of Python also. Python 3.10.1 (tags

keep getting a syntax error on the very first program I am running

2022-01-14 Thread Bob Griffin
I am running this program and keep getting this error. Is this normal? Invalid syntax. Perhaps you forgot a comma? Also the t in tags is highlighted. I even tried different versions of Python also. Python 3.10.1 (tags/v3.10.1:2cd268a, Dec 6 2021, 19:10:37) [MSC v.1929

Re: Syntax not understood

2021-11-04 Thread Chris Angelico
On Fri, Nov 5, 2021 at 6:45 AM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > But since it says "box", I would start by assuming that it has four > > elements. (They might be x1,y1,x2,y2 or x,y,w,h but it'll almost > > always be four.) So it's not TOO fragile, when working with boxes, but > > it i

Re: Syntax not understood

2021-11-04 Thread 2QdxY4RzWzUUiLuE
d recommend against using it. > > > > How is that any more fragile than any other operation that destructs (or > > doesn't) a tuple? > > > > The only part that's fragile, in my opinion, is (from the initial > post) that it's using removal syntax to sl

Re: Syntax not understood

2021-11-04 Thread Chris Angelico
3, 4, 5] > > a, b = (elem * 10 for elem in l[:4]) > > print(a, b) # prints 40 50 > > > > This is very fragile code and I would recommend against using it. > > How is that any more fragile than any other operation that destructs (or > doesn't) a tuple? &

Re: Syntax not understood

2021-11-04 Thread 2QdxY4RzWzUUiLuE
On 2021-11-04 at 14:36:48 -0400, David Lowry-Duda wrote: > > x_increment, y_increment = (scale * i for i in srcpages.xobj_box[2:]) > > > > (scale * i for i in srcpages.xobj_box[2:]) is a generator, a single > > object, it should not be possible to unpack it into 2 variables. > > If you know the

Re: Syntax not understood

2021-11-04 Thread David Lowry-Duda
> x_increment, y_increment = (scale * i for i in srcpages.xobj_box[2:]) > > (scale * i for i in srcpages.xobj_box[2:]) is a generator, a single > object, it should not be possible to unpack it into 2 variables. If you know the exact number of values in the generator, you can do this. Here is an

Re: Syntax not understood

2021-11-04 Thread ast
Le 04/11/2021 à 16:41, Stefan Ram a écrit : ast writes: (scale * i for i in srcpages.xobj_box[2:]) is a generator, a single object, it should not be possible to unpack it into 2 variables. But the value of the right-hand side /always/ is a single object! A syntax of an assignment

  1   2   3   4   5   6   7   8   9   10   >