Jach Feng wrote:
I have two files: test.py and test2.py
--test.py--
x = 2
def foo():
print(x)
foo()
x = 3
foo()
--test2.py--
from test import *
x = 4
foo()
-
Run test.py under Winows8.1, I get the expected result:
e:\MyDocument>py test.py
2
3
But when run test2.py, the result is not
Jach Feng wrote:
Chris Angelico 在 2022年8月29日 星期一下午1:58:58 [UTC+8] 的信中寫道:
On Mon, 29 Aug 2022 at 15:54, Jach Feng wrote:
Richard Damon 在 2022年8月29日 星期一上午10:47:08 [UTC+8] 的信中寫道:
On 8/27/22 7:42 AM, Mark Bourne wrote:
Jach Feng wrote:
I have two files: test.py and test2.py
--test.py--
x = 2
Roel Schroeven wrote:
Op 29/08/2022 om 2:55 schreef gene heskett:
On 8/28/22 19:39, Peter J. Holzer wrote:
On 2022-08-28 18:40:17 -0400, gene heskett wrote:
Persuant to my claim the py3.10 is busted, here is a sample. This is
me,
trying to make
pronterface, inside a venv: When the package man
gene heskett wrote:
On 8/29/22 12:50, Mark Bourne wrote:
Roel Schroeven wrote:
Op 29/08/2022 om 2:55 schreef gene heskett:
On 8/28/22 19:39, Peter J. Holzer wrote:
On 2022-08-28 18:40:17 -0400, gene heskett wrote:
Persuant to my claim the py3.10 is busted, here is a sample. This
is me
Jach Feng wrote:
Mark Bourne 在 2022年8月29日 星期一下午6:40:59 [UTC+8] 的信中寫道:
Jach Feng wrote:
Chris Angelico 在 2022年8月29日 星期一下午1:58:58 [UTC+8] 的信中寫道:
On Mon, 29 Aug 2022 at 15:54, Jach Feng wrote:
Richard Damon 在 2022年8月29日 星期一上午10:47:08 [UTC+8] 的信中寫道:
On 8/27/22 7:42 AM, Mark Bourne wrote
Jach Feng wrote:
I have a script using the argparse module. I want to enter the string
"step\x0A" as one of its positional arguments. I expect this string has a
length of 5, but it gives 8. Obviously the escape character didn't function correctly.
How to do it?
That depends on the command-li
Antoon Pardon wrote:
Op 27/12/2022 om 11:37 schreef Chris Angelico:
On Tue, 27 Dec 2022 at 21:29, Antoon Pardon wrote:
OK, I am writing an alternative for the threading module. What I would
like to know is how I can get some library modules call my alternative
instead of the threading module
Jen Kris wrote:
Avi,
Your comments go farther afield than my original question, but you made some
interesting additional points. For example, I sometimes work with the C API
and sys.getrefcount may be helpful in deciding when to INCREF and DECREF. But
that’s another issue.
The situation I
Jach Feng wrote:
Fail on command line,
e:\Works\Python>py infix2postfix.py "-4^2+5.3*abs(-2-1)/2"
usage: infix2postfix.py [-h] [infix]
infix2postfix.py: error: unrecognized arguments: -4^2+5.3*abs(-2-1)/2
Also fail in REPL,
e:\Works\Python>py
Python 3.8.8 (tags/v3.8.8:024d805, Feb 19 2021, 13:
avi.e.gr...@gmail.com wrote:
...
Interestingly, I wonder if anyone has
designed an alternate object type that can be used mostly in place of
Booleans but which imposes changes and restrictions so trying to add a
Boolean to an integer, or vice versa, results in an error. Python is
flexible enough
Jach Feng wrote:
Jach Feng 在 2023年1月22日 星期日上午11:11:22 [UTC+8] 的信中寫道:
Fail on command line,
e:\Works\Python>py infix2postfix.py "-4^2+5.3*abs(-2-1)/2"
usage: infix2postfix.py [-h] [infix]
infix2postfix.py: error: unrecognized arguments: -4^2+5.3*abs(-2-1)/2
Also fail in REPL,
e:\Works\Python>p
mutt...@dastardlyhq.com wrote:
On Sat, 28 Jan 2023 14:22:01 +1300
dn wrote:
Do you know about the Python REPL?
Haven't learnt the acronyms yet.
REPL stands for "Read Evaluate Print Loop". It basically refers to the
interactive interpreter, which reads input you type, evaluates it,
prints
Jach Feng wrote:
Jach Feng 在 2023年1月22日 星期日上午11:11:22 [UTC+8] 的信中寫道:
Fail on command line,
e:\Works\Python>py infix2postfix.py "-4^2+5.3*abs(-2-1)/2"
usage: infix2postfix.py [-h] [infix]
infix2postfix.py: error: unrecognized arguments: -4^2+5.3*abs(-2-1)/2
Also fail in REPL,
e:\Works\Python>p
Jach Feng wrote:
Thank you for detail explanation of the role the shell is involved in this
problem. I'm very appreciated!
It seems that a CLI app may become very complex when dealing with different
kind of shell, and may not be possible to solve its problem. But the good thing
in my app is t
Greg Ewing wrote:
On 30/01/23 10:41 pm, mutt...@dastardlyhq.com wrote:
What was the point of the upheaval of converting
the print command in python 2 into a function in python 3 if as a
function
print() doesn't return anything useful?
It was made a function because there's no good reason for
mutt...@dastardlyhq.com wrote:
On Wed, 1 Feb 2023 18:28:04 +0100
"Peter J. Holzer" wrote:
--b2nljkb3mdefsdhx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On 2023-02-01 09:00:39 -, mutt...@dastardlyhq.com wrote:
Its not
Stefan Ram wrote:
When one defines a function, sometimes its name is only
half-existent.
One can implicitly evaluate the name of the function:
main.py
def g():
def f():
print( f )
f()
g()
output
.f at ...
, but one gets an error when one tries to evaluate
Stefan Ram wrote:
Mark Bourne writes:
In the second case, eval() only gets the globals and immediate locals,
Yes, I think you are right. Curiously, the following program would
mislead one to thing that eval /does/ see the intermediate names:
main.py
def f():
x = 22
def g
Mats Wichmann wrote:
Meanwhile, I'm still wondering why I need a program to "chat" to the
GUID Partition Table
Perhaps to keep on good terms with it so that it doesn't run away and
hide? I had to go looking for the GPT on one of my disks after it went
AWOL a couple of years ago. Eventually
scruel tao wrote:
If we have the following code:
```
parser = argparse.ArgumentParser(description="test")
parser.add_argument('path')
```
Run it without args, will get error message:
```
usage: test.py [-h] path
test.py: error: the following arguments are required: path
```
However, I hope the
Personally, I don't particularly like the way you have to put multiline
strings on the far left (rather than aligned with the rest of the scope)
to avoid getting spaces at the beginning of each line. I find it makes
it more difficult to see where the scope of the class/method/etc.
actually end
MRAB wrote:
On 2023-04-06 23:14, Jim Schwartz wrote:
Could someone please help Carlos? I’m not sure how to answer his
question
Sent from my iPhone
On Apr 6, 2023, at 3:53 PM, Carlos Fulqueris
wrote:
Hello Jim,
How can I unsubscribe to this email list?
Thomas Passin wrote:
On 4/19/2023 1:27 AM, Kevin M. Wilson via Python-list wrote:
Ok, I got rid of the "print (f'"I am thinking of a number between 1 to
{LIMIT}\n")"print ("I am thinking of a number between 1 to {LIMIT}\n"),
I think you misunderstand several things at the same time here.
1. T
Lorenzo Catoni wrote:
Dear Python Mailing List members,
I am writing to seek your assistance in understanding an unexpected
behavior that I encountered while using the __enter__ method. I have
provided a code snippet below to illustrate the problem:
```
class X:
... __enter__ = int
...
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\n'
>
> However this expression, which is
I've came across an issue with attaching a mock function to another mock
object. It looks like this might be a bug in unittest.mock, but it's
possible I'm misunderstanding or doing something wrong.
I'm currently using Python 3.8.10, which is the default installed on
Ubuntu 20.04. I don't hav
Loris Bennett wrote:
Hi,
I am using SQLAlchemy to extract some rows from a table of 'events'.
From the call to the DB I get a list of objects of the type
sqlalchemy.orm.state.InstanceState
I would like to print these rows to the terminal using the 'tabulate'
package, the documentation for
Thomas Nyberg wrote:
Hi,
Yeah so flask does support async (when installed with `pip3 install
flask[async]), but you are making a good point that flask in this case
is a distraction. Here's an example using just the standard library that
exhibits the same issue:
`app.py`
```
import asyncio
i
Stefan Ram wrote:
ast wrote or quoted:
Why did you renamed itertools as _itertools ?
Assume I have a module A.py:
import math
def f(): pass
. Assume I have an additional module B.py:
import A
. Now, when I'm editing "B.py" in IDLE and type "A.", IIRC
IDLE will offer me two pos
Thomas Passin wrote:
On 4/2/2024 1:47 PM, Piergiorgio Sartor via Python-list wrote:
On 02/04/2024 19.18, Stefan Ram wrote:
Some people can't believe it when I say that chatbots improve
my programming productivity. So, here's a technique I learned
from a chatbot!
It is a structured "
for it to be kept hanging around in memory.
Perhaps worse, imagine doing the search in parallel and as sone as it is found
anywhere, ...
-Original Message-
From: Python-list On
Behalf Of Mark Bourne via Python-list
Sent: Thursday, April 4, 2024 3:04 PM
To: python-list@python.org
Subj
Stefan Ram wrote:
Mark Bourne wrote or quoted:
I don't think there's a tuple being created. If you mean:
( word for word in list_ if word[ 0 ]== 'e' )
...that's not creating a tuple. It's a generator expression, which
generates the next value each time it
Albert-Jan Roskam wrote:
Today I used chardet.detect in the repl and it returned windows-1252
(incorrect, because it later resulted in a UnicodeDecodeError). When I ran
chardet as a script (which uses UniversalLineDetector) this returned
MacRoman. Isn't charset.detect the correct
Norman Robins wrote:
I'm somewhat new to mocking for unit tests.
I have some code like this:
In foo/bar/baz.py I have 2 function I want to mock, one calls the other"
def function1_to_mock():
.
.
.
def function2_to_mock():
function1_to_mock()
In foo/bar/main.py I import 1 of th
2qdxy4rzwzuui...@potatochowder.com wrote:
On 2024-12-14 at 12:08:29 +,
Mark Bourne via Python-list wrote:
Martin Ruppert wrote:
Hi,
the division 0.4/7 provides a wrong result. It should give a periodic
decimal fraction with at most six digits, but it doesn't.
Below is the comparis
Martin Ruppert wrote:
Hi,
the division 0.4/7 provides a wrong result. It should give a periodic
decimal fraction with at most six digits, but it doesn't.
Below is the comparison of the result of decimal, mpmath, dc and calc.
0.0571428571428571460292086417861615440675190516880580357142857 decim
36 matches
Mail list logo