Re: File names with slashes [was Re: error in os.chdir]

2018-07-04 Thread Steven D'Aprano
On Thu, 05 Jul 2018 00:56:22 +0300, Mikhail V wrote: > for the user it is most important to > *see* and copy-paste the path string exactly as it is displayed > everywhere else on windows. So in Windows, you see: dir directory\file.pdf so in Python, we have to use exactly the same path with

Re: PEP 526 - var annotations and the spirit of python

2018-07-04 Thread Abdur-Rahmaan Janhangeer
*you know x should still an int after these two statements, because the type hint says so. Without it:x = 3x = f(x)x could be anything.* *...* *If something is an int, then make it an int:x: int = 0* i'm not arguing about it being useful or not but rather people turn to python to hav

Re: Congrats to Chris for breaking his PEP curse

2018-07-04 Thread Gregory Ewing
Steven D'Aprano wrote: Not everything in Python uses a strict left-to-right reading order. Just like English really. Well, English is read left to right, but it doesn't always mean things in the order it says them. :-) -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Getting posts to sort chronologically in tree view

2018-07-04 Thread boB Stepp
On Tue, Jul 3, 2018 at 10:26 PM T Berger wrote: > I don't think I want to try a mail list. I had subscribed to the > python-list a few weeks ago and then been forced to unsubscribe > because of the flood of irrelevant posts. I use Gmail. It does allow various ways of filtering emails as has bee

Re: File names with slashes [was Re: error in os.chdir]

2018-07-04 Thread Gregory Ewing
Mikhail V wrote: There is one issue that I can't write \ on the end: r"C:\programs\util\" But since I know it's a path and not a file, I just write without trailing \. Indeed. There's never a need to put a backslash on the end of a path, as long as you always use os.path functions or equivalen

Re: PEP 526 - var annotations and the spirit of python

2018-07-04 Thread Gregory Ewing
Steven D'Aprano wrote: but the type checker should infer that if you assign None to a variable which is declared int, you must have meant Optional[int] rather than just int. This seems to be equivalent to saying that *all* types are Optional, in which case what point is there in having Option

Re: Python 3.7 configuration issue

2018-07-04 Thread dieter
Robin Becker writes: > ... > I don't disagree with the above. I think the issue is that the > configure process did not say anything about this. If ctypes is > required and cannot be built then ./configure .. should probably > tell me; if that's not possible then the make step should do so and

Vectorizing operation involving multiple DataFrames

2018-07-04 Thread Viswanath Potluri
I've a dataframe all_paths with say 9000 rows, and i've another dataframe Legs with 4000 rows. I need to filter all_paths dataframe based on a column called 'itineraries' which contains a list of strings, for each row in Legs. So, basically its like getting a dataframe that is subset of all_path

Re: PEP 526 - var annotations and the spirit of python

2018-07-04 Thread Steven D'Aprano
On Wed, 04 Jul 2018 19:57:12 +0100, Bart wrote: > On 04/07/2018 16:31, Steven D'Aprano wrote: >> On Wed, 04 Jul 2018 13:48:26 +0100, Bart wrote: > >> Of course the type (whether inferred or annotated) applies for the >> entire scope of that variable. >> >> > In that case I don't understand what

Re: Congrats to Chris for breaking his PEP curse

2018-07-04 Thread Steven D'Aprano
On Wed, 04 Jul 2018 16:23:31 -0600, Ian Kelly wrote: [...] >> >> group = match.group(1) if match := re.match(data) else None >> >> There's no stopping some people from making poor naming choices. Surely >> the standard name for match objects is "mo", not match? > > I was referring to the variable

Re: Matplotlib 3D limitations, please recommend alternative

2018-07-04 Thread William Ray Wing via Python-list
> On Jul 4, 2018, at 5:53 PM, John Ladasky wrote: > > I'm a regular Matplotlib user. Normally, I graph functions. I just > attempted to graph an icosahedral surface using the plot_trisurf() methods of > Matplotlib's Axes3D. I have discovered that Matplotlib is basically > hard-wired for gra

Re: Using Python with a website

2018-07-04 Thread Ben Finney
Adrian Taylor writes: > I have just discovered Python […] Welcome. The Python community has a starter page for beginners at https://wiki.python.org/moin/BeginnersGuide>. > However my next big step is to be able to use this python feature > within a website. Good. Be aware, though, that running

Using Python with a website

2018-07-04 Thread Adrian Taylor
G'day All, I have just discovered Python and thanks to a script by Ethan I can read a foxpro database and change the required values. However my next big step is to be able to use this python feature within a website. Basically I want to be able to click on a button and call the script. This wo

Re: Congrats to Chris for breaking his PEP curse

2018-07-04 Thread Ian Kelly
On Wed, Jul 4, 2018 at 1:11 AM Steven D'Aprano wrote: > > On Tue, 03 Jul 2018 23:05:01 -0600, Ian Kelly wrote: > > > Now that I've actually read the PEP (sorry, I just assumed it would > > never fly), I have a couple of (tongue-in-cheek) observations about it: > > > >> group = re.match(data).group

File names with slashes [was Re: error in os.chdir]

2018-07-04 Thread Mikhail V
ChrisA wrote: > Mikhail V wrote: >> Yes, and the answer was a week ago: just put "r" before the string. >> r"C:\programs\util" >> >> And it worked till now. So why should I replace backslashes with >> forward slashes? >> There is one issue that I can't write \ on the end: >> r"C:\programs\util\"

Matplotlib 3D limitations, please recommend alternative

2018-07-04 Thread John Ladasky
I'm a regular Matplotlib user. Normally, I graph functions. I just attempted to graph an icosahedral surface using the plot_trisurf() methods of Matplotlib's Axes3D. I have discovered that Matplotlib is basically hard-wired for graphing functions, and therefore will not work for general-purpos

Re: File names with slashes [was Re: error in os.chdir]

2018-07-04 Thread Mark Lawrence
On 04/07/18 21:30, Chris Angelico wrote: On Thu, Jul 5, 2018 at 6:25 AM, Mikhail V wrote: Joe Pfeiffer wrote: On Windows a path is e.g.: C:\programs\util\ So what is reasonable about using forward slashes? It happens to me that I need to copy-paste real paths like 100 times a day into scripts

profile guided optimization of loadable python modules?

2018-07-04 Thread Neal Becker
Has anyone tried to optimize shared libraries (for loadable python modules) using gcc with profile guided optimization? Is it possible? Thanks, Neal -- https://mail.python.org/mailman/listinfo/python-list

Re: File names with slashes [was Re: error in os.chdir]

2018-07-04 Thread Chris Angelico
On Thu, Jul 5, 2018 at 6:25 AM, Mikhail V wrote: > Joe Pfeiffer wrote: > >>> On Windows a path is e.g.: >>> C:\programs\util\ >>> So what is reasonable about using forward slashes? >>> It happens to me that I need to copy-paste real paths like 100 times >>> a day into scripts - do you propose to c

File names with slashes [was Re: error in os.chdir]

2018-07-04 Thread Mikhail V
Joe Pfeiffer wrote: >> On Windows a path is e.g.: >> C:\programs\util\ >> So what is reasonable about using forward slashes? >> It happens to me that I need to copy-paste real paths like 100 times >> a day into scripts - do you propose to convert to forward slashes each time? > That's what starte

Re: PEP 526 - var annotations and the spirit of python

2018-07-04 Thread Ian Kelly
On Wed, Jul 4, 2018, 9:36 AM Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Wed, 04 Jul 2018 13:48:26 +0100, Bart wrote: > >> A better example would be: > >> > >> x: int = None > >> > >> which ought to be read as "x is an int, or None, and it's currently > >> None". > > >

Re: PEP 526 - var annotations and the spirit of python

2018-07-04 Thread Bart
On 04/07/2018 16:31, Steven D'Aprano wrote: On Wed, 04 Jul 2018 13:48:26 +0100, Bart wrote: Of course the type (whether inferred or annotated) applies for the entire scope of that variable. In that case I don't understand what you're complaining about. You say that hinting is not needed he

Re: installing sklearn

2018-07-04 Thread Thomas Jollans
On 04/07/18 17:30, muhammet bozkurt wrote: > When i try to install sklearn, i encounter a problem which is “No module > named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from > distutils” and ai don’t know how to deal with it therafore i need some help. > Could you help me?(by the

Re: EXTERNAL: OSError: [Errno 48] Address already in use

2018-07-04 Thread mm0fmf
On 02/07/2018 18:51, T Berger wrote: On Monday, July 2, 2018 at 1:22:59 PM UTC-4, T Berger wrote: On Saturday, June 30, 2018 at 6:02:06 PM UTC-4, T Berger wrote: On Friday, June 29, 2018 at 7:00:15 PM UTC-4, Cameron Simpson wrote: The key point here from Jim is "simultaneously". Are you prope

installing sklearn

2018-07-04 Thread muhammet bozkurt
When i try to install sklearn, i encounter a problem which is “No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils” and ai don’t know how to deal with it therafore i need some help. Could you help me?(by the way i installed numpy) I put all error massage

Re: PEP 526 - var annotations and the spirit of python

2018-07-04 Thread Steven D'Aprano
On Wed, 04 Jul 2018 13:48:26 +0100, Bart wrote: > Presumably one type hint applies for the whole scope of the variable, > not just the one assignment. You know how in C you can write int x = 1; # the type applies for just this one assignment x = 2.5;# perfectly legal, right? Wai

Re: File names with slashes [was Re: error in os.chdir]

2018-07-04 Thread Joe Pfeiffer
Mikhail V writes: > [Steven D'Aprano] > >> (The same applies to Unix/Linux systems too, of course.) But while you're >> using Python to manipulate files, you should use Python rules, and that >> is "always use forward slashes". >> >> Is that reasonable? >> >> Under what circumstances would a user

Re: PEP 526 - var annotations and the spirit of python

2018-07-04 Thread Mark Lawrence
On 04/07/18 05:55, Jim Lee wrote: On 07/03/18 21:25, Ben Finney wrote: Jim Lee writes: On 07/03/18 19:58, Ben Finney via Python-list wrote: Jim Lee writes: If you were to say John had 2 apples, Jane had 4 apples, and Joe had an indefinite number of apples, how many numbers are we talkin

Re: PEP 526 - var annotations and the spirit of python

2018-07-04 Thread Bart
On 04/07/2018 06:52, Steven D'Aprano wrote: On Sun, 01 Jul 2018 17:22:43 -0500, Tim Daneliuk wrote: x: int = 3 [...] This strikes me as syntactic noise. Python is dynamically typed and will remain so. Why clutter the language - even optionally - with stuff like this? There's no need to d

Re: Python 3.7 configuration issue

2018-07-04 Thread Robin Becker
On 04/07/2018 05:59, dieter wrote: .. "libffi" contains the so called "foreign function interface" (an interface that allows code written in one language to call code written in another language). Likely, "ctypes" depends on it. Since some time, "ctypes" is part of Python's standard lib

Re: Congrats to Chris for breaking his PEP curse

2018-07-04 Thread Chris Angelico
On Wed, Jul 4, 2018 at 7:31 PM, Gregory Ewing wrote: > Ian Kelly wrote: >> >> I can't now write all my statements as: >> >> f(f := lambda f: do_something()) > > > No, but you should be able to do > >(f := lambda f: do_something())(f) > > although since you're binding f in a scope that can be s

Re: Congrats to Chris for breaking his PEP curse

2018-07-04 Thread Gregory Ewing
Ian Kelly wrote: I can't now write all my statements as: f(f := lambda f: do_something()) No, but you should be able to do (f := lambda f: do_something())(f) although since you're binding f in a scope that can be seen by the lambda, there's probably not much point in passing it, you could

Re: PEP 526 - var annotations and the spirit of python

2018-07-04 Thread Gregory Ewing
Ben Finney wrote: Abdur-Rahmaan Janhangeer writes: […] *cut at this point* Ooh, I like that last step! How do we make that happen on demand? You mention that Nazis ate fish. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: PEP 526 - var annotations and the spirit of python

2018-07-04 Thread Gregory Ewing
Grant Edwards wrote: On 2018-07-03, Dan Stromberg wrote: I used to write useful programs that ran in 256 bytes of RAM. Me too. The hex monitor I wrote for the keypad/display on my first computer fitted in 256 bytes. Which was important, seeing as the whole machine only had 1.5k. -- Greg -

Re: Multi-threading with a simple timer?

2018-07-04 Thread Gregory Ewing
Another way on unix that doesn't use signals: import select, sys print("Enter something: ", end = "") sys.stdout.flush() fds = select.select((0,), (), (), 5) if fds[0] == [0]: data = sys.stdin.readline() print("You entered:", data) else: print("Too late!") -- Greg -- https://mail.py

Re: Infinity [was Re: PEP 526 - var annotations and the spirit of python]

2018-07-04 Thread Chris Angelico
On Wed, Jul 4, 2018 at 3:37 PM, Steven D'Aprano wrote: > On Wed, 04 Jul 2018 12:31:16 +1000, Chris Angelico wrote: > > [...] >>> Ah, I see we're not going to leave it alone. In that case, >>> "indefinite" >>> is a "number", in that it was a quantity you cited along with the other >>> two. If you'

Re: Congrats to Chris for breaking his PEP curse

2018-07-04 Thread Steven D'Aprano
On Tue, 03 Jul 2018 23:05:01 -0600, Ian Kelly wrote: > Now that I've actually read the PEP (sorry, I just assumed it would > never fly), I have a couple of (tongue-in-cheek) observations about it: > >> group = re.match(data).group(1) if re.match(data) else None > > The only problem with this exa