Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Greg Ewing via Python-list
p a local server You should also be able to download a .tar.gz from PyPI and use pip to install that. Although you'll have to track down the dependencies yourself in that case. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Use of statement 'global' in scripts.

2024-05-08 Thread Greg Ewing via Python-list
. spam = 17 def f(): global spam spam = 42 f() # spam is now 42 A script is a module, so everything that applies to modules also applies to scripts. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: xkcd.com/353 ( Flying with Python )

2024-03-30 Thread Greg Ewing via Python-list
On 30/03/24 7:21 pm, HenHanna wrote: https://xkcd.com/1306/ what does  SIGIL   mean? I think its' a Perl term, referring to the $/@/# symbols in front of identifiers. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)

2024-03-20 Thread Greg Ewing via Python-list
works. If you run out of memory, you run a GC there and then. You don't have to wait for GCs to occur on a time schedule. Also, as a previous poster pointed out, GCs are typically scheduled by number of allocations, not by time. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code Sought

2024-02-27 Thread Greg Ewing via Python-list
) for j, b in enumerate(answer) ) ) This is not correct. score((1,1,1), (1,1,2)) gives (2,4). According to the usual rules of Mastermind, it should be (2, 0). -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Await expressions (Posting On Python-List Prohibited)

2024-01-26 Thread Greg Ewing via Python-list
it helps at all, you can think of an async function as being very similar to a generator, and "await" as being very similar to "yield from". In the current implementation they're almost exactly the same thing underneath. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Question about garbage collection

2024-01-16 Thread Greg Ewing via Python-list
weak references help here at all. If the transient object goes away, all references from it to the permanent objects also go away. A weak reference would only be of use if the reference went the other way, i.e. from the permanent object to the transient object. -- Greg -- https://mail.python.org

Re: Question about garbage collection

2024-01-16 Thread Greg Ewing via Python-list
keep the Form alive after it's been closed. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2024-01-15 Thread Greg Ewing via Python-list
On 16/01/24 11:55 am, Mats Wichmann wrote: Windows natively has something called python.exe and python3.exe which is interfering here I'm wondering whether py.exe should be taught to recognise these stubs and ignore them. This sounds like something that could trip a lot of people up. -- Greg

Re: Extract lines from file, add to new files

2024-01-15 Thread Greg Ewing via Python-list
regular expressions. Although some might consider that this doesn't contradict your statement about readability. :-) -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Extract lines from file, add to new files

2024-01-15 Thread Greg Ewing via Python-list
, etc. enjoyed a lot of popularity. A variant of UCSD was the main language for Macintosh application development for a number of years. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Extract lines from file, add to new files

2024-01-14 Thread Greg Ewing via Python-list
it appears in the grammar by means of INDENT and DEDENT lexical tokens. It's true that the meaning of these tokens is described informally elsewhere, but that's true of all the lexical features. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Extract lines from file, add to new files

2024-01-14 Thread Greg Ewing via Python-list
to be declared separately from their use. But this is a very common feature of dynamic languages generally. As language oddities go, it hardly rates a mention. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Extract lines from file, add to new files

2024-01-13 Thread Greg Ewing via Python-list
x[i]++) printf("%d\n", x[i]); } Output: 0 1 2 3 4 5 6 7 8 9 -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Extract lines from file, add to new files

2024-01-13 Thread Greg Ewing via Python-list
g" in Python. I don't know anything about Hyperspec, so I don't know what it means there. The fact that i was being printed inside the loop made me think that some deeper level of surprise was being intended, such as the value of i somehow getting changed by the assignment. -- Greg -- htt

Re: Extract lines from file, add to new files

2024-01-12 Thread Greg Ewing via Python-list
File "", line 1, in NameError: name 'i' is not defined There's no destructuring going on here, just assignment to a sequence item. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: mypy question

2023-12-30 Thread Greg Ewing via Python-list
too. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Aw: Re: mypy question

2023-12-30 Thread Greg Ewing via Python-list
at's the problem, but the fact that there's a *mutable container* containing that type. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: mypy question

2023-12-29 Thread Greg Ewing via Python-list
has no way to be sure of that. You could try declaring it as a collections.Mapping, which is immutable. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

RE: Subject: Are there any easy-to-use Visual Studio C# WinForms-like GUI designers in the Python world for Tk?

2023-12-29 Thread Greg Walters via Python-list
ull documentation and a number of tutorials. The Sourceforge acts as the main help site, but there is also a Discord site dedicated to help and support. I sincerely hope this helps! Greg Walters -- *My memory check bounced* Greg Walters -- https://mail.python.org/mailman/listinfo/python-list

Re: How/where to store calibration values - written by program A, read by program B

2023-12-28 Thread Greg Walters via Python-list
modules. You aren't limited to just two. I hope this helps. Greg -- *My memory check bounced* Greg Walters -- https://mail.python.org/mailman/listinfo/python-list

How/where to store calibration values - written by program A, read by program B

2023-12-27 Thread Greg Walters via Python-list
ed by both scripts. The biggest caveat is that the shared variable MUST exist before it can be examined or used (not surprising). I sincerely hope this helps. Greg -- *My memory check bounced* Greg Walters -- https://mail.python.org/mailman/listinfo/python-list

Re: Context without manager

2023-11-26 Thread Greg Ewing via Python-list
f __init__(self): self.cm = device_open() self.device = self.cm.__enter__() # Other methods here for doing things with # self.device def close(self): self.cm.__exit__(None, None, None) -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Context without manager

2023-11-26 Thread Greg Ewing via Python-list
On 27/11/23 9:03 am, Stefan Ram wrote: Above, "have" is followed by another verb in "have been", so it should be eligible for a contraction there! Yes, "been" is the past participle of 'to be", so "I've been" is fine. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: on a tail-recursive square-and-multiply

2023-11-07 Thread Greg Ewing via Python-list
ad. Can you help? Well, there are inherently two cases, and they're different, so I don't think you're doing anything wrong here. It was asymmetrical to begin with. If you were doing it iteratively you would also be leaving the accumulator alone when the exponent is even. -- Greg -- https://mai

Re: fCONV_AUSRICHTG is not defined - Why?

2023-11-07 Thread Greg Ewing via Python-list
, such as this one. There are various ways you could work around this. I would suggest moving the offending code outside the class and qualifying the constants it uses with the class name. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Checking if email is valid

2023-11-06 Thread Greg Ewing via Python-list
tomer tells you." -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Checking if email is valid

2023-11-06 Thread Greg Ewing via Python-list
into the landline field or vice versa and reject it, then it can figure out whether it can text to a given numner or not without you having to tell it! -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Question(s)

2023-10-27 Thread Greg Ewing via Python-list
values into RAM to change its behaviour to some extent, and that got them out of trouble a few times, but they couldn't patch the code. It might have been possible with the Gemini computer, since it loaded its code from tape. I don't know if it was ever done, though. -- Greg -- https

Re: type annotation vs working code

2023-10-04 Thread Greg Ewing via Python-list
, and returns that instance subsequently. The problem then doesn't arise. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Dynamically modifying "__setattr__"

2023-09-29 Thread Greg Ewing via Python-list
) a = A() a.x = 1 print('a.x =', a.x) -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: error of opening Python

2023-09-27 Thread Greg Ewing via Python-list
On 27/09/23 3:30 pm, Chris Roy-Smith wrote: surely running a 64 bit version of python in a 23mbit version of windows will cause significant problems! 23 millibits? I don't think you'd be able to run much at all with that few bits! :-) -- Greg -- https://mail.python.org/mailman/listinfo/python

Re: []=[]

2023-09-22 Thread Greg Ewing via Python-list
On 23/09/23 4:51 am, Stefan Ram wrote: []=[] (Executes with no error.) # []=[] ( 1 ) #\_/# (Executes with no error.) -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Getty fully qualified class name from class object

2023-08-22 Thread Greg Ewing via Python-list
On 23/08/23 2:45 am, Ian Pilcher wrote: How can I programmatically get 'logging.Handler' from the class object? Classes have a __module__ attribute: >>> logging.Handler.__module__ 'logging' -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: GNU gettext: Print string translated and untranslated at the same time

2023-08-18 Thread Greg Ewing via Python-list
of the if. You need to ensure it's always defined. Here's one way that should work: gttran = _ def foobar(translate): def _(txt): if translate: return gttran(txt) else: return txt return _('Hello') -- Greg -- https://mail.python.org/mailman/listinfo

Re: Multiple inheritance and a broken super() chain

2023-07-04 Thread Greg Ewing via Python-list
in your ancestry. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Should NoneType be iterable?

2023-06-20 Thread Greg Ewing via Python-list
rather than blindly trying to iterate over the result. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Should NoneType be iterable?

2023-06-19 Thread Greg Ewing via Python-list
I would question the wisdom of designing an API that can return either a sequence or None. If it normally returns a sequence, and there are no items to return, it should return an empty sequence. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Match statement with literal strings

2023-06-07 Thread Greg Ewing via Python-list
to the value that isn't just a bare name. One way would be to define your constants using an enum: class Options(Enum): RANGE = "RANGE" MANDATORY = "MANDATORY" match stuff: case Options.RANGE: ... case Options.MANDATORY: ... -- Greg -- https://mail.python.

Re: Why does IDLE use a subprocess?

2023-05-30 Thread Greg Ewing via Python-list
not letting you connect to a local socket (nice one, Microsoft). I don't know whether that's still an issue. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: What to use instead of nntplib?

2023-05-30 Thread Greg Ewing via Python-list
would have to do in the face of inactive maintainers regardless of where or how the project was hosted. This is not a github problem or a big-corporation problem, it's a people problem. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Does os.path relpath produce an incorrect relative path?

2023-05-25 Thread Greg Ewing via Python-list
an operation on strings, it doesn't look in the file system. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Addition of a .= operator

2023-05-20 Thread Greg Ewing via Python-list
just be syntactic sugar, which is harder to justify. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Addition of a .= operator

2023-05-20 Thread Greg Ewing via Python-list
have to be disallowed, as it's not at all clear what it should mean. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: An "adapter", superset of an iterator

2023-05-03 Thread Greg Ewing via Python-list
at reversed() itself should return a sequence view rather than an iterator. That would require restricting it to working on sequences, which would be an incompatible change. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: How to 'ignore' an error in Python?

2023-04-29 Thread Greg Ewing via Python-list
for it earlier, but there's still the possibility of a race condition -- someone could delete the folder and replace it with a file in the meantime. Or just delete it and not replace it with anything. So you need to be prepared to deal with failures at any point. -- Greg -- https://mail.python.org/mailman

Re: Incomplete sys.path with embeddable python (Windows)!?

2023-04-22 Thread Greg Ewing via Python-list
into a package named after the script, e.g. put the local modules used by foo.py into a package called foolib. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Incomplete sys.path with embeddable python (Windows)!?

2023-04-21 Thread Greg Ewing via Python-list
How are you invoking your script? Presumably you have some code in your embedding application that takes a script path and runs it. Instead of putting the code to update sys.path into every script, the embedding application could do it before running the script. -- Greg -- https

Re: Weak Type Ability for Python

2023-04-13 Thread Greg Ewing via Python-list
. There are Clifford algebras, Lie algebras, ... Not sure what any of those should do to strings, though. :-) -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] Small lament...

2023-04-04 Thread Greg Ewing via Python-list
shortly. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: How to add clickable url links to 3D Matplotlib chart ?

2023-03-29 Thread Greg Ewing via Python-list
/stable/gallery/misc/hyperlinks_sgskip.html -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: What kind of "thread safe" are deque's actually?

2023-03-29 Thread Greg Ewing via Python-list
over it. Hopefully that would be implemented in a thread-safe way (although the docs don't currently promise that). -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: What kind of "thread safe" are deque's actually?

2023-03-28 Thread Greg Ewing via Python-list
that? -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: How to get get_body() to work? (about email)

2023-03-19 Thread Greg Ewing via Python-list
, and open() is a function again that builds the appropriate combination of underlying objects. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: We can call methods of parenet class without initliaze it?

2023-03-15 Thread Greg Ewing via Python-list
. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Baffled by readline module

2023-03-09 Thread Greg Ewing via Python-list
On 10/03/23 4:00 pm, 2qdxy4rzwzuui...@potatochowder.com wrote: My ~/.pythonrc contains the following: import readline import rlcompleter readline.parse_and_bind( 'tab: complete' ) I don't have a ~/.pythonrc, so that's not what's doing it for me. -- Greg -- https

Re: Baffled by readline module

2023-03-09 Thread Greg Ewing via Python-list
On 10/03/23 2:57 pm, Chris Angelico wrote: import sys; "readline" in sys.modules Is it? Yes, it is -- but only when using the repl! If I put that in a script, I get False. My current theory is that it gets pre-imported when using Python interactively because the repl itself uses it

Re: Baffled by readline module

2023-03-09 Thread Greg Ewing via Python-list
e, without having to import anything. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Baffled by readline module

2023-03-09 Thread Greg Ewing via Python-list
On 10/03/23 12:43 pm, Grant Edwards wrote: When a computer dies, I generally just cp -a (or rsync -a) $HOME to a new one. Same here, more or less. My current machine has multiple archaeological layers going back about 5 generations of technology... -- Greg -- https://mail.python.org/mailman

Re: Baffled by readline module

2023-03-09 Thread Greg Ewing via Python-list
hing that the user didn't type in. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Baffled by readline module

2023-03-09 Thread Greg Ewing via Python-list
?) -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Baffled by readline module

2023-03-09 Thread Greg Ewing via Python-list
there. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Feature migration

2023-03-08 Thread Greg Ewing via Python-list
parttly inspired by functional languages such as Haskell. Haskell has always allowed indentation as one way of expressing structure. Python wasn't the first language to use indentation semantically. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Fast full-text searching in Python (job for Whoosh?)

2023-03-06 Thread Greg Ewing via Python-list
o be a lot of overlap between entries containing "V" and entries containing "6", so you end up searching the same data multiple times. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Fast full-text searching in Python (job for Whoosh?)

2023-03-06 Thread Greg Ewing via Python-list
On 7/03/23 4:35 am, Weatherby,Gerard wrote: If mailing space is a consideration, we could all help by keeping our replies short and to the point. Indeed. A thread or two of untrimmed quoted messages is probably more data than Dino posted! -- Greg -- https://mail.python.org/mailman/listinfo

Re: Cutting slices

2023-03-05 Thread Greg Ewing via Python-list
On 6/03/23 11:43 am, Stefan Ram wrote: A user tries to chop of sections from a string, but does not use "split" because the separator might become more complicated so that a regular expression will be required to find it. What's wrong with re.split() in that case? -- Gre

Re: Bug 3.11.x behavioral, open file buffers not flushed til file closed.

2023-03-05 Thread Greg Ewing via Python-list
impose additional delays before the data actually gets written. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Fast full-text searching in Python (job for Whoosh?)

2023-03-04 Thread Greg Ewing via Python-list
. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Which more Pythonic - self.__class__ or type(self)?

2023-03-03 Thread Greg Ewing via Python-list
watch out for horcruxes during code reviews. I'll note that he was fluent in Parseltongue, which is not a good sign. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Which more Pythonic - self.__class__ or type(self)?

2023-03-02 Thread Greg Ewing via Python-list
efficient, as it avoids a global lookup and a function call. But as always, measurement would be required to be sure. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3.10 Fizzbuzz

2023-03-01 Thread Greg Ewing via Python-list
On 2/03/23 10:59 am, gene heskett wrote: Human skin always has the same color Um... no? -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: one Liner: Lisprint(x) --> (a, b, c) instead of ['a', 'b', 'c']

2023-02-27 Thread Greg Ewing via Python-list
On 28/02/23 4:24 pm, Hen Hanna wrote: is it poss. to peek at the Python-list's messages without joining ? It's mirrored to the comp.lang.python usenet group, or you can read it through gmane with a news client. -- Greg -- https://mail.python.org/mailman/listinfo

Re: Python 3.10 Fizzbuzz

2023-02-27 Thread Greg Ewing via Python-list
they are easier to type. I tend to use the convention of double quotes for strings seen by the outside world, and single quotes for internal constants (such as enumerated types that happen to be represented by strings). I guess this means I can't use Black. :-( -- Greg -- https://mail.python.org

Re: it seems like a few weeks ago... but actually it was more like 30 years ago that i was programming in C, and

2023-02-27 Thread Greg Ewing via Python-list
be debated, but it wasn't a bug or an accident. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: it seems like a few weeks ago... but actually it was more like 30 years ago that i was programming in C, and

2023-02-27 Thread Greg Ewing via Python-list
). The semantics of list comprehensions was originally defined in terms of nested for loops. A consequence was that the loop variables ended up in the local scope just as with ordinary for loops. Later it was decided to change that. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: TypeError: can only concatenate str (not "int") to str

2023-02-25 Thread Greg Ewing via Python-list
of their way to read the tutor list -- something that is not of personal benefit to them. Also, pointing people towards tutor lists, if not done carefully, can give the impression of saying "newcomers are not welcome here". That's not a message we want to send to Python newcomers at all

Re: semi colonic

2023-02-23 Thread Greg Ewing via Python-list
On 24/02/23 9:26 am, avi.e.gr...@gmail.com wrote: Python One-Liners: Write Concise, Eloquent Python Like a Professional Illustrated Edition by Christian Mayer (Author) I didn't know there were any Professional Illustrated Editions writing Pythom. You learn something every day! :-) -- Greg

Re: it seems like a few weeks ago... but actually it was more like 30 years ago that i was programming in C, and

2023-02-22 Thread Greg Ewing via Python-list
better than an interpreter. There are some similarities between Python and Lisp-family languages, but really Python is its own thing. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: semi colonic

2023-02-22 Thread Greg Ewing via Python-list
. :-) On the other hand, if they really want to, they will still be able to abuse semicolons by doing this sort of thing: a = 5; pass b = 7; pass c = a * b; pass Then everyone will know it's some really serious code! -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Introspecting the variable bound to a function argument

2023-02-22 Thread Greg Ewing via Python-list
the term [call by name] suggests this should be possible. But Python doesn't use call-by-name or anything remotely like it. (Even if it did, the word "name" in that context doesn't mean what it sounds like it means. The Algol docs used some words in weird ways.) -- Greg -- https://mail.

Re: Precision Tail-off?

2023-02-17 Thread Greg Ewing via Python-list
, since 1/3 isn't exactly representable in decimal either. To avoid it you would need to use an algorithm that computes nth roots directly rather than raising to the power 1/n. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: ChatGPT Generated news poster code

2023-02-10 Thread Greg Ewing via Python-list
For a moment I thought this was going to be a script that uses ChatGPT to generate a random news post and post it to Usenet... Which would also have been kind of cool, as long as it wasn't overused. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Organizing modules and their code

2023-02-05 Thread Greg Ewing via Python-list
of it, and that was something he saw his colleagues failing to do. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Organizing modules and their code

2023-02-04 Thread Greg Ewing via Python-list
devoted to each fruit, but only ever one crate of fruit in each aisle, one would think they could make better use of their shelf space. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: evaluation question

2023-02-02 Thread Greg Ewing
hardware, you don't have to budget for replacing it. But you can't expect third party software to be maintained forever -- particularly when, as with Python, the maintenance is mainly being done by *volunteers*. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Licensing?

2023-02-02 Thread Greg Ewing
the original copyright notice as requested, maybe with a "based on work by..." attribution. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: evaluation question

2023-01-31 Thread Greg Ewing
.7 to make it easier to write code that would work in both versions. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: evaluation question

2023-01-31 Thread Greg Ewing
roblem. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: evaluation question

2023-01-31 Thread Greg Ewing
e suddenly cease to execute. No, but it was decided that Python 3 would have to be backwards incompatible, mainly to sort out the Unicode mess. Given that, the opportunity was taken to clean up some other mistakes as well. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: evaluation question

2023-01-30 Thread Greg Ewing
syntax in the language. Functions don't need to return things to justify their existence, and in fact the usual convention is that functions whose purpose is to have an effect just return None. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: bool and int

2023-01-27 Thread Greg Ewing
l go wrong 255 times out of 256. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-23 Thread Greg Ewing
the argument out of argv directly. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Improvement to imports, what is a better way ?

2023-01-18 Thread Greg Ewing
that are *very* frequently referenced. Use full unabbreviated names for everything else. * Don't 'import foo as foo', just 'import foo'. * Don't try to line the code up in columns, it doesn't really help readability IMO. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Fast lookup of bulky "table"

2023-01-15 Thread Greg Ewing
, it will be very fast. If it has to fall back on a linear search, it probably won't be significantly faster than your existing Python implementation. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: To clarify how Python handles two equal objects

2023-01-10 Thread Greg Ewing
* sizeof(int)); arr1[0] = 10; arr1[1] = 11; arr1[2] = 12; Does that help your understanding? -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: NoneType List

2022-12-31 Thread Greg Ewing
and non-mutating methods, and to help catch mistakes resulting from mixing them up. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: String to Float, without introducing errors

2022-12-19 Thread Greg Ewing
t;> dtdm * (1/1000 - 10/1000) 3.4004053539917275e-28 which agrees with your Decimal calculation to 3 digits, and should be as precise as the input numbers (about 4 digits in this case). This is a good example of why it's important to choose an appropriate numerical algorithm! -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: String to Float, without introducing errors

2022-12-18 Thread Greg Ewing
. If you can post some code we might be able to help you further. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: In code, list.clear doesn't throw error - it's just ignored

2022-11-13 Thread Greg Ewing
hat's what linters are for. I wouldn't like the core interpreter to be producing a bunch of warnings for things like this. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: In code, list.clear doesn't throw error - it's just ignored

2022-11-13 Thread Greg Ewing
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. To put it a bit more clearly, you're allowed to evaluate an expression and ignore the result. -- Greg

  1   2   3   4   5   6   7   8   9   10   >