On Mon, 19 Dec 2022 at 19:38, wrote:
>
> Dear Chris,
> thanks for asking back and my apologize for being to broad in my way of
> asking (in a foreign language).
>
> Am 19.12.2022 07:40 schrieb Chris Angelico:
> > Hmm, then I'm not sure what you're *losing* here
On Mon, 19 Dec 2022 at 17:30, wrote:
>
> Am 18.12.2022 22:37 schrieb Mats Wichmann:
> > the which command uses your PATH, so I'm not sure you're buying
> > anything new there
>
> I'm using which before entering pkexec. ;)
>
> I'll show a demonstrator project later.
Hmm, then I'm not sure what
On Mon, 19 Dec 2022 at 07:57, Stefan Ram wrote:
> G = Decimal( 6.6743015E-11 )
> r = Decimal( 6.371E6 )
> M = Decimal( 5.9722E24 )
What's the point of using Decimal if you start with nothing more than
float accuracy?
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
On Mon, 19 Dec 2022 at 04:56, wrote:
>
> Hello,
>
> when I install a package on a GNU/Linux system via "sudo python3 -m pip
> install -e ." that defines entry points in its pyproject.toml the entry
> point starter scripts are located in /usr/locale/bin.
>
> That folder is in PATH for "regular" roo
On Mon, 19 Dec 2022 at 06:10, Mats Wichmann wrote:
> Why? Python is a command-line tool to process a language, Similar to
> many other languages - Go, for example. Or a C/C++ compiler. *Or* you
> can choose to use someone's wrapping of that process inside an
> Integrated Development Environment.
On Sun, 18 Dec 2022 at 10:59, wrote:
>
> If a compiler or interpreter HAPPILY (as happy as machines/code get) compiles
> or interprets your code without errors every time you use it a certain way,
> then it is not wrong to use it. Of course if it subject to change or already
> deprecated, ...
>
On Sun, 18 Dec 2022 at 09:46, Stefan Ram wrote:
>
> Grant Edwards writes:
> >Yes, fixed point (or decimal) is a better fit for what he's doing. but
> >I suspect that floating point would be a better fit for the problem
> >he's trying to solve.
>
> I'd like to predict that within the next ten po
On Sun, 18 Dec 2022 at 08:22, Grant Edwards wrote:
>
> On 2022-12-17, Chris Angelico wrote:
>
> >> It was the rounding rounding error that I needed to avoid (as Peter
> >> J. Holzer suggested). The use of decimal solved it and just in
> >> time. I was about
On Sun, 18 Dec 2022 at 07:46, Paul St George wrote:
>
> Thanks to all!
> It was the rounding rounding error that I needed to avoid (as Peter J. Holzer
> suggested). The use of decimal solved it and just in time. I was about to
> truncate the number, get each of the characters from the string man
On Thu, 15 Dec 2022 at 16:29, Thomas Passin wrote:
>
> PEP-8, which is Guido's style guide and generally good to follow, does
> not completely discourage single-line usage like the example. It's not
> clear to me how Chris's example fits into the guidelines.
>
> PEP-8:
> "While sometimes it’s oka
On Thu, 15 Dec 2022 at 14:41, Aaron P wrote:
>
> I occasionally run across something like:
>
> for idx, thing in enumerate(things):
> if idx == 103:
> continue
> do_something_with(thing)
>
> It seems more succinct and cleaner to use:
>
> if idx == 103: continue.
>
> Of course this
On Wed, 14 Dec 2022 at 08:19, Roel Schroeven wrote:
>
> Chris Angelico schreef op 13/12/2022 om 20:01:
> > On Wed, 14 Dec 2022 at 06:00, Roel Schroeven wrote:
> > >
> > > Stefan Ram schreef op 13/12/2022 om 8:42:
> > > > "John K. Parejko" wr
On Wed, 14 Dec 2022 at 06:00, Roel Schroeven wrote:
>
> Stefan Ram schreef op 13/12/2022 om 8:42:
> > "John K. Parejko" writes:
> > >I was just burned by this, where some tests I’d written
> > >against an sqlite database did not fail in the way that they
> > >“should” have, because of this double
On Wed, 14 Dec 2022 at 05:01, Mats Wichmann wrote:
>
> On 12/13/22 10:36, Chris Angelico wrote:
> > On Wed, 14 Dec 2022 at 03:35, Michael F. Stemper
> > wrote:
> >>
> >> It's easy enough -- in fact necessary -- to handle the bottom
> >> level
On Wed, 14 Dec 2022 at 03:35, Michael F. Stemper
wrote:
>
> It's easy enough -- in fact necessary -- to handle the bottom
> level of a function differently than the levels above it. What
> about the case where you want to handle something differently
> in the top level than in lower levels? Is the
On Wed, 14 Dec 2022 at 00:30, Thomas Passin wrote:
>
> On 12/13/2022 4:09 AM, Chris Angelico wrote:
> > On Tue, 13 Dec 2022 at 19:52, Roel Schroeven wrote:
> >> Like Lars Liedtke this is not an exact answer to your question, but you
> >> can side-step the issue by u
On Tue, 13 Dec 2022 at 19:52, Roel Schroeven wrote:
> Like Lars Liedtke this is not an exact answer to your question, but you
> can side-step the issue by using parametrized queries, i.e. instead of
>
> cur.execute('SELECT name, location FROM persons WHERE name = "John
> Doe"')
>
> do
>
>
On Mon, 12 Dec 2022 at 09:24, Barry Scott wrote:
> You would need to have a loop that collected all the utf-8 bytes of a single
> code point.
> You can to look at the first byte of know if the utf-8 is 1, 2, 3 or 4 bytes
> for a code point.
And cope with escape sequences too - if you press an a
On Wed, 7 Dec 2022 at 02:51, ^Bart wrote:
>
> Hi Guys,
>
> usually I use this code on my Debian Bullseye:
>
> # python3 -m pyftpdlib -i 192.168.0.71 -p 21 -d /home/my_user/ftp
>
> It works, it's simply easy and perfect but... a device in my lan needs a
> ftp folder without username and password!
>
On Tue, 29 Nov 2022 at 12:37, Loris Bennett wrote:
>
> Mats Wichmann writes:
>
> > On 11/27/22 16:40, Skip Montanaro wrote:
> >> I have a script to which I'd like to add a --version flag. It should print
> >> the version number then exit, much in the same way --help prints the help
> >> text then
On Thu, 24 Nov 2022 at 06:26, Stefan Ram wrote:
>
> Jon Ribbens writes:
> >If you want to catch this sort of mistake automatically then you need
> >a linter such as pylint:
>
> output
>
> , line 1
> list.clear
> Warning: Attribute used as statement.
>
> , line 5
> list.clear
> Warning: Attribut
On Mon, 21 Nov 2022 at 16:26, dn wrote:
> Am put-off by the 'smell' of subverting/adapting names like print() =
> surprise/confusion factor - but I think I understand where you're going.
To be fair, redefining the "print" function IS one of the reasons that
it's no longer a statement. Though I wo
On Mon, 21 Nov 2022 at 09:37, Dan Kolis wrote:
>
> Using sys.stdout / is simply nonsense. The more I think about it, the more I
> realise how bad it is.
>
> Going on about it endlessly seems pointless.
>
> If the even mini threading thing is turned on, now what ? some other module
> eats the mes
On Sun, 20 Nov 2022 at 12:27, Cameron Simpson wrote:
>
> On 19Nov2022 18:26, Thomas Passin wrote:
> >>The alternative is to just replace every calling function which uses
> >>my_ugly_debug() to directly call a logging.whatever() call.
> >
> >Maybe a place for a decorator...
>
> Indeed, though I d
On Wed, 16 Nov 2022 at 10:11, wrote:
>
> That is clear, Cameron, but on my python interpreter values evaluated on the
> command line ARE saved:
>
> >>> numb = 5
> >>> 5 + numb
> 10
> >>> numb
> 5
> >>> _ + _ + 1
> 11
That's a REPL feature.
ChrisA
--
https://mail.python.org/mailman/listinfo/pyth
On Tue, 15 Nov 2022 at 09:38, Barry wrote:
>
>
>
> > On 14 Nov 2022, at 22:06, Thomas Passin wrote:
> >
> > For parameter passing like your #2, I have packaged them into a dictionary
> > and passed that around. It was easy enough, and worked well.
> >
> I used to use a dict but having been bur
On Tue, 15 Nov 2022 at 05:57, Stefan Ram wrote:
>
> Michael Speer writes:
> >Python doesn't care what an expression returns.
>
> In my English, functions return values,
> expression are being evaluated to a value.
> The evaluation of a function yields or
> produces a value. Expressions do
On Mon, 14 Nov 2022 at 18:00, Greg Ewing wrote:
>
> On 14/11/22 3:13 pm, MRAB wrote:
> > But if it's an expression where it's expecting a statement and it's not
> > a call, then it's probably a bug.
>
> The key word there is "probably". If there's any chance it
> could be not a bug, it can't be an
On Mon, 14 Nov 2022 at 13:18, MRAB wrote:
>
> On 2022-11-14 00:55, Greg Ewing wrote:
> > On 14/11/22 1:31 pm, Jon Ribbens wrote:
> >> On 2022-11-13, DFS wrote:
> >>> But why is it allowed in the first place?
> >>
> >> Because it's an expression, and you're allowed to execute expressions.
> >
> >
On Mon, 14 Nov 2022 at 11:53, DFS wrote:
>
> On 11/13/2022 5:20 PM, Jon Ribbens wrote:
> > On 2022-11-13, DFS wrote:
> >> In code, list.clear is just ignored.
> >> At the terminal, list.clear shows
> >>
> >>
> >>
> >> in code:
> >> x = [1,2,3]
> >> x.clear
> >> print(len(x))
> >> 3
> >>
> >> at
On Sun, 13 Nov 2022 at 05:48, Stefan Ram wrote:
> So much for the topic of "In Python, /everything/ is an
> object"! There seem to be first and second-class objects:
> Shelveable and non-shelveable objects.
>
That's a bit unfair. Everything IS an object, but not all objects can
be treated t
On Sat, 12 Nov 2022 at 06:42, Stefan Ram wrote:
>
> "Weatherby,Gerard" writes:
> >I'd personally find it weird to see an all-cap parameter
>
> In the source code of the standard library, all-caps
> notation is used for a parameter name sometimes
> if that parameter name is "URL" or sometime
On Tue, 8 Nov 2022 at 15:12, DFS wrote:
>
> 3.9.13
>
My guess? Because you can "import tkinter" in Py3 but "import Tkinter" in Py2.
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
On Tue, 8 Nov 2022 at 08:44, Chris Green wrote:
>
> Barry Scott wrote:
> >
> >
> > > On 7 Nov 2022, at 09:28, Chris Green wrote:
> > >
> > > Chris Green wrote:
> > >>> 3: with your pseudo "python3" script in place, make all the scripts use
> > >>> the "#!/usr/bin/env python3" shebang suggested
On Tue, 8 Nov 2022 at 06:12, Thomas Passin wrote:
>
> The problem is that some Linux systems - I think - still use Python2 to
> perform various system-related tasks. When they call "python", they
> need it to be Python2. If someone has a system like that, they can't
> have the "python" command r
On Thu, 3 Nov 2022 at 10:17, elas tica wrote:
>
> Le lundi 31 octobre 2022 à 22:18:57 UTC+1, Chris Angelico a ecrit :
> > Wording is hard. Just ask the SQL standard whether NULL is a value.
> >
>
> Indeed, but I think our problem here is simpler ;)
>
> One could
On Sat, 5 Nov 2022 at 02:18, Greg Ewing wrote:
>
> On 4/11/22 12:50 am, Chris Angelico wrote:
> > In Python, everything is an object. Doesn't that equally mean that
> > Python is purely OOP?
>
> Depends on what you mean by "purely oop". To me it sug
On Sat, 5 Nov 2022 at 02:21, Greg Ewing wrote:
>
> > r...@zedat.fu-berlin.de (Stefan Ram) writes [that Barbara Liskov said]:
> >
> >> |If for each object o1 of type S there is an object o2 of
> >> |type T such that for all programs P defined in terms of T,
> >> |the behavior of P is unchanged when
On Fri, 4 Nov 2022 at 05:48, Paulo da Silva
wrote:
>
> Às 05:32 de 03/11/22, Paulo da Silva escreveu:
> > Às 03:24 de 03/11/22, Paulo da Silva escreveu:
> >> Hi!
> >>
> >> And a typing problem again!!!
> >> ___
> >> class C:
> >> def __init__(self):
> >>
On Fri, 4 Nov 2022 at 05:21, Julieta Shem wrote:
>
> Chris Angelico writes:
>
> > On Thu, 3 Nov 2022 at 21:44, Alan Gauld wrote:
> >> Also Python is not a purely OOP language, in that you can write
> >> functional and procedural code in Python if you wish. I
On Fri, 4 Nov 2022 at 05:03, Paulo da Silva
wrote:
> Changing def foos(self) -> list[int]: to
> def foos(self) -> Union[list[int]]:
> fixes the problem.
> Not so elegant, however!
Wait, what?!
Union[X, Y] means "X or Y"
Union[X] means "X, but don't complain if it's a @property".
Is that how
On Thu, 3 Nov 2022 at 21:44, Alan Gauld wrote:
> Also Python is not a purely OOP language, in that you can write
> functional and procedural code in Python if you wish. In
> Smalltalk thats notionally impossible because everything
> is an object. And all programming statements are messages
> to ob
On Tue, 1 Nov 2022 at 08:15, elas tica wrote:
>
> Le mercredi 26 octobre 2022 à 22:12:59 UTC+2, Weatherby,Gerard a ecrit :
> > No. If the docs say in one place a comma is not an operator, they shouldn’t
> > call it an operator in another place.
> >
> > I’ve submitted a pull request https://github
On Mon, 31 Oct 2022 at 14:38, Julieta Shem wrote:
>
> Chris Angelico writes:
>
> > The most straight-forward way to represent this concept in an
> > object-oriented way is subclassing.
> >
> > class Stack:
> > ... # put whatever code i
On Mon, 31 Oct 2022 at 09:39, dn wrote:
>
> On 31/10/2022 06.06, Stefan Ram wrote:
> > Paulo da Silva writes:
> >> Is there anything to do without loosing my script structure and usual
> >> practice?
> >
> >to lose (losing): to stop having something
> >to loose (loosing): to let or make l
On Mon, 31 Oct 2022 at 09:05, Julieta Shem wrote:
>
> Julieta Shem writes:
>
> [...]
>
> >> . If you should, however, be talking about the new "type hints":
> >> These are static and have "Union", for example, "Union[int, str]"
> >> or "int | str".
> >
> > I ended up locating such features
On Wed, 26 Oct 2022 at 05:09, Barry Scott wrote:
>
>
>
> > On 25 Oct 2022, at 11:16, Stefan Ram wrote:
> >
> > r...@zedat.fu-berlin.de (Stefan Ram) writes:
> >> You can let Python guess the encoding of a file.
> >> def encoding_of( name ):
> >> path = pathlib.Path( name )
> >> for encoding in( "u
On Wed, 26 Oct 2022 at 04:59, Tim Delaney wrote:
>
> On Mon, 24 Oct 2022 at 19:03, Chris Angelico wrote:
>>
>>
>> Ah, cool. Thanks. I'm not entirely sure of the various advantages and
>> disadvantages of the different parsers; is there a tabulation
On Tue, 25 Oct 2022 at 09:34, Peter J. Holzer wrote:
> > One thing I find quite interesting, though, is the way that browsers
> > *differ* in the face of bad nesting of tags. Recently I was struggling
> > to figure out a problem with an HTML form, and eventually found that
> > there was a spurious
On Tue, 25 Oct 2022 at 04:22, Peter J. Holzer wrote:
> There may be several reasons:
>
> * Historically, some browsers differed in which end tags were actually
> optional. Since (AFAIK) no mainstream browser ever implemented a real
> SGML parser (they were always "tag soup" parsers with lots o
On Tue, 25 Oct 2022 at 02:45, Jon Ribbens via Python-list
wrote:
>
> On 2022-10-24, Chris Angelico wrote:
> > On Mon, 24 Oct 2022 at 23:22, Peter J. Holzer wrote:
> >> Yes, I got that. What I wanted to say was that this is indeed a bug in
> >> html.parser and not a
On Mon, 24 Oct 2022 at 23:22, Peter J. Holzer wrote:
>
> On 2022-10-24 21:56:13 +1100, Chris Angelico wrote:
> > On Mon, 24 Oct 2022 at 21:33, Peter J. Holzer wrote:
> > > Ron has already noted that the lxml and html5 parser do the right thing,
> > > so just for th
On Mon, 24 Oct 2022 at 21:33, Peter J. Holzer wrote:
> Ron has already noted that the lxml and html5 parser do the right thing,
> so just for the record:
>
> The HTML fragment above is well-formed and contains a number of li
> elements at the same level directly below the ol element, not lots of
>
On Mon, 24 Oct 2022 at 18:43, Roel Schroeven wrote:
>
> Op 24/10/2022 om 4:29 schreef Chris Angelico:
> > Parsing ancient HTML files is something Beautiful Soup is normally
> > great at. But I've run into a small problem, caused by this sort of
> > sloppy
On Mon, 24 Oct 2022 at 14:15, Dan Stromberg wrote:
> I've found that mypy understands simple assert statements.
>
> So if you:
> if f is not None:
> assert f is not None
> os.write(f, ...)
>
> You might be in good shape.
Why can't it simply understand the if statement? I'm not a f
Parsing ancient HTML files is something Beautiful Soup is normally
great at. But I've run into a small problem, caused by this sort of
sloppy HTML:
from bs4 import BeautifulSoup
# See: https://gsarchive.net/gilbert/plays/princess/tennyson/tenniv.htm
blob = b"""
'THERE sinks the nebulous star we c
On Fri, 21 Oct 2022 at 08:50, Thomas Passin wrote:
>
> "Portable executable" usually means that the program resides on
> removable media, like a USB stick. You can go to a computer, plug the
> stick in, and run the program. If it's Python, then the installation on
> the removable medium needs to
On Wed, 19 Oct 2022 at 12:01, Peter J. Holzer wrote:
>
> On 2022-10-17 09:25:00 +0200, Karsten Hilbert wrote:
> > > which had special combinations for all the BASIC keywords). And if you
> > > go this way, why not go a step further and dissociate the program from
> > > its linear text representati
On Tue, 18 Oct 2022 at 03:51, Stefan Ram wrote:
>
> MRAB writes:
> >It can't optimise that because, say, 'print' could've been bound to a
> >function that rebinds 'str'.
>
> It would be possible to find out whether a call of a function
> named "print" is to the standard function, but the over
On Tue, 18 Oct 2022 at 01:39, Abderrahim Adrabi
wrote:
> So, these default values behave like class attributes, here is a demo:
>
> # Using a list -
> class GameOne:
> def __init__(self, games = []) -> None:
> self.games = games
>
This makes the default be a sing
On Mon, 17 Oct 2022 at 16:36, Antoon Pardon wrote:
>
>
>
> Op 17/10/2022 om 04:01 schreef Chris Angelico:
> > On Mon, 17 Oct 2022 at 10:46, wrote:
> >> My point Chris was that you can have a conversation where you are exploring
> >> and not proposing. Brainst
On Mon, 17 Oct 2022 at 10:46, wrote:
>
> My point Chris was that you can have a conversation where you are exploring
> and not proposing. Brainstorming, perhaps.
And my point is that either a proposal is a serious one that can
expect serious discussion, or it isn't. Yes, I'm aware that it wasn't
On Mon, 17 Oct 2022 at 08:22, wrote:
> I had another crazy thought that I AM NOT ASKING anyone to do. OK?
>
Here's another proposal: Let's ban you from this mailing list. Don't
worry, I AM NOT ASKING anyone to do it. OK?
Do you see how ridiculous and pointless it is to have proposals with
that k
On Mon, 17 Oct 2022 at 03:57, Antoon Pardon wrote:
>
>
> Op 16/10/2022 om 17:05 schreef Chris Angelico:
> > On Sun, 16 Oct 2022 at 22:47, Antoon Pardon wrote:
> >> Why would I need good luck? I expressed an idea and you didn't like it.
> >> That won't a
On Sun, 16 Oct 2022 at 22:47, Antoon Pardon wrote:
>
>
>
> Op 16/10/2022 om 13:03 schreef Chris Angelico:
> > On Sun, 16 Oct 2022 at 21:19, Antoon Pardon wrote:
> >
> >> My idea would be to reserve different unicode blocks for the keywords
> >> and
On Sun, 16 Oct 2022 at 21:19, Antoon Pardon wrote:
>
> Op 16/10/2022 om 00:50 schreef avi.e.gr...@gmail.com:
> > This has been discussed so often precisely because I swear NO CHOICE of
> > keyword would satisfy everybody! Most languages start with designated
> > keywords and some reserve a few f
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 tried leaving-out a
> keyword,
On Thu, 13 Oct 2022 at 11:19, Peter J. Holzer wrote:
>
> On 2022-10-11 09:47:52 +1100, Chris Angelico wrote:
> > On Tue, 11 Oct 2022 at 09:18, Cameron Simpson wrote:
> > >
> > Consider:
> >
> > if condition # no colon
> > code
> > else:
>
On Wed, 12 Oct 2022 at 05:23, Thomas Passin wrote:
>
> On 10/11/2022 3:10 AM, avi.e.gr...@gmail.com wrote:
> > I see resemblances to something like how a web page is loaded and operated.
> > I mean very different but at some level not so much.
> >
> > I mean a typical web page is read in as HTML w
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
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 errors that logically fall into different
> categories or phases of evaluation of a program and some can be determined
> by a more static analysis almost on a line b
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
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 whatever reason? Can you continue when all
On Tue, 11 Oct 2022 at 09:18, Cameron Simpson wrote:
>
> On 11Oct2022 08:02, Chris Angelico wrote:
> >There's a huge difference between non-fatal errors and syntactic
> >errors. The OP wants the parser to magically skip over a fundamental
> >syntactic error an
On Tue, 11 Oct 2022 at 08:55, Robert Latest via Python-list
wrote:
>
> Chris Angelico wrote:
> > Yes, I'm aware that code readability becomes irrelevant for
> > short-duration projects. Beside the point. I'm wondering how important
> > it really is to have the s
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
On Mon, 10 Oct 2022 at 22:37, Axy via Python-list
wrote:
>
>
> On 10/10/2022 12:24, Chris Angelico wrote:
> > On Mon, 10 Oct 2022 at 21:57, Axy via Python-list
> > wrote:
> >>
> >>> Not sure what you mean, but a for-else without a break is quite
> &
On Mon, 10 Oct 2022 at 21:57, Axy via Python-list
wrote:
>
>
> > Not sure what you mean, but a for-else without a break is quite
> > useless. What exactly ARE you arguing here?
> >
> > The else is associated with the break to the exact extent that one is
> > essential to the other's value.
>
> I'm
On Mon, 10 Oct 2022 at 20:56, Axy via Python-list
wrote:
>
> > The else is always coming with the break, not the for.
> However, the compiler does not complain.
> > There are [for ...], [for...break...], and[for...break...else],
>
> That's implied and contradicts Zen of Python, I think. If "else
On Mon, 10 Oct 2022 at 20:46, Karsten Hilbert wrote:
>
> Am Sun, Oct 09, 2022 at 09:58:14AM + schrieb Stefan Ram:
>
> > I often follow this rule. For me, it's about readability. Compare:
> >
> > if not open( disk ):
> > error( "Can't open disk" )
> > else:
> > printf( "now imagine th
On Mon, 10 Oct 2022 at 14:59, wrote:
>
> >>>Which is more disparaging: "I couldn't find anyone suggesting this" or
> "The only place I could find it was a PHP style guide"?
> >>>ChrisA
>
> Chris,
>
> If someone says they heard something from their own personal guru, people
> often do not feel thre
On Mon, 10 Oct 2022 at 11:52, MRAB wrote:
>
> On 2022-10-10 00:40, dn wrote:
> > On Sun, 9 Oct 2022 at 15:39, Axy via Python-list
> > wrote:
> >
> >> "shortest block first"
> >
> > Have never heard this advice before. Kind-of rankled with me, as it did
> > for others.
> >
> > Enquiring minds want
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 going after
finding a non-syntacti
On Mon, 10 Oct 2022 at 03:46, Avi Gross wrote:
>
> Chris, I was not arguing that at all.
Maybe not intentionally, but you did lend a lot of weight to that argument :)
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
On Mon, 10 Oct 2022 at 03:22, Avi Gross wrote:
>
> Smallest code blocks first may be a more modern invention.
>
> Some would argue for a rule related to efficiency of execution. When you
> have multiple blocks as in an if-else or case statement with multiple
> choices, that you order the most comm
On Sun, 9 Oct 2022 at 16:05, Axy via Python-list wrote:
>
>
> On 09/10/2022 05:47, Chris Angelico wrote:
> > On Sun, 9 Oct 2022 at 15:39, Axy via Python-list
> > wrote:
> >> Got it, thanks!
> >>
> >> Actually the reason I never used "else&qu
On Sun, 9 Oct 2022 at 15:39, Axy via Python-list wrote:
>
> Got it, thanks!
>
> Actually the reason I never used "else" was the violation of the rule of
> beauty "shortest block first". With if--else you can easily follow this
> rule by inverting "if" expression, but with for--else you can't. The
On Sat, 8 Oct 2022 at 08:24, wrote:
>
> Hello,
>
> I need to improve my understanding about how subprocess.Popen() does
> quote arguments. I have special case here.
>
> Simple example:
> Popen(['ls', '-l']) results on a shell in "ls -l" without quotation.
>
> Quotes are added if they are needed:
>
On Thu, 29 Sept 2022 at 05:36, Robert Latest via Python-list
wrote:
> in a (Flask) web application I often find that many equal (SQLAlchemy) queries
> are executed across subsequent requests. So I tried to cache the results of
> those queries on the module level like this:
>
> @lru_cache()
>
On Sat, 24 Sept 2022 at 07:52, Meredith Montgomery
wrote:
>
> def Counter(name = None):
> o = {"name": name if name else "untitled", "n": 0}
> def inc(o):
> o["n"] += 1
> return o
> o["inc"] = inc
> def get(o):
> return o["n"]
> o["get"] = get
> return o
>
Want a neat demo
On Thu, 22 Sept 2022 at 23:46, Richard Moseley
wrote:
>
> According to documentation syslog.setlogmask returns the current mask so
> save the value to reset later on.
>
> Oldval = syslog.setlogmask(newmask)
>
> This sets oldval to original mask.
This on its own suggests an odd technique that shou
On Sun, 18 Sept 2022 at 10:29, wrote:
>
>
> From your description, Chris, it sounds like the functional programming
> technique often called currying. A factory function is created where one (or
> more) parameters are sort of frozen in so the user never sees or cares about
> them, and a modified o
On Sun, 18 Sept 2022 at 09:37, Eryk Sun wrote:
>
> On 9/17/22, Chris Angelico wrote:
> >
> > The two are basically equivalent. Using functools.partial emphasizes
> > the fact that all you're doing is "locking in" the first parameter;
> > usin
On Sun, 18 Sept 2022 at 07:20, Ralf M. wrote:
>
> Am 16.09.2022 um 23:34 schrieb Eryk Sun:
> > On 9/16/22, Ralf M. wrote:
> >> I would like to replace a method of an instance, but don't know how to
> >> do it properly.
> >
> > A function is a descriptor that binds to any object as a method. For
On Sat, 17 Sept 2022 at 07:07, Ralf M. wrote:
>
> I would like to replace a method of an instance, but don't know how to
> do it properly.
>
> My first naive idea was
>
> inst = SomeClass()
> def new_method(self, param):
> # do something
> return whatever
> inst.method = new_method
>
> h
On Sat, 10 Sept 2022 at 06:45, Dennis Lee Bieber wrote:
>
> On Thu, 8 Sep 2022 07:42:19 +1200, dn
> declaimed the following:
>
> >TSRs? Now that was an ugly period of history! (trying to make a
> >single-process operating system do multi-processing - only to find that
> >many program[me]s assumed
On Sat, 10 Sept 2022 at 06:38, Greg Ewing wrote:
>
> On 8/09/22 6:57 am, Chris Angelico wrote:
> > Not as detrimental as starting with BASIC, and then moving on to x86
> > assembly language, and trying to massage the two together using CALL
> > ABSOLUTE in order to ge
On Thu, 8 Sept 2022 at 05:09, Grant Edwards wrote:
>
> On 2022-09-07, Chris Angelico wrote:
> > On Thu, 8 Sept 2022 at 04:54, Grant Edwards
> > wrote:
> >
> >> If you're a beginning programmer, then IMO learning C first is
> >> probably detrimenta
On Thu, 8 Sept 2022 at 04:54, Grant Edwards wrote:
>
> On 2022-09-07, Chris Angelico wrote:
> > On Thu, 8 Sept 2022 at 01:50, Maruful Islam wrote:
> >>
> >> I want to start learning python. I have a question about learning python.
> >>
> >> Is
On Thu, 8 Sept 2022 at 01:50, Maruful Islam wrote:
>
> I want to start learning python. I have a question about learning python.
>
> Is learning C essential or not for learning python?
Absolutely not essential. In fact, I would strongly recommend learning
Python before ever picking up C, as it's
301 - 400 of 4027 matches
Mail list logo