Re: decorat{or,ion}

2018-05-18 Thread dieter
Mike McClain writes: > Let's say I want something that does most or all of foo's > functionality plus a little more and maybe tweek some of foo's > output, so I write a wrapper around foo and call it bar. > If inside bar are the call to foo, as well as methods baz(), > buz() and bug() that mak

Numpy array

2018-05-18 Thread Sharan Basappa
This is regarding numpy array. I am a bit confused how parts of the array are being accessed in the example below. 1 import scipy as sp 2 data = sp.genfromtxt("web_traffic.tsv", delimiter="\t") 3 print(data[:10]) 4 x = data[:,0] 5 y = data[:,1] Apparently, line 3 prints the first 10 entries in t

decorat{or,ion}

2018-05-18 Thread Mike McClain
Let's say I want something that does most or all of foo's functionality plus a little more and maybe tweek some of foo's output, so I write a wrapper around foo and call it bar. If inside bar are the call to foo, as well as methods baz(), buz() and bug() that make their magic and bar ends up pe

Re: what does := means simply?

2018-05-18 Thread Chris Angelico
On Sat, May 19, 2018 at 11:10 AM, bartc wrote: > On 19/05/2018 02:00, Steven D'Aprano wrote: >> >> On Fri, 18 May 2018 20:42:05 -0400, Dennis Lee Bieber wrote: >> >>> Unfortunately -- in the current era, "text" means "a defined >> >> encoding", >> >> Text has ALWAYS meant "a defined encodi

Re: what does := means simply?

2018-05-18 Thread bartc
On 19/05/2018 02:00, Steven D'Aprano wrote: On Fri, 18 May 2018 20:42:05 -0400, Dennis Lee Bieber wrote: Unfortunately -- in the current era, "text" means "a defined encoding", Text has ALWAYS meant "a defined encoding". It is just that for a long time, people could get away with assu

Re: what does := means simply?

2018-05-18 Thread bartc
On 19/05/2018 01:42, Dennis Lee Bieber wrote: On Fri, 18 May 2018 22:53:06 +0100, bartc declaimed the following: I've worked with text files for 40 years. Now Python is telling me I've been doing it wrong all that time! Look at the original code I posted from which this Python was based. Tha

Re: what does := means simply?

2018-05-18 Thread Steven D'Aprano
On Fri, 18 May 2018 20:42:05 -0400, Dennis Lee Bieber wrote: > Unfortunately -- in the current era, "text" means "a defined encoding", Text has ALWAYS meant "a defined encoding". It is just that for a long time, people could get away with assuming that the encoding they used was the *onl

Re: what does := means simply?

2018-05-18 Thread bartc
On 19/05/2018 01:00, Chris Angelico wrote: On Sat, May 19, 2018 at 7:53 AM, bartc wrote: I've worked with text files for 40 years. Now Python is telling me I've been doing it wrong all that time! Look at the original code I posted from which this Python was based. That creates a file - just a

Re: what does := means simply?

2018-05-18 Thread Steven D'Aprano
On Fri, 18 May 2018 22:53:06 +0100, bartc wrote: > I've worked with text files for 40 years. Now Python is telling me I've > been doing it wrong all that time! Welcome to the 20th Century! We interchange text and data with people from all over the world now, and one or two of them use characters

Re: what does := means simply?

2018-05-18 Thread Chris Angelico
On Sat, May 19, 2018 at 7:53 AM, bartc wrote: > I've worked with text files for 40 years. Now Python is telling me I've been > doing it wrong all that time! > > Look at the original code I posted from which this Python was based. That > creates a file - just a file - without worrying about whether

Re: syntax oddities

2018-05-18 Thread José María Mateos
On Fri, May 18, 2018 at 02:55:52PM +, Grant Edwards wrote: > You work someplace pretty unique. Everyplace I've worked has done the > whole top-posting and include the whole damn thread in reverse order > thing. It just doesn't work. The attached reverse-chronological > history doesn't seem t

Re: syntax oddities

2018-05-18 Thread José María Mateos
On Thu, May 17, 2018 at 07:56:41AM -0700, Rich Shepard wrote: > Allow me to add an additional reason for trimming and responding > beneath each quoted section: it puts the response in the proper > context. And another one I learned recently on a similar conversation on another mailing list (tha

Re: what does := means simply?

2018-05-18 Thread bartc
On 18/05/2018 19:57, Chris Angelico wrote: On Sat, May 19, 2018 at 4:48 AM, bartc wrote: The translation was straightforward, EXCEPT that I wasted an hour trying to figure out to write /a single byte/ to a file. The following eventually worked, using a binary file as a text one had Unicode prob

Re: what does := means simply?

2018-05-18 Thread bartc
On 18/05/2018 20:15, Alexandre Brault wrote: On 2018-05-18 02:48 PM, bartc wrote: Note this version doesn't use any imports at all. Except your version doesn't read its parameter from the command line args and doesn't output to standard output, which all of the others do. That's why the other

Re: About: from sklearn import linear_model ModuleNotFoundError: No module named sklearn

2018-05-18 Thread jladasky
On Thursday, May 17, 2018 at 4:54:11 AM UTC-7, Jpn Jha wrote: > Dear Team > Please attached Python_PyCharm Interpreter doc and zoom it . > > The screen shots are explanatory. The Python mailing list is text-only. Your screen shots were removed. In general, please don't use screenshots when as

Re: what does := means simply?

2018-05-18 Thread Alexandre Brault
On 2018-05-18 02:48 PM, bartc wrote: > On 18/05/2018 18:27, bartc wrote: > >> (BTW here's a port of that benchmark based on the Lua code: >> >>    https://pastebin.com/raw/ivDaKudX > > And here's the payoff: I was able to use this version to port it to > Python. One which works better the the origi

Re: what does := means simply?

2018-05-18 Thread Chris Angelico
On Sat, May 19, 2018 at 4:53 AM, bartc wrote: > On 18/05/2018 19:36, Chris Angelico wrote: >> >> On Sat, May 19, 2018 at 3:27 AM, bartc wrote: > > >> Once again, you're confusing *porting* with *emulating*. > > > This is the point. Those libraries are specific to Python and cannot be > ported. >

Re: what does := means simply?

2018-05-18 Thread Chris Angelico
On Sat, May 19, 2018 at 4:48 AM, bartc wrote: > The translation was straightforward, EXCEPT that I wasted an hour trying to > figure out to write /a single byte/ to a file. The following eventually > worked, using a binary file as a text one had Unicode problems, but it's > still hacky. You can't

Re: what does := means simply?

2018-05-18 Thread bartc
On 18/05/2018 19:36, Chris Angelico wrote: On Sat, May 19, 2018 at 3:27 AM, bartc wrote: Once again, you're confusing *porting* with *emulating*. This is the point. Those libraries are specific to Python and cannot be ported. And very often they don't just provide general support that ca

Re: what does := means simply?

2018-05-18 Thread bartc
On 18/05/2018 18:27, bartc wrote: (BTW here's a port of that benchmark based on the Lua code:   https://pastebin.com/raw/ivDaKudX And here's the payoff: I was able to use this version to port it to Python. One which works better the the originals, as they wrote output to the screen (/binar

Re: Fwd: sys module does not contain ps1

2018-05-18 Thread Terry Reedy
On 5/18/2018 7:40 AM, Alferdize wrote: -- Forwarded message -- From: Alferdize Date: Thu, May 17, 2018 at 10:13 PM Subject: sys module does not contain ps1 To: python-list@python.org It is giving error like I have given below import sys sys.ps1 Traceback (most recent call las

Re: what does := means simply?

2018-05-18 Thread Chris Angelico
On Sat, May 19, 2018 at 3:27 AM, bartc wrote: > On 18/05/2018 15:47, Chris Angelico wrote: >> >> On Sat, May 19, 2018 at 12:37 AM, bartc wrote: >>> >>> Have a look at some of the implementations here (to test some Mandelbrot >>> benchmark): >>> >>> >>> https://benchmarksgame-team.pages.debian.net

Re: what does := means simply?

2018-05-18 Thread bartc
On 18/05/2018 15:47, Chris Angelico wrote: On Sat, May 19, 2018 at 12:37 AM, bartc wrote: Have a look at some of the implementations here (to test some Mandelbrot benchmark): https://benchmarksgame-team.pages.debian.net/benchmarksgame/performance/mandelbrot.html The three Python examples all

Re: Fwd: sys module does not contain ps1

2018-05-18 Thread Chris Angelico
On Sat, May 19, 2018 at 2:51 AM, MRAB wrote: > I have the same version (Python 3.7.0b3). Here, sys has 'ps1' and 'ps2', but > not 'last_traceback', 'last_type' or 'last_value'. They aren't there till they're needed: $ python3 Python 3.8.0a0 (heads/literal_eval-exception:ddcb2eb331, Feb 21 2018,

css script project refractor code

2018-05-18 Thread Abdur-Rahmaan Janhangeer
i have a project at : README : https://github.com/Abdur-rahmaanJ/css-script/blob/master/README.md SITE : https://abdur-rahmaanj.github.io/css-script/ and i want to refractor the main file : https://github.com/Abdur-rahmaanJ/css-script/blob/master/css_script/main.py if this was an old project o

Re: Fwd: sys module does not contain ps1

2018-05-18 Thread MRAB
On 2018-05-18 12:40, Alferdize wrote: -- Forwarded message -- From: Alferdize Date: Thu, May 17, 2018 at 10:13 PM Subject: sys module does not contain ps1 To: python-list@python.org It is giving error like I have given below import sys sys.ps1 Traceback (most recent call last

Re: syntax oddities

2018-05-18 Thread Marko Rauhamaa
Grant Edwards : > And most people seem to believe that if they read more that the first > two sentences of any e-mail it might trigger the apocolypse or give > their cat scabies or something else dreadful. I quickly glance at the hundred or so subject lines every morning and open the one or two th

Re: syntax oddities

2018-05-18 Thread Chris Angelico
On Sat, May 19, 2018 at 1:09 AM, Richard Damon wrote: > If the thread forks, and someone is brought into one of the forks to > help with an issue brought up in THAT fork, then the context will > generally be sufficient for that. That assumes that they don't need any information that was posted in

Re: syntax oddities

2018-05-18 Thread Richard Damon
On 5/18/18 10:38 AM, Chris Angelico wrote: > On Sat, May 19, 2018 at 12:30 AM, Richard Damon > wrote: >> I would divide the two communities/cultures differently. Top Posting is >> reasonable, effective and common in an environment where the primary >> recipients of the message can be assumed to ha

Re: syntax oddities

2018-05-18 Thread Grant Edwards
On 2018-05-18, Steven D'Aprano wrote: > On Fri, 18 May 2018 13:25:52 +0100, Paul Moore wrote: > >> In "Corporate" cultures like where I work (where IT and business >> functions interact a lot, and business users typically use tools >> like Outlook) top-posting is common, conventional, and frankly,

Re: what does := means simply?

2018-05-18 Thread Chris Angelico
On Sat, May 19, 2018 at 12:37 AM, bartc wrote: > Have a look at some of the implementations here (to test some Mandelbrot > benchmark): > > https://benchmarksgame-team.pages.debian.net/benchmarksgame/performance/mandelbrot.html > > The three Python examples all use 'import sys' and 'import multipr

Re: what does := means simply?

2018-05-18 Thread bartc
On 18/05/2018 13:29, Steven D'Aprano wrote: On Fri, 18 May 2018 12:09:02 +0100, bartc wrote: On 18/05/2018 02:45, Steven D'Aprano wrote: On Fri, 18 May 2018 02:17:39 +0100, bartc wrote: Normally you'd use the source code as a start point. In the case of Python, that means Python source code.

Re: syntax oddities

2018-05-18 Thread Chris Angelico
On Sat, May 19, 2018 at 12:30 AM, Richard Damon wrote: > I would divide the two communities/cultures differently. Top Posting is > reasonable, effective and common in an environment where the primary > recipients of the message can be assumed to have read, and likely > remembered, the previous mes

Re: syntax oddities

2018-05-18 Thread Richard Damon
On 5/18/18 8:25 AM, Paul Moore wrote: > On 18 May 2018 at 12:08, Rhodri James wrote: > There are two completely independent cultures here. In "Corporate" > cultures like where I work (where IT and business functions interact a > lot, and business users typically use tools like Outlook) top-posting

Re: syntax oddities

2018-05-18 Thread Steven D'Aprano
On Fri, 18 May 2018 13:25:52 +0100, Paul Moore wrote: > In "Corporate" > cultures like where I work (where IT and business functions interact a > lot, and business users typically use tools like Outlook) top-posting is > common, conventional, and frankly, effective. I don't believe that email is

Fwd: sys module does not contain ps1

2018-05-18 Thread Alferdize
-- Forwarded message -- From: Alferdize Date: Thu, May 17, 2018 at 10:13 PM Subject: sys module does not contain ps1 To: python-list@python.org It is giving error like I have given below >>> import sys >>> sys.ps1 Traceback (most recent call last): File "", line 1, in sys.

Re: syntax oddities

2018-05-18 Thread Rhodri James
On 18/05/18 13:25, Paul Moore wrote: Arguing about how the community's conventions are wrong is also impolite:-) It's not an argument, it's a contradiction :-) I'm reminded of the old stereotypes of Brits speaking English NICE AND LOUDLY to foreigners to help them understand what we're saying

Re: what does := means simply?

2018-05-18 Thread Steven D'Aprano
On Fri, 18 May 2018 12:09:02 +0100, bartc wrote: > On 18/05/2018 02:45, Steven D'Aprano wrote: >> On Fri, 18 May 2018 02:17:39 +0100, bartc wrote: >> >>> Normally you'd use the source code as a start point. In the case of >>> Python, that means Python source code. But you will quickly run into >>

Re: syntax oddities

2018-05-18 Thread Paul Moore
On 18 May 2018 at 12:08, Rhodri James wrote: > On 17/05/18 23:44, Paul wrote: >> >> I've been using email for thirty years, including thousands of group >> emails >> at many tech companies, and no one has ever suggested, let alone insisted >> on, bottom posting. > > I've been using email for thirt

Re: syntax oddities

2018-05-18 Thread Ben Bacarisse
bartc writes: > On 17/05/2018 23:49, Chris Angelico wrote: >> On Fri, May 18, 2018 at 8:44 AM, Paul wrote: > >>> I've been using email for thirty years, including thousands of group emails >>> at many tech companies, and no one has ever suggested, let alone insisted >>> on, bottom posting. If s

Re: what does := means simply?

2018-05-18 Thread Ned Batchelder
On 5/18/18 7:09 AM, bartc wrote: On 18/05/2018 02:45, Steven D'Aprano wrote: On Fri, 18 May 2018 02:17:39 +0100, bartc wrote: Normally you'd use the source code as a start point. In the case of Python, that means Python source code. But you will quickly run into problems because you will often

Re: syntax oddities

2018-05-18 Thread Chris Angelico
On Fri, May 18, 2018 at 9:29 PM, bartc wrote: > On 17/05/2018 23:49, Chris Angelico wrote: >> >> On Fri, May 18, 2018 at 8:44 AM, Paul wrote: > > >>> I've been using email for thirty years, including thousands of group >>> emails >>> at many tech companies, and no one has ever suggested, let alon

Re: syntax oddities

2018-05-18 Thread bartc
On 17/05/2018 23:49, Chris Angelico wrote: On Fri, May 18, 2018 at 8:44 AM, Paul wrote: I've been using email for thirty years, including thousands of group emails at many tech companies, and no one has ever suggested, let alone insisted on, bottom posting. If someone's late to a thread they

Re: what does := means simply?

2018-05-18 Thread bartc
On 18/05/2018 02:45, Steven D'Aprano wrote: On Fri, 18 May 2018 02:17:39 +0100, bartc wrote: Normally you'd use the source code as a start point. In the case of Python, that means Python source code. But you will quickly run into problems because you will often see 'import lib' and be unable to

Re: syntax oddities

2018-05-18 Thread Rhodri James
On 17/05/18 23:44, Paul wrote: I've been using email for thirty years, including thousands of group emails at many tech companies, and no one has ever suggested, let alone insisted on, bottom posting. I've been using email for thirty years, etc, etc, and I've always insisted on proper quoting,

Re: what does := means simply?

2018-05-18 Thread Rhodri James
On 18/05/18 02:45, Steven D'Aprano wrote: To successful port anything but the most trivial code, you actually have to understand *both* languages -- including the syntax, semantics, built- in language features, AND libraries. A point that was once made to me about translating human languages is