Re: python3 package import difference?

2024-08-08 Thread Cameron Simpson via Python-list
On 08Aug2024 21:55, Gilmeh Serda wrote: I guess in a sense Py2 was smarter figuring out what whent where and where it came from. Or it was a bad hack that has been removed. No, Python 2 offered less control. -- https://mail.python.org/mailman/listinfo/python-list

Re: python3 package import difference?

2024-08-07 Thread Cameron Simpson via Python-list
On 07Aug2024 08:35, Tobiah wrote: When I do the same import with python3, I get: Traceback (most recent call last): File "/home/toby/me", line 1, in import rcs.dbi File "/usr/regos-1.0/lib/python/rcs/dbi/__init__.py", line 1, in from dbi import * ModuleNotFoundEr

Re: python3 package import difference?

2024-08-07 Thread Chris Angelico via Python-list
On Thu, 8 Aug 2024 at 03:40, Tobiah via Python-list wrote: > The one under rcs.dbi contains: > > from dbi import * > from regos import * > You probably want these to be package-relative now: from .dbi import * from .regos import * Or, since you're using namespaced imports anyway ("rcs

Re: python3 package import difference?

2024-08-07 Thread Ronaldo Sc via Python-list
I believe you will need to track the modules in the folder *dbi *in the root file '__init__.py'. So there's an alternative to use the statement __all__ in the root filet __init__.py, check the link where I find a use case: *https://sentry.io/answers/what-is-init-py-for-in-python/#using-__init__

python3 package import difference?

2024-08-07 Thread Tobiah via Python-list
I have an old library from 20 some years ago for use with python2, that is structured like this: rcs ├── dbi │   ├── __init__.py │   ├── dbi.py │   └── regos.py └── __init__.py -- *empty* the __init__.py file under 'rcs' is empty. The one under rcs.dbi contains:

Re: Difference method vs attribut = function

2024-06-30 Thread Dieter Maurer via Python-list
Ulrich Goebel wrote at 2024-6-28 18:08 +0200: >Hi, > >a class can have methods, and it can have attributes, which can hold a >function. Both is well known, of course. > >My question: Is there any difference? I think you should make the distinction "class versus instance

Re: Difference method vs attribut = function

2024-06-29 Thread Thomas Passin via Python-list
On 6/28/2024 12:08 PM, Ulrich Goebel via Python-list wrote: Hi, a class can have methods, and it can have attributes, which can hold a function. Both is well known, of course. My question: Is there any difference? The code snipped shows that both do what they should do. But __dict__ includes

Re: Difference method vs attribut = function

2024-06-29 Thread Mats Wichmann via Python-list
On 6/28/24 10:08, Ulrich Goebel via Python-list wrote: By the way: in my usecase I want to pass different functions to different instances of MyClass. It is in the context of a database app where I build Getters for database data and pass one Getter per instance. If I understood what you're

Re: Difference method vs attribut = function

2024-06-29 Thread Peter J. Holzer via Python-list
On 2024-06-28 18:08:54 +0200, Ulrich Goebel via Python-list wrote: > a class can have methods, and it can have attributes, which can hold a > function. Both is well known, of course. > > My question: Is there any difference? > > The code snipped shows that both do what t

Difference method vs attribut = function

2024-06-29 Thread Ulrich Goebel via Python-list
Hi, a class can have methods, and it can have attributes, which can hold a function. Both is well known, of course. My question: Is there any difference? The code snipped shows that both do what they should do. But __dict__ includes just the method, while dir detects the method and the

Re: pathlib.Path.is_file vs os.path.isfile difference

2024-03-10 Thread Barry via Python-list
> On 10 Mar 2024, at 14:49, Thomas Passin via Python-list > wrote: > > That and there's a registry setting: > > https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation > Yep that and rules about size of parts of the path. Barry -- https://mail.python.org/mailm

Re: pathlib.Path.is_file vs os.path.isfile difference

2024-03-10 Thread Thomas Passin via Python-list
On 3/10/2024 9:33 AM, Albert-Jan Roskam wrote: On Mar 10, 2024 12:59, Thomas Passin via Python-list wrote: On 3/10/2024 6:17 AM, Barry wrote: > > >> On 8 Mar 2024, at 23:19, Thomas Passin via Python-list wrote: >> >> We just learned a few posts back that it

Re: pathlib.Path.is_file vs os.path.isfile difference

2024-03-10 Thread Albert-Jan Roskam via Python-list
On Mar 10, 2024 12:59, Thomas Passin via Python-list wrote: On 3/10/2024 6:17 AM, Barry wrote: > > >> On 8 Mar 2024, at 23:19, Thomas Passin via Python-list wrote: >> >> We just learned a few posts back that it might be specific to Linux; I ran it on

Re: pathlib.Path.is_file vs os.path.isfile difference

2024-03-10 Thread Thomas Passin via Python-list
On 3/10/2024 6:17 AM, Barry wrote: On 8 Mar 2024, at 23:19, Thomas Passin via Python-list wrote: We just learned a few posts back that it might be specific to Linux; I ran it on Windows. Depending on the exact win32 api used there is a 257 limit on windows. The 257 includes 2 for the dev

Re: pathlib.Path.is_file vs os.path.isfile difference

2024-03-10 Thread Barry via Python-list
> On 8 Mar 2024, at 23:19, Thomas Passin via Python-list > wrote: > > We just learned a few posts back that it might be specific to Linux; I ran it > on Windows. Depending on the exact win32 api used there is a 257 limit on windows. The 257 includes 2 for the device, C:, and 255 for the pat

Re: pathlib.Path.is_file vs os.path.isfile difference

2024-03-08 Thread Grant Edwards via Python-list
On 2024-03-08, Thomas Passin via Python-list wrote: > >> Hi, I tested this with Python 3.8. Good to know that this was fixed! > > We just learned a few posts back that it might be specific to Linux; I > ran it on Windows. On Linux, the limit is imposed by the filesystem. Most of the "real" file

Re: pathlib.Path.is_file vs os.path.isfile difference

2024-03-08 Thread Thomas Passin via Python-list
On 3/8/2024 5:14 PM, Albert-Jan Roskam wrote: On Mar 8, 2024 19:35, Thomas Passin via Python-list wrote: On 3/8/2024 1:03 PM, Albert-Jan Roskam via Python-list wrote: > Hi, > I was replacing some os.path stuff with Pathlib and I discovered this: > Path(256

Re: pathlib.Path.is_file vs os.path.isfile difference

2024-03-08 Thread Albert-Jan Roskam via Python-list
On Mar 8, 2024 19:35, Thomas Passin via Python-list wrote: On 3/8/2024 1:03 PM, Albert-Jan Roskam via Python-list wrote: > Hi, > I was replacing some os.path stuff with Pathlib and I discovered this: > Path(256 * "x").is_file() # OSError > os.p

Re: pathlib.Path.is_file vs os.path.isfile difference

2024-03-08 Thread Thomas Passin via Python-list
On 3/8/2024 2:21 PM, Grant Edwards via Python-list wrote: On 2024-03-08, Thomas Passin via Python-list wrote: On 3/8/2024 1:03 PM, Albert-Jan Roskam via Python-list wrote: Hi, I was replacing some os.path stuff with Pathlib and I discovered this: Path(256 * "x").is_file() # OSE

Re: pathlib.Path.is_file vs os.path.isfile difference

2024-03-08 Thread Grant Edwards via Python-list
On 2024-03-08, Grant Edwards via Python-list wrote: >> OSError: [Errno 36] File name too long: >> 'x

Re: pathlib.Path.is_file vs os.path.isfile difference

2024-03-08 Thread Grant Edwards via Python-list
On 2024-03-08, Grant Edwards via Python-list wrote: > On 2024-03-08, Thomas Passin via Python-list wrote: >> On 3/8/2024 1:03 PM, Albert-Jan Roskam via Python-list wrote: >>> Hi, >>> I was replacing some os.path stuff with Pathlib and I discovered this: >>> Path(256 * "x").is_file()

Re: pathlib.Path.is_file vs os.path.isfile difference

2024-03-08 Thread Grant Edwards via Python-list
On 2024-03-08, Thomas Passin via Python-list wrote: > On 3/8/2024 1:03 PM, Albert-Jan Roskam via Python-list wrote: >> Hi, >> I was replacing some os.path stuff with Pathlib and I discovered this: >> Path(256 * "x").is_file() # OSError >> os.path.isfile(256 * "x") # bool >> I

Re: pathlib.Path.is_file vs os.path.isfile difference

2024-03-08 Thread Thomas Passin via Python-list
On 3/8/2024 1:03 PM, Albert-Jan Roskam via Python-list wrote: Hi, I was replacing some os.path stuff with Pathlib and I discovered this: Path(256 * "x").is_file() # OSError os.path.isfile(256 * "x") # bool Is this intended? Does pathlib try to resemble os.path as closely as

pathlib.Path.is_file vs os.path.isfile difference

2024-03-08 Thread Albert-Jan Roskam via Python-list
Hi, I was replacing some os.path stuff with Pathlib and I discovered this: Path(256 * "x").is_file() # OSError os.path.isfile(256 * "x") # bool Is this intended? Does pathlib try to resemble os.path as closely as possible? Best wishes, Albert-Jan -- https://mail.python.or

Re: Difference in Setup Between Windows 10 Running Python 3.9 and Windows 11 Running Python 3.10

2022-05-03 Thread Eryk Sun
On 5/1/22, Brent Hunter wrote: > > I was recently running a Windows 10 machine Python 3.9. I simply created a > batch file titled "Start-AIG.bat" which simply contained the following: > "pythonw AIG.py". It started a python program titled "AIG.py" and the > Python dialog box was displayed on my

Re: Difference in Setup Between Windows 10 Running Python 3.9 and Windows 11 Running Python 3.10

2022-05-01 Thread MRAB
On 2022-05-02 02:56, Brent Hunter wrote: Hello, I was recently running a Windows 10 machine Python 3.9. I simply created a batch file titled "Start-AIG.bat" which simply contained the following: "pythonw AIG.py". It started a python program titled "AIG.py" and the Python dialog box was displ

Difference in Setup Between Windows 10 Running Python 3.9 and Windows 11 Running Python 3.10

2022-05-01 Thread Brent Hunter
Hello, I was recently running a Windows 10 machine Python 3.9. I simply created a batch file titled "Start-AIG.bat" which simply contained the following: "pythonw AIG.py". It started a python program titled "AIG.py" and the Python dialog box was displayed on my screen, running all day and n

Re: Subtle difference between any(a list) and any(a generator) with Python 3.9

2021-07-29 Thread Chris Angelico
On Fri, Jul 30, 2021 at 5:40 AM Terry Reedy wrote: > Since the 'two ways' involve the new :=, I have no idea what 'two ways' > and 'same result' you mean before :=. > I'm not sure, but I think that a lot of people read patch notes as if they say "this is how everyone needs to do things now", and

Re: Subtle difference between any(a list) and any(a generator) with Python 3.9

2021-07-29 Thread Terry Reedy
On 7/29/2021 5:39 AM, Unknown wrote: Hello Reading PEP572 about Python 3.9 assignment expressions, I discovered a subtle difference between any(a list) and any(a generator) see: >>> lines = ["azerty", "#qsdfgh", "wxcvbn"] >>> any((comment

Re: Subtle difference between any(a list) and any(a generator) with Python 3.9

2021-07-29 Thread Chris Angelico
On Thu, Jul 29, 2021 at 7:49 PM ast wrote: > > Hello > > Reading PEP572 about Python 3.9 assignment expressions, > I discovered a subtle difference between any(a list) > and any(a generator) > > see: > > >>> lines = ["azerty", "#qsdfgh",

Subtle difference between any(a list) and any(a generator) with Python 3.9

2021-07-29 Thread ast
Hello Reading PEP572 about Python 3.9 assignment expressions, I discovered a subtle difference between any(a list) and any(a generator) see: >>> lines = ["azerty", "#qsdfgh", "wxcvbn"] >>> any((comment := line).startswith('#') for li

Re: Puzzling difference between lists and tuples

2020-09-21 Thread Chris Angelico
On Mon, Sep 21, 2020 at 10:14 PM Serhiy Storchaka wrote: > > 18.09.20 03:55, Chris Angelico пише: > > On Fri, Sep 18, 2020 at 10:53 AM Grant Edwards > > wrote: > >> Yea, the syntax for tuple literals has always been a bit of an ugly > >> spot in Python. If ASCII had only had one more set of open

Re: Puzzling difference between lists and tuples

2020-09-21 Thread Serhiy Storchaka
18.09.20 03:55, Chris Angelico пише: > On Fri, Sep 18, 2020 at 10:53 AM Grant Edwards > wrote: >> Yea, the syntax for tuple literals has always been a bit of an ugly >> spot in Python. If ASCII had only had one more set of open/close >> brackets... > > ... then I'd prefer them to be used for set

Re: Puzzling difference between lists and tuples

2020-09-20 Thread Cameron Simpson
On 20Sep2020 20:33, Avi Gross wrote: >('M','R','A','B') is correct. I appreciate the correction. I did not look to >see the content of what I created, just the type! > a = tuple("first") a >('f', 'i', 'r', 's', 't') type(a) > > >But I thought adding a comma would help and it does no

RE: Puzzling difference between lists and tuples

2020-09-20 Thread Avi Gross via Python-list
iterator is iterating at a different level. >>> d = ["first"] >>> tuple(d) ('first',) >>> tuple(["first"]) ('first',) I understand the design choice and can imagine there may be another function that initializes a tuple more directly in

Re: Puzzling difference between lists and tuples

2020-09-20 Thread Greg Ewing
On 21/09/20 10:59 am, Avi Gross wrote: a=tuple("first") type(a) That seems more explicit than adding a trailing comma. It doesn't do what you want, though: >>> a = tuple("first") >>> print(a) ('f', 'i', 'r', 's', 't') If you really want to use tuple() to create a 1-tuple without using a tr

Re: Puzzling difference between lists and tuples

2020-09-20 Thread MRAB
On 2020-09-20 23:59, Avi Gross via Python-list wrote: There is a simple and obvious way to make sure you have a tuple by invoking the keyword/function in making it: a=('first') type(a) a=("first",) type(a) a=tuple("first") type(a) That seems more explicit than adding a trailing comm

RE: Puzzling difference between lists and tuples

2020-09-20 Thread Avi Gross via Python-list
t seems more explicit than adding a trailing comma. It also is a simple way to make an empty tuple but is there any penalty for using the function tuple()? -Original Message- From: Python-list On Behalf Of "???" Sent: Saturday, September 19, 2020 11:39 PM To: python-list

sorry for typo (Was: Re: Puzzling difference between lists and tuples)

2020-09-19 Thread 황병희
> #+BEGIN_SRC: python > for n in ('first',): > print n > #+BEGIN_SRC The last 'BEGIN_SRC' should be 'END_SRC' so sorry ;;; -- ^고맙습니다 _救濟蒼生_ 감사합니다_^))// -- https://mail.python.org/mailman/listinfo/python-list

Re: Puzzling difference between lists and tuples

2020-09-19 Thread 황병희
William Pearson writes: > ... > for n in ('first'): > print n > > > ... but "f","i","r","s","t" in the second. #+BEGIN_SRC: python for n in ('first',): print n #+BEGIN_SRC Then, that will print 'first'. And please use Python3... Sincerely, Byung-Hee -- ^고맙습니다 _救濟蒼生_ 감사합니다_^))// -- h

Re: Puzzling difference between lists and tuples

2020-09-18 Thread Greg Ewing
On 19/09/20 6:49 am, Grant Edwards wrote: There must be a few more sets of brackets in Unicode... Quite a lot, actually. The character browser in MacOSX is currently showing me 17, not including the ones that are built up from multiple characters. Some of them could be easily confused with no

Re: Puzzling difference between lists and tuples

2020-09-18 Thread Grant Edwards
On 2020-09-18, Chris Angelico wrote: > On Fri, Sep 18, 2020 at 10:53 AM Grant Edwards > wrote: >> >> On 2020-09-17, MRAB wrote: >> >> The only time the parentheses are required for tuple building is when >> >> they would otherwise not be interpreted that way: >> >> >> > They're needed for the emp

Re: Puzzling difference between lists and tuples

2020-09-17 Thread Chris Angelico
On Fri, Sep 18, 2020 at 10:53 AM Grant Edwards wrote: > > On 2020-09-17, MRAB wrote: > >> The only time the parentheses are required for tuple building is when > >> they would otherwise not be interpreted that way: > >> > > They're needed for the empty tuple, which doesn't have a comma. > > > >>

Re: Puzzling difference between lists and tuples

2020-09-17 Thread Grant Edwards
On 2020-09-17, MRAB wrote: >> The only time the parentheses are required for tuple building is when >> they would otherwise not be interpreted that way: >> > They're needed for the empty tuple, which doesn't have a comma. > >> some_func('first', 'second') # some_func called with two str args >>

Re: Puzzling difference between lists and tuples

2020-09-17 Thread Ethan Furman
On 9/17/20 10:43 AM, MRAB wrote: On 2020-09-17 17:47, Ethan Furman wrote: The only time the parentheses are required for tuple building is when they would otherwise not be interpreted that way: They're needed for the empty tuple, which doesn't have a comma. Ah, right. Thanks. -- ~Ethan~

Re: Puzzling difference between lists and tuples

2020-09-17 Thread MRAB
On 2020-09-17 17:47, Ethan Furman wrote: On 9/17/20 8:24 AM, William Pearson wrote: I am puzzled by the reason for this difference between lists and tuples. A list of with multiple strings can be reduced to a list with one string with the expected results: for n in ['first']:

Re: Puzzling difference between lists and tuples

2020-09-17 Thread Richard Damon
On 9/17/20 11:24 AM, William Pearson wrote: > I am puzzled by the reason for this difference between lists and tuples. > > A list of with multiple strings can be reduced to a list with one string with > the expected results: > > for n in ['first','second'

Re: Puzzling difference between lists and tuples

2020-09-17 Thread Ethan Furman
On 9/17/20 8:24 AM, William Pearson wrote: I am puzzled by the reason for this difference between lists and tuples. A list of with multiple strings can be reduced to a list with one string with the expected results: for n in ['first']: print n ['first'] is a list

Re: Puzzling difference between lists and tuples

2020-09-17 Thread 2QdxY4RzWzUUiLuE
On 2020-09-17 at 09:24:57 -0600, William Pearson wrote: > for n in ('first'): That's not a tuple. That's a string. Try it this way: for n in ('first',): # note the trailing comma print n Dan -- https://mail.python.org/mailman/listinfo/python-list

Puzzling difference between lists and tuples

2020-09-17 Thread William Pearson
I am puzzled by the reason for this difference between lists and tuples. A list of with multiple strings can be reduced to a list with one string with the expected results: for n in ['first','second']: print n for n in ['first']: print n The first loop

matplotlib: Difference between Axes and AxesSubplot

2020-04-27 Thread ast
Hello It's not clear to me what the differences between Axes and AxesSubplot classes are AxesSubplot is a sub class of Axes It is possible to draw in objects of both type with plot, scatter ... Axes object seems to be able to be inserted in AxesSubplot object (It is strange because AxesSubplot

Re: Is there a difference between python

2020-04-05 Thread Eryk Sun
On 4/5/20, Malcolm Greene wrote: > Is there a difference between the following 2 ways to launch a console-less > script under Windows? > > python

Re: Is there a difference between python

2020-04-05 Thread David L Neil via Python-list
On 6/04/20 10:35 AM, Malcolm Greene wrote: Is there a difference between the following 2 ways to launch a console-less script under Windows? python

Re: Is there a difference between python

2020-04-05 Thread Mike Dewhirst
On 6/04/2020 8:35 am, Malcolm Greene wrote: Is there a difference between the following 2 ways to launch a console-less script under Windows? python

Is there a difference between python

2020-04-05 Thread Malcolm Greene
Is there a difference between the following 2 ways to launch a console-less script under Windows? python

Re: Have you some experience / link about difference between Python builded with gcc and clang?

2020-03-13 Thread Marco Sulla
Well, I suppose we have a winner: pyperf_bench_3_8_gcc_9_2.json = Performance version: 1.0.0 Report on Linux-4.15.0-76-generic-x86_64-with-glibc2.27 Number of logical CPUs: 4 Start date: 2020-03-13 19:36:17.585796 End date: 2020-03-13 20:35:09.605718 pyperf_bench_3_8_

Re: Have you some experience / link about difference between Python builded with gcc and clang?

2020-03-02 Thread Skip Montanaro via Python-list
> > Have you compiled it optimized (--enable-optimizations --with-lto)? > Nope, just ./configure. Further investigation is left as an exercise for the reader. :-) Skip > -- https://mail.python.org/mailman/listinfo/python-list

Re: Have you some experience / link about difference between Python builded with gcc and clang?

2020-03-02 Thread Marco Sulla via Python-list
Oooohhh uff, I have to install latest clang... or better, compile it as I did for gcc. And I have to read the install docs to see if there's some trick to optimize it... and I have to read the docs of pyperformance too (I only used pyperf until now)... Oh well, tomorrow :-D On Mon, 2 Mar 2020

Re: Have you some experience / link about difference between Python builded with gcc and clang?

2020-03-01 Thread Skip Montanaro via Python-list
I didn't have clang installed. It was just "sudo apt install clang-8". From there all I had to do was build Python from scratch twice, install pyperformance using pip after the first build, then run it after each build. It's not difficult. Going beyond that right now is not an itch I need to scratc

Re: Have you some experience / link about difference between Python builded with gcc and clang?

2020-03-01 Thread Marco Sulla via Python-list
Good! Have you compiled it optimized (--enable-optimizations --with-lto)? On Sun, 1 Mar 2020 at 23:48, Skip Montanaro wrote: > > > As title. Currently I'm using gcc 9.2.0 and its compilation seems to > > work well and fast. But I would know by your experience if clang can > > produce, on a *nix s

Re: Have you some experience / link about difference between Python builded with gcc and clang?

2020-03-01 Thread Skip Montanaro
> As title. Currently I'm using gcc 9.2.0 and its compilation seems to > work well and fast. But I would know by your experience if clang can > produce, on a *nix system, a "faster Python". I took a quick run at this as I was wanting to give pyperformance a

Have you some experience / link about difference between Python builded with gcc and clang?

2020-03-01 Thread Marco Sulla via Python-list
As title. Currently I'm using gcc 9.2.0 and its compilation seems to work well and fast. But I would know by your experience if clang can produce, on a *nix system, a "faster Python". -- https://mail.python.org/mailman/listinfo/python-list

Re: Difference between os.path.isdir and Path.is_dir

2019-12-14 Thread Kirill Balunov
Yeah it is True, for the last two weeks or so I can access bugs.python.org in normal way. But I totally agree with the site that the best description of this situation is "Yet". with kind regards, -gdg сб, 14 дек. 2019 г. в 19:46, Terry Reedy : > On 7/26/2019 3:12 AM, Kirill Balunov wrote: > > ч

Re: Difference between os.path.isdir and Path.is_dir

2019-12-14 Thread Terry Reedy
On 7/26/2019 3:12 AM, Kirill Balunov wrote: чт, 25 июл. 2019 г. в 20:28, eryk sun : On 7/25/19, Kirill Balunov wrote: import os from pathlib import Path dummy = " " # or "" or " " os.path.isdir(dummy) False Path(dummy).is_dir() True I can't reproduce the above result in either Li

Re: What's the difference between running a script under command box and interpreter?

2019-11-04 Thread jfong
Grant Edwards於 2019年11月5日星期二 UTC+8上午12時41分24秒寫道: > On 2019-11-04, Dennis Lee Bieber wrote: > > Using > > > >from module import * > > > > is often the worst thing one can do. > > I agree 100%. > > Unfortunately, most of the official standard library documentation is > written assuming you do

Re: What's the difference between running a script under command box and interpreter?

2019-11-04 Thread MRAB
still not in Germany. It's the same way in Python. Well, kind of. One important difference is that when you import a car from Germany, that car is no longer in Germany. But when you import a symbol from a Python module, that symbol still exists in that module. You just have a second

Re: What's the difference between running a script under command box and interpreter?

2019-11-04 Thread Peter J. Holzer
he same way in Python. Well, kind of. One important difference is that when you import a car from Germany, that car is no longer in Germany. But when you import a symbol from a Python module, that symbol still exists in that module. You just have a second symbol in your namespace referencing the s

Re: What's the difference between running a script under command box and interpreter?

2019-11-04 Thread Grant Edwards
On 2019-11-04, Dennis Lee Bieber wrote: > Using > >from module import * > > is often the worst thing one can do. I agree 100%. Unfortunately, most of the official standard library documentation is written assuming you do _exactly_that_. Though it makes the documetnation more succinct, I thi

Re: What's the difference between running a script under command box and interpreter?

2019-11-03 Thread Chris Angelico
you interactively execute code > > as part of a module. If you start with "-i somescript.py", it starts > > out by running the contents of that script; otherwise, you start with > > nothing (as if you ran "-i empty-file.py"). The REPL does the same > >

Re: What's the difference between running a script under command box and interpreter?

2019-11-03 Thread jfong
> It surprises me that REPL has essential different behavior in these two > > situations. > > > > Not really. In each case, the REPL lets you interactively execute code > as part of a module. If you start with "-i somescript.py", it starts > out by running the

Re: What's the difference between running a script under command box and interpreter?

2019-11-03 Thread Chris Angelico
ch case, the REPL lets you interactively execute code as part of a module. If you start with "-i somescript.py", it starts out by running the contents of that script; otherwise, you start with nothing (as if you ran "-i empty-file.py"). The REPL does the same thing

Re: What's the difference between running a script under command box and interpreter?

2019-11-03 Thread jfong
Chris Angelico於 2019年11月4日星期一 UTC+8上午8時43分07秒寫道: > On Mon, Nov 4, 2019 at 11:36 AM wrote: > > > > Peter J. Holzer於 2019年11月4日星期一 UTC+8上午3時59分36秒寫道: > > > On 2019-11-01 04:24:38 -0700, jf...@ms4.hinet.net wrote: > > > > > The globals are your current module's namespace, and functions defines > > >

Re: What's the difference between running a script under command box and interpreter?

2019-11-03 Thread Cameron Simpson
On 03Nov2019 16:34, Jach Fong wrote: Peter J. Holzer於 2019年11月4日星期一 UTC+8上午3時59分36秒寫道: It's not really "the interpreter" (I think you mean the REPL) which has it's own globals. Every module/file has its own globals. The same thing happens non-interactively: % cat test.py def main(): prin

Re: What's the difference between running a script under command box and interpreter?

2019-11-03 Thread Chris Angelico
On Mon, Nov 4, 2019 at 11:36 AM wrote: > > Peter J. Holzer於 2019年11月4日星期一 UTC+8上午3時59分36秒寫道: > > On 2019-11-01 04:24:38 -0700, jf...@ms4.hinet.net wrote: > > > > The globals are your current module's namespace, and functions defines > > > > in a module are bound to that module's namespace. > > > >

Re: What's the difference between running a script under command box and interpreter?

2019-11-03 Thread jfong
Peter J. Holzer於 2019年11月4日星期一 UTC+8上午3時59分36秒寫道: > On 2019-11-01 04:24:38 -0700, jf...@ms4.hinet.net wrote: > > > The globals are your current module's namespace, and functions defines > > > in a module are bound to that module's namespace. > > > > > > Strip your test.py back. A lot. Try this: >

Re: What's the difference between running a script under command box and interpreter?

2019-11-03 Thread Peter J. Holzer
On 2019-11-01 04:24:38 -0700, jf...@ms4.hinet.net wrote: > > The globals are your current module's namespace, and functions defines > > in a module are bound to that module's namespace. > > > > Strip your test.py back. A lot. Try this: > > > > def main(): > > print(rule) > > > > Now,

Re: What's the difference between running a script under command box and interpreter?

2019-11-01 Thread jfong
Cameron Simpson於 2019年11月1日星期五 UTC+8下午5時28分42秒寫道: > On 31Oct2019 22:03, Jach Fong wrote: > >Cameron Simpson於 2019年11月1日星期五 UTC+8下午12時13分45秒寫道: > >> On 31Oct2019 20:44, Jach Fong wrote: > >> >The script test.py is something like this: > >> >---test.py > >> >from pyeds import fsm > >> >... > >>

Re: What's the difference between running a script under command box and interpreter?

2019-11-01 Thread Cameron Simpson
On 31Oct2019 22:03, Jach Fong wrote: Cameron Simpson於 2019年11月1日星期五 UTC+8下午12時13分45秒寫道: On 31Oct2019 20:44, Jach Fong wrote: >The script test.py is something like this: >---test.py >from pyeds import fsm >... >class Rule_Parse: >def __init__(self): >... >self.current_ch

Re: What's the difference between running a script under command box and interpreter?

2019-10-31 Thread jfong
Cameron Simpson於 2019年11月1日星期五 UTC+8下午12時13分45秒寫道: > On 31Oct2019 20:44, Jach Fong wrote: > >The script test.py is something like this: > >---test.py > >from pyeds import fsm > >... > >... > >class Rule_Parse: > >def __init__(self): > >... > >self.current_char = '' > >... >

Re: What's the difference between running a script under command box and interpreter?

2019-10-31 Thread Cameron Simpson
On 31Oct2019 20:44, Jach Fong wrote: The script test.py is something like this: ---test.py from pyeds import fsm ... ... class Rule_Parse: def __init__(self): ... self.current_char = '' ... ... def main(input_str): for c in input_str: ... rule.current_char =

What's the difference between running a script under command box and interpreter?

2019-10-31 Thread jfong
The script test.py is something like this: ---test.py from pyeds import fsm ... ... class Rule_Parse: def __init__(self): ... self.current_char = '' ... ... def main(input_str): for c in input_str: ... rule.current_char = c ... if __name__ == '__

RE: What is the Difference Between quit() and exit() commands in Python?

2019-09-16 Thread wesley
python.org (mailto:python-list@python.org) Betreff: What is the Difference Between quit() and exit() commands in Python? What is the Difference Between quit() and exit() commands in Python? -- mail.python.org/mailman/listinfo/python-list (https://mail.python.org/mailman/listinfo/python-lis

Re: What is the Difference Between quit() and exit() commands in Python?

2019-09-16 Thread Eryk Sun
On 9/16/19, Hongyi Zhao wrote: > > What is the Difference Between quit() and exit() commands in Python? They're different instances of the Quitter class, which is available if site.py is imported (i.e. not with the -S command-line option). They're created by site.setquit():

Re: What is the Difference Between quit() and exit() commands in Python?

2019-09-16 Thread Peter Otten
Hongyi Zhao wrote: > What is the Difference Between quit() and exit() commands in Python? They are instances of the same type >>> import inspect >>> type(quit) is type(exit) True >>> print(inspect.getsource(type(quit))) class Quitter(object): def __init__(self,

What is the Difference Between quit() and exit() commands in Python?

2019-09-16 Thread Hongyi Zhao
What is the Difference Between quit() and exit() commands in Python? -- https://mail.python.org/mailman/listinfo/python-list

Re: Difference between os.path.isdir and Path.is_dir

2019-07-26 Thread Kirill Balunov
чт, 25 июл. 2019 г. в 20:28, eryk sun : > On 7/25/19, Kirill Balunov wrote: > > > import os > from pathlib import Path > dummy = " " # or "" or " " > os.path.isdir(dummy) > > False > Path(dummy).is_dir() > > True > > I can't reproduce the above result in either Linu

Re: Difference between os.path.isdir and Path.is_dir

2019-07-25 Thread Cameron Simpson
On 26Jul2019 03:43, Chris Angelico wrote: On Fri, Jul 26, 2019 at 3:28 AM eryk sun wrote: On 7/25/19, Kirill Balunov wrote: import os from pathlib import Path dummy = " " # or "" or " " os.path.isdir(dummy) > False Path(dummy).is_dir() > True I can't reproduce

Re: Difference between os.path.isdir and Path.is_dir

2019-07-25 Thread Cameron Simpson
On 25Jul2019 13:40, eryk sun wrote: Windows trims trailing spaces and dots from the final component of a path, unless we use a non-normalized \\?\ path. Hoo! Well, that explains some extremely weird NAS behaviour I encountered the other month with some paths ending in spaces. (My machine and

Re: Difference between os.path.isdir and Path.is_dir

2019-07-25 Thread Chris Angelico
On Fri, Jul 26, 2019 at 6:13 AM Kirill Balunov wrote: > > > > чт, 25 июл. 2019 г. в 22:58, Chris Angelico : >> >> On Fri, Jul 26, 2019 at 5:52 AM Kirill Balunov >> wrote: >> [...] >> > No, it's not just because of curiosity. I will try to tell the background, >> > and maybe I went the wrong way

Re: Difference between os.path.isdir and Path.is_dir

2019-07-25 Thread Kirill Balunov
чт, 25 июл. 2019 г. в 22:58, Chris Angelico : > On Fri, Jul 26, 2019 at 5:52 AM Kirill Balunov > wrote: > [...] > > No, it's not just because of curiosity. I will try to tell the > background, and maybe I went the wrong way initially. There is a very cool > project https://github.com/3b1b/manim,

Re: Difference between os.path.isdir and Path.is_dir

2019-07-25 Thread Chris Angelico
On Fri, Jul 26, 2019 at 5:52 AM Kirill Balunov wrote: > > > > чт, 25 июл. 2019 г. в 19:16, Chris Angelico : >> >> On Fri, Jul 26, 2019 at 1:30 AM Kirill Balunov >> wrote: >> > >> > Hi all! It is expected that: >> > ``` >> > >>> import os >> > >>> from pathlib import Path >> > >>> dummy = " "

Re: Difference between os.path.isdir and Path.is_dir

2019-07-25 Thread Kirill Balunov
чт, 25 июл. 2019 г. в 19:16, Chris Angelico : > On Fri, Jul 26, 2019 at 1:30 AM Kirill Balunov > wrote: > > > > Hi all! It is expected that: > > ``` > > >>> import os > > >>> from pathlib import Path > > >>> dummy = " " # or "" or " " > > >>> os.path.isdir(dummy) > > False > > >>> Path(dum

Re: Difference between os.path.isdir and Path.is_dir

2019-07-25 Thread Kirill Balunov
чт, 25 июл. 2019 г. в 20:28, eryk sun : > On 7/25/19, Kirill Balunov wrote: > > > import os > from pathlib import Path > dummy = " " # or "" or " " > os.path.isdir(dummy) > > False > Path(dummy).is_dir() > > True > > I can't reproduce the above result in either Linu

Difference between os.path.isdir and Path.is_dir

2019-07-25 Thread Maksim Fomin via Python-list
‐‐‐ Original Message ‐‐‐ On Thursday, July 25, 2019 3:27 PM, Kirill Balunov wrote: > Hi all! It is expected that: > > >>> import os > >>> from pathlib import Path > >>> dummy = " " # or "" or " " > >>> os.path.isdir(dummy) > > False > >>> Path(dummy).is_dir

Re: Difference between os.path.isdir and Path.is_dir

2019-07-25 Thread eryk sun
On 7/25/19, Chris Angelico wrote: > On Fri, Jul 26, 2019 at 3:54 AM eryk sun wrote: > >> That's what I said. But the OP shows os.path.isdir(" ") == False and >> Path(" ").is_dir() == True, which is what I cannot reproduce and >> really should not be able to reproduce, unless there's a bug >> some

Re: Difference between os.path.isdir and Path.is_dir

2019-07-25 Thread Chris Angelico
On Fri, Jul 26, 2019 at 3:54 AM eryk sun wrote: > > On 7/25/19, Chris Angelico wrote: > > On Fri, Jul 26, 2019 at 3:28 AM eryk sun wrote: > >> > >> On 7/25/19, Kirill Balunov wrote: > >> > > >> import os > >> from pathlib import Path > >> dummy = " " # or "" or " " > >> >>>

Re: Difference between os.path.isdir and Path.is_dir

2019-07-25 Thread eryk sun
On 7/25/19, Chris Angelico wrote: > On Fri, Jul 26, 2019 at 3:28 AM eryk sun wrote: >> >> On 7/25/19, Kirill Balunov wrote: >> > >> import os >> from pathlib import Path >> dummy = " " # or "" or " " >> os.path.isdir(dummy) >> > False >> Path(dummy).is_dir() >> > T

Re: Difference between os.path.isdir and Path.is_dir

2019-07-25 Thread Chris Angelico
On Fri, Jul 26, 2019 at 3:28 AM eryk sun wrote: > > On 7/25/19, Kirill Balunov wrote: > > > import os > from pathlib import Path > dummy = " " # or "" or " " > os.path.isdir(dummy) > > False > Path(dummy).is_dir() > > True > > I can't reproduce the above result in e

Re: Difference between os.path.isdir and Path.is_dir

2019-07-25 Thread eryk sun
On 7/25/19, Kirill Balunov wrote: > import os from pathlib import Path dummy = " " # or "" or " " os.path.isdir(dummy) > False Path(dummy).is_dir() > True I can't reproduce the above result in either Linux or Windows. The results should only be different for an empt

Re: Difference between os.path.isdir and Path.is_dir

2019-07-25 Thread Chris Angelico
On Fri, Jul 26, 2019 at 1:30 AM Kirill Balunov wrote: > > Hi all! It is expected that: > ``` > >>> import os > >>> from pathlib import Path > >>> dummy = " " # or "" or " " > >>> os.path.isdir(dummy) > False > >>> Path(dummy).is_dir() > True > ``` > > or was it overlooked? > Was not aware

  1   2   3   4   5   6   7   8   9   10   >