Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Gregory Ewing
Chris Angelico wrote: Question: How do you get a reference to a Ruby function? Or are they not first-class objects? They're not first-class. So, you can't. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: A question related to the PYTHONPATH

2018-03-26 Thread oyono
Le mardi 27 mars 2018 07:42:57 UTC+2, dieter a écrit : > oyono writes: > > ... > > I was thinking, maybe it could have been done this way to enforce not > > running module files that are supposed to be bundled into packages as > > "independant" python scripts...Therefore, running "python script.

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Gregory Ewing
Ned Batchelder wrote: "Ranting Rick" isn't trying to enlighten, educate, or learn. He's trying to rile people up, and he is good at it. I don't think he's even trying, it just come naturally to him. Rick rants the way wind blows and water wets. -- Greg -- https://mail.python.org/mailman/listi

To super or not to super (Re: Accessing parent objects)

2018-03-26 Thread Gregory Ewing
The idea that super() is *always* the right way to call inherited methods in a multiple inheritance environment seems to have been raised by some people to the level of religous dogma. I don't buy it. In order for it to work, the following two conditions must hold: 1) All the methods involved ha

Re: Invoke an independent, non-blocking process from Python 3.6?

2018-03-26 Thread Chris Angelico
On Tue, Mar 27, 2018 at 2:32 PM, wrote: > On Monday, March 26, 2018 at 5:45:40 PM UTC-7, Chris Angelico wrote: >> On Tue, Mar 27, 2018 at 11:18 AM, wrote: >> > I have used multiprocessing before when I wrote some parallelized code. >> > That program required significant communication between

Re: A question related to the PYTHONPATH

2018-03-26 Thread dieter
oyono writes: > ... > I was thinking, maybe it could have been done this way to enforce not running > module files that are supposed to be bundled into packages as "independant" > python scripts...Therefore, running "python script.py" should be reserved to > effectively independant python scrip

Re: Entering a very large number

2018-03-26 Thread Richard Damon
On 3/26/18 8:46 AM, bartc wrote: On 26/03/2018 13:30, Richard Damon wrote: On 3/26/18 6:31 AM, bartc wrote: The purpose was to establish how such int("...") conversions compare in overheads with actual arithmetic with the resulting numbers. Of course if this was done in C with a version tha

Re: Invoke an independent, non-blocking process from Python 3.6?

2018-03-26 Thread jladasky
On Monday, March 26, 2018 at 5:45:40 PM UTC-7, Chris Angelico wrote: > On Tue, Mar 27, 2018 at 11:18 AM, wrote: > > I have used multiprocessing before when I wrote some parallelized code. > > That program required significant communication between processes, and it's > > overkill for my purpos

Re: issues when buidling python3.* on centos 7

2018-03-26 Thread Michael Torrie
On 03/25/2018 10:15 AM, joseph pareti wrote: > The following may give a clue because of inconsistent python versions: > > [joepareti54@xxx ~]$ python -V > Python 3.5.2 :: Anaconda 4.3.0 (64-bit) What does 'which python' return? As Joseph said, hopefully you didn't overwrite /usr/bin/python with

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Rick Johnson
On Monday, March 26, 2018 at 6:11:31 PM UTC-5, Python wrote: > On Mon, Mar 26, 2018 at 02:19:12PM -0700, Rick Johnson wrote: [...] > > Hmm. If "syntax parser rules" could prevent poorly > > formatted code, then there'd be no need for style guides. > > It may be telling that my team has minimal styl

Re: Invoke an independent, non-blocking process from Python 3.6?

2018-03-26 Thread Chris Angelico
On Tue, Mar 27, 2018 at 11:18 AM, wrote: > I have used multiprocessing before when I wrote some parallelized code. That > program required significant communication between processes, and it's > overkill for my purpose here. I don't need communication between the > spawning (live data) progr

RE: issues when buidling python3.* on centos 7

2018-03-26 Thread Joseph L. Casale
-Original Message- From: Python-list On Behalf Of joseph pareti Sent: Sunday, March 25, 2018 10:15 AM To: python-list@python.org Subject: issues when buidling python3.* on centos 7 > The following may give a clue because of inconsistent python versions: > > [joepareti54@xxx ~]$ python -V

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Chris Angelico
On Tue, Mar 27, 2018 at 10:10 AM, Python wrote: > Ruby touts itself as being a simple language with elegant syntax. > This thread is my only exposure to it to date, but what I've seen here > is, frankly, the exact opposite of that. You should not need a map to > distinguish function calls from va

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Ned Batchelder
On 3/26/18 7:10 PM, Python wrote: Humans are already good enough at making mistakes that they require no additional encouragement, such as what is provided by allowing such syntactical horrors. Agreed. And that's why we must respect and follow the code styling wisdom which has been passed down b

Invoke an independent, non-blocking process from Python 3.6?

2018-03-26 Thread jladasky
Hi folks, I've run into an odd situation. I have a custom USB peripheral device which generates real-time data. I monitor this device using a PyQt5 app that I wrote. Periodically I want to capture some of this data in files. Because of a transient OS bug which apparently involves a corner c

Re: String Formatting with new .format()

2018-03-26 Thread W Yg
在 2018年3月26日星期一 UTC+8下午11:37:46,Ganesh Pal写道: > Hi Team, > > Just a quick suggestion, on string formatting with .format() which of the > below is better , given both give the same result . > > >>> attempts = 1 > >>> msg2 = "Hello" > >>> print "Retry attempt:{0} for error:{1}".format(attempts,msg2

Re: A question related to the PYTHONPATH

2018-03-26 Thread oyono
Le lundi 26 mars 2018 08:11:02 UTC+2, dieter a écrit : > adrien oyono writes: > > I have recently read the documentation about how imports work on python, > > and I was wondering why, when you execute a python file, the current > > directory is not added by default to the PYTHONPATH ? > > Maybe,

Fw: Fwd: Welcome to the "Python-list" mailing list

2018-03-26 Thread nadir musallam
Dear All, I have tried installing Python3.6.4 on my computer as I am eager to begin a new career in data analytics. However I am running in to some problems when attempting to set up the software. I have downloaded Dev C++ software as per your recommendation earlier but still getting the same

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Python
On Mon, Mar 26, 2018 at 02:19:12PM -0700, Rick Johnson wrote: > On Monday, March 26, 2018 at 3:09:38 PM UTC-5, Python wrote: > > On Mon, Mar 26, 2018 at 11:37:35AM -0700, Rick Johnson wrote: > [...] > > > Ruby followed the rules. > > > But you didn't. > > > > Nonsense... Your language's syntax pars

Fwd: Fwd: ftplib sending data out of order

2018-03-26 Thread Charles Wilt
Just to close out this thread in case anybody finds it... We're reasonably sure the issue was cause by version 14.6 MP1 of Symantec Vontu; which is a Data Loss Prevention (DLP) product that "inspects" packets before they leave the PC. I believe the issue was reported to Symantec. In the meantime

please test the new PyPI (now in beta)

2018-03-26 Thread Sumana Harihareswara
The new Python Package Index at https://pypi.org is now in beta. This means the site is robust, but we anticipate needing more user testing and changes before it is "production-ready" and can fully replace https://pypi.python.org . We hope to complete the transition before the end of April 2018.

Re: [OT] multicore/cpu history

2018-03-26 Thread Gene Heskett
On Monday 26 March 2018 12:12:46 Dennis Lee Bieber wrote: > On Mon, 26 Mar 2018 11:30:54 -0400, Gene Heskett > > > declaimed the following: > >On Monday 26 March 2018 10:06:36 Dennis Lee Bieber wrote: > > > > >>As I recall, the bootloader on the Raspberry Pi runs on the > >> graphics p

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Rick Johnson
On Monday, March 26, 2018 at 3:09:38 PM UTC-5, Python wrote: > On Mon, Mar 26, 2018 at 11:37:35AM -0700, Rick Johnson wrote: [...] > > Ruby followed the rules. > > But you didn't. > > Nonsense... Your language's syntax parser is what defines > the rules. All of the expressions Stephen wrote did not

Re: Entering a very large number

2018-03-26 Thread Christian Gollwitzer
Am 26.03.18 um 12:31 schrieb bartc: On 26/03/2018 10:34, Steven D'Aprano wrote: So what exactly did you do? I did this: def fn():     C = int(     "28871482380507712126714295971303939919776094592797"     "22700926516024197432303799152733116328983144639225"     "941977803110929349655578418

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Python
On Mon, Mar 26, 2018 at 11:37:35AM -0700, Rick Johnson wrote: > > Because of this "fix", the printed strings no longer match > > the code being executed, but the strange, inconsistent > > behaviour still occurs. > > The supposed "inconsistent behavior" here has absolutely > nothing to do with Ruby

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Chris Angelico
On Tue, Mar 27, 2018 at 5:37 AM, Rick Johnson wrote: > The supposed "inconsistent behavior" here has absolutely > nothing to do with Ruby, no, it's all on _you_. _YOU_ are > the one who created a non-sensical function with a single > char name; and _YOU_ are the one who placed a call to that > fun

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Python
On Mon, Mar 26, 2018 at 10:43:32AM +, Steven D'Aprano wrote: > The kicker is that out of these four legal, parenthesis-free ways of > calling function a, *three* of them interpret the expression as: > > call a with no arguments > then add b using the binary plus operator > > but the

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Python
On Sun, Mar 25, 2018 at 10:33:49AM -0700, Rick Johnson wrote: > > [steve@ando ruby]$ ruby ws-example.rb > > a + b => 7 > > a+b => 7 > > a+ b => 7 > > a +b => 3 > > > > Here's the source code: > > > > # --- cut --- > > def a(x=4) > > x+2 > > end > > > > b = 1 > > print "a + b => ", (a + b),

Re: A question related to the PYTHONPATH

2018-03-26 Thread Ian Kelly
On Mon, Mar 26, 2018 at 1:24 PM, Dan Stromberg wrote: > On Sun, Mar 25, 2018 at 11:10 PM, dieter wrote: >> adrien oyono writes: >>> I have recently read the documentation about how imports work on python, >>> and I was wondering why, when you execute a python file, the current >>> directory is n

Re: A question related to the PYTHONPATH

2018-03-26 Thread Dan Stromberg
On Sun, Mar 25, 2018 at 11:10 PM, dieter wrote: > adrien oyono writes: >> I have recently read the documentation about how imports work on python, >> and I was wondering why, when you execute a python file, the current >> directory is not added by default to the PYTHONPATH ? > > Maybe, to avoid s

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Rick Johnson
On Monday, March 26, 2018 at 5:46:03 AM UTC-5, Steven D'Aprano wrote: > Rick, you're supposedly familiar with Ruby. And yet, you > didn't notice that your supposed "fix" didn't touch any > executable code, all it did was modify the strings being > printed. Because the goal was to *UN-OBFUSCATE* th

Re: Pip Version Confusion

2018-03-26 Thread Rob Gaddi
On 03/24/2018 08:40 AM, Tim Johnson wrote: I'm on Ubuntu 16.04. I'm getting the following message from pip: You are using pip version 8.1.1, however version 9.0.3 is available. You should consider upgrading via the 'pip install --upgrade pip' command. # But then I get this : tim@linus:~/Downlo

Re: Getting "LazyImporter' object is not callable" error when trying to send email using python smtplib

2018-03-26 Thread Sum
Thanks Steve for your inputs. Now I am able to run the code successfully. # Made changes to import statements as below: from email.mime.base import MIMEBase from email.mime.text import MIMEText Apologies for the typo and indentation error in above mail. Regards, Sumit On Mon,

Re: String Formatting with new .format()

2018-03-26 Thread Chris Angelico
On Tue, Mar 27, 2018 at 2:37 AM, Ganesh Pal wrote: > Hi Team, > > Just a quick suggestion, on string formatting with .format() which of the > below is better , given both give the same result . > attempts = 1 msg2 = "Hello" print "Retry attempt:{0} for error:{1}".format(attempts,msg

Re: [OT] multicore/cpu history

2018-03-26 Thread Gene Heskett
On Monday 26 March 2018 10:06:36 Dennis Lee Bieber wrote: > On Mon, 26 Mar 2018 10:02:15 + (UTC), Steven D'Aprano > > declaimed the following: > >Hardware people can probably tell you what it is that CPUs do that > > FPUs and GPUs don't do. Or specialised Bitcoin mining chips. > > Whatever it

String Formatting with new .format()

2018-03-26 Thread Ganesh Pal
Hi Team, Just a quick suggestion, on string formatting with .format() which of the below is better , given both give the same result . >>> attempts = 1 >>> msg2 = "Hello" >>> print "Retry attempt:{0} for error:{1}".format(attempts,msg2) Retry attempt:1 for error:Hello OR >>> attempts = 1 >>> ms

Re: Entering a very large number

2018-03-26 Thread Chris Angelico
On Mon, Mar 26, 2018 at 11:46 PM, bartc wrote: > On 26/03/2018 13:30, Richard Damon wrote: >> >> On 3/26/18 6:31 AM, bartc wrote: > > >>> The purpose was to establish how such int("...") conversions compare in >>> overheads with actual arithmetic with the resulting numbers. >>> >> Of course if thi

Synthesize a new series

2018-03-26 Thread qrious
I have a set of series of numbers. The set bears some common property about the series. For example, in one case, Series 1 can be the set of random number of odd numbers starting from 1 and Series N can be the set of random number of odd numbers starting from N. In another case, Series 1 can b

Re: Entering a very large number

2018-03-26 Thread Joe Pfeiffer
Steven D'Aprano writes: > On Mon, 26 Mar 2018 02:37:44 +0100, bartc wrote: > >> If I instead initialise C using 'C = int("288712...")', then timings >> increase as follows: > > Given that the original number given had 397 digits and has a bit length > of 1318, I must admit to some curiosity as t

Re: Using object as a class

2018-03-26 Thread Steven D'Aprano
On Mon, 26 Mar 2018 07:31:06 -0500, D'Arcy Cain wrote: > Is this behaviour (object not quite like a class) documented anywhere? It's exactly like a class. It's an immutable class. You are making assumptions about what classes must be able to do. > Does anyone know the rationale for this if any

Re: Using object as a class

2018-03-26 Thread Paul Moore
In fact, object acts just like a user-defined class, with __slots__ set to empty: >>> class MyObj(object): ... __slots__ = () ... >>> o = MyObj() >>> o.x = 3 Traceback (most recent call last): File "", line 1, in AttributeError: 'MyObj' object has no attribute 'x' See https://docs.python.o

Re: Entering a very large number

2018-03-26 Thread bartc
On 26/03/2018 13:30, Richard Damon wrote: On 3/26/18 6:31 AM, bartc wrote: The purpose was to establish how such int("...") conversions compare in overheads with actual arithmetic with the resulting numbers. Of course if this was done in C with a version that had builtin bignum ints or an a

Re: Entering a very large number

2018-03-26 Thread Steven D'Aprano
On Mon, 26 Mar 2018 11:45:33 +0100, bartc wrote: > Similar overheads occur when you use string=>int even on small numbers: > > This code: > > C = int("12345") > D = C+C # or C*C; about the same results > > takes 5 times as long (using my CPython 3.6.x on Windows) as: > > C

Re: Getting "LazyImporter' object is not callable" error when trying to send email using python smtplib

2018-03-26 Thread Steven D'Aprano
On Mon, 26 Mar 2018 16:47:26 +0530, Sum wrote: > Hi, > > Getting "LazyImporter' object is not callable" error. I have enabled > allow less secure app setting in sender gmail. > > Code : The code you show is not the same as the code you are actually running. The error message you give says: Fi

Using object as a class

2018-03-26 Thread D'Arcy Cain
It's called a super class but it doesn't quite work like a normal class. >>> OBJ = object() >>> OBJ.x = 3 Traceback (most recent call last): File "", line 1, in AttributeError: 'object' object has no attribute 'x' I can fix this by creating a NULL class. >>> class NullObject(object): pass ...

Re: Entering a very large number

2018-03-26 Thread Richard Damon
On 3/26/18 6:31 AM, bartc wrote: On 26/03/2018 10:34, Steven D'Aprano wrote: On Mon, 26 Mar 2018 02:37:44 +0100, bartc wrote: If I instead initialise C using 'C = int("288712...")', then timings increase as follows: Given that the original number given had 397 digits and has a bit length of

Re: Entering a very large number

2018-03-26 Thread Richard Damon
On 3/26/18 6:45 AM, bartc wrote: On 26/03/2018 03:35, Richard Damon wrote: On 3/25/18 9:37 PM, bartc wrote: So the overhead /can/ be substantial, and /can/ be significant compared with doing bignum calculations. Of course, once initialised, C might be used a hundred times, then the overhea

Re: Entering a very large number

2018-03-26 Thread Steven D'Aprano
On Mon, 26 Mar 2018 11:31:22 +0100, bartc wrote: > On 26/03/2018 10:34, Steven D'Aprano wrote: >> So what exactly did you do? > > I'm not sure why you think the language C came into it. My misunderstanding. Sorry. -- Steve -- https://mail.python.org/mailman/listinfo/python-list

Getting "LazyImporter' object is not callable" error when trying to send email using python smtplib

2018-03-26 Thread Sum
Hi, Getting "LazyImporter' object is not callable" error. I have enabled allow less secure app setting in sender gmail. Code : import smtplib from email import MIMEBase from email import MIMEText from email.mime.multipart import MIMEMultipart from email import Encoders import os def send_email(

Re: Accessing parent objects

2018-03-26 Thread Antoon Pardon
On 26-03-18 10:52, Ben Finney wrote: > Antoon Pardon writes: > >> But did they start up cleaning the standard library yet? I'll confess >> I'm only using 3.5 but when I go through the standard library I see a >> lot of classes still using the old style of calling the parant method, >> which makes

Re: Entering a very large number

2018-03-26 Thread bartc
On 26/03/2018 03:35, Richard Damon wrote: On 3/25/18 9:37 PM, bartc wrote: So the overhead /can/ be substantial, and /can/ be significant compared with doing bignum calculations. Of course, once initialised, C might be used a hundred times, then the overhead is less significant. But it is n

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Steven D'Aprano
On Sun, 25 Mar 2018 19:16:12 -0700, Rick Johnson wrote: > On Sunday, March 25, 2018 at 5:57:28 PM UTC-5, Steven D'Aprano wrote: > >> [supposed "fix" to the sample script snipped] >> >> You know Rick, every time I start to think that talking to you like an >> adult might result in a productive and

Re: Entering a very large number

2018-03-26 Thread bartc
On 26/03/2018 10:34, Steven D'Aprano wrote: On Mon, 26 Mar 2018 02:37:44 +0100, bartc wrote: If I instead initialise C using 'C = int("288712...")', then timings increase as follows: Given that the original number given had 397 digits and has a bit length of 1318, I must admit to some curios

Re: Accessing parent objects

2018-03-26 Thread Steven D'Aprano
On Mon, 26 Mar 2018 10:43:25 +0200, Antoon Pardon wrote: > But did they start up cleaning the standard library yet? I'll confess > I'm only using 3.5 but when I go through the standard library I see a > lot of classes still using the old style of calling the parant method, > which makes it more di

Re: [OT] multicore/cpu history

2018-03-26 Thread Steven D'Aprano
On Mon, 26 Mar 2018 10:03:43 +1100, Chris Angelico wrote: > At what point does it change from being two CPUs to being one CPU and > one auxiliary processing unit? When someone writes an OS that will run on the "auxiliary processing unit" alone, then it's probably time to start calling it a CPU :

Re: Accessing parent objects

2018-03-26 Thread Steven D'Aprano
On Mon, 26 Mar 2018 10:02:23 +0200, Antoon Pardon wrote: >> The trick is to use new-style classes that inherit from object, and >> avoid the old-style classes that don't: >> >> # Good >> class Spam(object): >> ... >> >> # Not so good >> class Spam: >> ... > > How good is that when almost

Re: Entering a very large number

2018-03-26 Thread Steven D'Aprano
On Mon, 26 Mar 2018 02:37:44 +0100, bartc wrote: > Calling a function that sets up C using 'C = 288714...' on one line, and > that then calculates D=C+C, takes 0.12 seconds to call 100 times. > > To do D=C*C, takes 2.2 seconds (I've subtracted the function call > overhead of 0.25 seconds; the

Re: Accessing parent objects

2018-03-26 Thread Ben Finney
Antoon Pardon writes: > But did they start up cleaning the standard library yet? I'll confess > I'm only using 3.5 but when I go through the standard library I see a > lot of classes still using the old style of calling the parant method, > which makes it more difficult to use in a multiple inher

Re: Accessing parent objects

2018-03-26 Thread Antoon Pardon
On 25-03-18 06:29, Steven D'Aprano wrote: > Python 3 is now six point releases in (and very soon to have a seventh, > 3.7 being in beta as we speak). It is stable, feature-rich, and a joy to > work in. As well as a heap of great new features, there have been a > metric tonne of performance improv

Re: Accessing parent objects

2018-03-26 Thread Ben Finney
Antoon Pardon writes: > On 25-03-18 00:54, Steven D'Aprano wrote: > > The trick is to use new-style classes that inherit from object, and > > avoid the old-style classes that don't: > > > > # Good > > class Spam(object): > > ... > > > > # Not so good > > class Spam: > > ... > > How good i

Re: Accessing parent objects

2018-03-26 Thread Antoon Pardon
On 25-03-18 00:54, Steven D'Aprano wrote: > > There's nothing wrong with super() in Python 2. You just have to > understand what you're doing. It's still the right solution for doing > inheritance the right way. > > ... > > The trick is to use new-style classes that inherit from object, and avo