Re: Invoking return through a function?

2017-10-29 Thread Rick Johnson
On Sunday, October 29, 2017 at 9:19:03 AM UTC-5, Alberto Riva wrote: > Hello, > > I'm wondering if there is a way of writing a function that > causes a return from the function that called it. To > explain with an example, let's say that I want to exit my > function if a dict does not contain a gi

Re: Invoking return through a function?

2017-10-29 Thread Rick Johnson
Alberto Riva wrote: > Rick Johnson wrote: > > Alberto Riva wrote: [...] > >> In a language like Lisp > > > > Python is nothing like Lisp, and for good reason! > > I would disagree with this. Actually, it's the most Lisp- > like language I've

Re: Invoking return through a function?

2017-10-29 Thread Rick Johnson
Alberto Riva wrote: > Rick Johnson wrote: > > Alberto Riva wrote: > >> Rick Johnson wrote: > >>> Alberto Riva wrote: > > [...] > > > > > > > > > > In a language like Lisp > > > > > > > > Python is noth

Re: Invoking return through a function?

2017-10-30 Thread Rick Johnson
Steve D'Aprano wrote: > > [...] > > I suppose it wouldn't be too awful if macros required > dedicated syntax, so at least you could distinguish between > "this is a safe, ordinary function" and "this is a macro, > it could mean anything". In the same spirit, i've been trying in vain for *YEARS*

Re: The syntax of replacement fields in format strings

2017-10-31 Thread Rick Johnson
On Tuesday, October 31, 2017 at 1:35:33 PM UTC-5, John Smith wrote: > If we keep the current implementation as is, perhaps the > documentation should at least be altered ? You should supply a concise code example that showcases why _you_ feel the docs are not satisfactory. It would help. -- https

Re: How to modify this from Python 2.x to v3.4?

2017-11-11 Thread Rick Johnson
On Saturday, November 11, 2017 at 8:07:06 PM UTC-6, [email protected] wrote: [...] > By the way, does anyone know what the following codes does? > (in printer.py file) and how to convert it to v3.x? > > class WrapperPrinter: > def __init__(self,outpath,options,data): > ... >

Re: from xx import yy

2017-11-13 Thread Rick Johnson
On Sunday, November 12, 2017 at 8:18:04 PM UTC-6, bvdp wrote: > I'm having a conceptual mind-fart today. I just modified a bunch of code to > use "from xx import variable" when variable is a global in xx.py. But, when I > change/read 'variable' it doesn't appear to change. I've written a bit of

Re: from xx import yy

2017-11-13 Thread Rick Johnson
On Monday, November 13, 2017 at 10:59:06 AM UTC-6, bvdp wrote: > Thanks all for confirming that I was wrong to use "from .. > import". In this case, but i wouldn't extrapolate that advice to mean that the form `from X import Y` is _always_ bad. You just need to understand the consequences of each

Re: matchpy

2017-11-13 Thread Rick Johnson
Chris Angelico wrote: > Edward Montague wrote: > > After successfully installing python 3.6.3 and the > > appropriate version of IDLE , I attempted to run a matchpy > > example , to no avail . I'm using a debian distribution , > > 8.x or greater , is there something I need to be aware of > > . The

Re: ANN: obfuscate 0.2.2

2017-11-13 Thread Rick Johnson
On Monday, November 13, 2017 at 6:03:23 PM UTC-6, [email protected] wrote: > for importing obfuscate do we just type in import obfuscate > or import obfuscate 0.2.2 Oh boy. I had forgotten about this little community "gem" dating back to 2010. And unfortunately for comrade Steven, there is no way

Re: Time travel - how to simplify?

2017-11-14 Thread Rick Johnson
On Tuesday, November 14, 2017 at 1:44:17 PM UTC-6, Ben Finney wrote: > Andrew Z writes: > > > Now i want to get certain number of months. Say, i need 3 months duration > > starting from any month in dict. > > > > so if i start @ 7th: > > my_choice =7 > > for mnth, value in fut_suffix: > > i

Re: Artificial creating of [Lists], is it possible? the best way...

2017-11-17 Thread Rick Johnson
On Thursday, November 16, 2017 at 12:48:05 PM UTC-6, Jakub Raj ok wrote: > Artificial creating of [Lists], is it possible? the best way... There is nothing "artificial" about creating any object. Much less python lists. And i believe the usage of such word in the title of this thread was unfortun

Re: How to Generate dynamic HTML Report using Python

2017-11-21 Thread Rick Johnson
On Tuesday, November 21, 2017 at 5:57:42 AM UTC-6, Ned Batchelder wrote: [...] > [...] > I don't understand the motivation for limiting how words > are distributed, but others on this list also do it. For > example, Dennis Lee Bieber's messages are not in the > Python-List archives either. I call

Re: Student can't get if elif final statement to print for discussion post for python

2017-11-22 Thread Rick Johnson
Richard Damon wrote: > Cheri Castro wrote: > > I've tried several variations but haven't been able to > > figure out why my final if elif statement won't print. I > > tried using return, I tried using 1's and 0's rather than > > yes and no. Not sure what the issue is. Please, help. > > > > > > #Thi

Re: How to Generate dynamic HTML Report using Python

2017-11-22 Thread Rick Johnson
Chris Angelico wrote: > Gregory Ewing > > > > It looks like I'm going to have to filter Mr. Ram's posts > > out of my usenet feed as well, lest I accidentally show > > one of his URIs as a link on my screen. > > Or, just ignore his copyright altogether, and let him prove > its defensibility in co

Re: Increasing the diversity of people who write Python (was: Benefits of unicode identifiers)

2017-11-24 Thread Rick Johnson
On Thursday, November 23, 2017 at 9:57:12 PM UTC-6, Ben Finney wrote: [...] > This is a necessary consequence of increasing the diversity > of people able to program in Python: people will express > ideas originating in their own language, in Python code. > For that diversity to increase, we Englis

Re: Benefits of unicode identifiers (was: Allow additional separator in identifiers)

2017-11-24 Thread Rick Johnson
On Thursday, November 23, 2017 at 3:06:00 PM UTC-6, Chris Angelico wrote: > Seriously? Do I need to wrench this part out of you? This > was supposed to be the EASY question that everyone can > agree on, from which I can then draw my line of argument. Translation: "Dag-nab-it! You're supposed

Re: How to use a regexp here

2017-12-04 Thread Rick Johnson
Cecil Westerhof wrote: > Joel Goldstick writes: [...] > > I like Ned's clear answer, but I'm wondering why the > > original code would fail because the substring is at the > > start of the line, since 'in' would still be true no > > matter where the desired string is placed. It would be > >

Re: Please tell me how to execute python file in Ubuntu by double clicking on file.

2017-12-04 Thread Rick Johnson
On Monday, December 4, 2017 at 3:49:11 AM UTC-6, [email protected] wrote: > I am Dhananjay Singh,Student of IIIT Manipur. Sir/Mam when > i am double click in python program (Dhananjay.py),it is > opening in Text Editor by Default in Ubuntu.I want to run > this program when i double click on i

Re: why won't slicing lists raise IndexError?

2017-12-04 Thread Rick Johnson
On Monday, December 4, 2017 at 1:10:01 PM UTC-6, Jason Maldonis wrote: > I was extending a `list` and am wondering why slicing lists will never > raise an IndexError, even if the `slice.stop` value if greater than the > list length. > > Quick example: > > my_list = [1, 2, 3] > my_list[:100] # does

Re: why won't slicing lists raise IndexError?

2017-12-04 Thread Rick Johnson
Terry Reedy wrote: [...] > try: > item = seq[n] > except IndexError > do_without_item() > else: > process(item) > > item = seq[n:n+1] > if item: > process(item) > else: > do_without_item() > > Many prefer the second. And they'll prefer it even more when they real

Re: why won't slicing lists raise IndexError?

2017-12-04 Thread Rick Johnson
Chris Angelico wrote: > wrote: > > Terry Reedy wrote: > > > > [...] > > > >> try: > >> item = seq[n] > >> except IndexError > >> do_without_item() > >> else: > >> process(item) > >> > >> item = seq[n:n+1] > >> if item: > >> process(item) > >> else: > >> do_without_item() >

Re: why won't slicing lists raise IndexError?

2017-12-04 Thread Rick Johnson
On Monday, December 4, 2017 at 6:13:19 PM UTC-6, Chris Angelico wrote: [...] > Ahhh, I see how it is. You didn't run the code, ergo you > don't understand it. Makes perfect sense. :) Being that Terry didn't offer any declarations or defintions for his variables or functions, i assumed,

Re: why won't slicing lists raise IndexError?

2017-12-04 Thread Rick Johnson
On Monday, December 4, 2017 at 7:47:20 PM UTC-6, Ned Batchelder wrote: [...] > Here are details filled in: > > $ python3.6 > Python 3.6.3 (default, Oct 4 2017, 06:03:25) > [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin > Type "help", "copyright", "credits

Re: why won't slicing lists raise IndexError?

2017-12-04 Thread Rick Johnson
Ned Batchelder wrote: [...] > The point of the example was to demonstrate what happens > when slicing beyond the bounds of the list. It's beyond > the scope of the thread to debate whether you might want to > perform an action in that case. But, nevertheless, the else-clause is there! And th

Re: why won't slicing lists raise IndexError?

2017-12-05 Thread Rick Johnson
Ned Batchelder wrote: [...] > Your original statement sounded like, "The else clause can > never be executed," No. Of course not. Note that i mentioned _pragmatism_. My complaint about the else-clause was not that it could _never_ be executed, my complaint that was that the else- clause (in Terry

Re: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)

2017-12-05 Thread Rick Johnson
On Tuesday, December 5, 2017 at 2:58:44 AM UTC-6, Lawrence D'Oliveiro wrote: > On Tuesday, December 5, 2017 at 3:39:26 AM UTC+13, Rick Johnson wrote: > > > > Sounds like your OS file associations are all botched-up ... > > Linux doesn't do "OS file associations

Re: why won't slicing lists raise IndexError?

2017-12-05 Thread Rick Johnson
Steve D'Aprano wrote: [...] > You've already been told that there's no indication or > reason to believe that it is a non-action. You've already > been given at least one possible action. It isn't a non- > action, it is two distinct actions: > > - the action you take when the slice is non-empty;

Re: we want python software

2017-12-06 Thread Rick Johnson
On Wednesday, December 6, 2017 at 2:14:40 AM UTC-6, Percival John Hackworth wrote: [...] > [...] > The good people (e.g. the friends I asked for advice) are > to busy to do such little projects to bother. Good work is not cheap. And cheap work is not good. > So the market is left with Junior p

Re: we want python software

2017-12-06 Thread Rick Johnson
On Wednesday, December 6, 2017 at 12:11:47 AM UTC-6, Chris Angelico wrote: [...] > To the OP: [...] The best thing to do here is to type > "python" into your favourite search engine (Google, > DuckDuckGo, Bing, AltaVista, etc), and then read the web > page for a download link. I don't think

Re: Politeness (was: we want python software)

2017-12-06 Thread Rick Johnson
Steve D'Aprano wrote: [...] > And yes, I'm aware of the irony of me taking this position > only a couple of posts after I asked the group to run some > code for me without explaining why I couldn't run it > myself.[1] [...] But if somebody wants to take me to task > for Your virtue signaling he

Re: why won't slicing lists raise IndexError?

2017-12-06 Thread Rick Johnson
On Wednesday, December 6, 2017 at 3:13:41 PM UTC-6, Python wrote: [...] > Geez, seriously? The snippet is purely academic, obviously > not a complete or useful program, Who ever made the claim that it was? > intended to illustrate that python can take two different > branches depending on whethe

Re: why won't slicing lists raise IndexError?

2017-12-06 Thread Rick Johnson
Terry Reedy wrote: [...] > Rick, cut the crap. If you do not understand that > 'something_else()' != 'pass', re-read the tutorial. How is the official tutorial going to give me any insight into an undefined symbol that you invented? Of course, we all understand

Re: why won't slicing lists raise IndexError?

2017-12-06 Thread Rick Johnson
Python wrote: [...] > THIS IS FALSE. CALLING A FUNCTION What *FUNCTION*? You think you can just slap a function-y looking symbol willy-nilly in the middle of a chunk of code and then have it "magically" transform into a python function object? >>> do_without_item() Traceback (most re

Re: we want python software

2017-12-06 Thread Rick Johnson
Gregory Ewing wrote: [...] > To be fair to this person, for someone who has a natural > aptitude for programming, it can be difficult to appreciate > how hard it is for people who don't. When I first started > programming, in my early teens, the basic ideas all seemed > very straightforward,

Re: why won't slicing lists raise IndexError?

2017-12-06 Thread Rick Johnson
Alexandre Brault wrote: [...] > process() wasn't defined either, nor were n and seq and yet > you're not complaining about them. Why would i? Both are highly relevant to the example of performing a slice. "Don't throw the baby out with the bathwater", as they say... > It seems it was clear

Re: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)

2017-12-07 Thread Rick Johnson
On Wednesday, December 6, 2017 at 8:29:23 PM UTC-6, Steve D'Aprano wrote: [...] > If the term "OS file associations" is ever so slightly > inaccurate (it's not the actual OS kernel that does the > associating, but the desktop environment), well, we can > probably say the same thing about Mac

Re: why won't slicing lists raise IndexError?

2017-12-08 Thread Rick Johnson
Python wrote: [...] > > In this snippet (which again, we agreed was an incomplete > academic example): > > if item: > process(item) > else: > do_without_item() > > Can you please explain to me what sort of Python > syntactical construct do_without_item() could be, other > t

Re: How to use a regexp here

2017-12-08 Thread Rick Johnson
Cecil Westerhof wrote: > Joel Goldstick writes: [...] > > I like Ned's clear answer, but I'm wondering why the > > original code would fail because the substring is at the > > start of the line, since 'in' would still be true no > > matter where the desired string is placed. It would be > > usef

Re: Please tell me how to execute python file in Ubuntu by double

2017-12-08 Thread Rick Johnson
On Monday, December 4, 2017 at 3:49:11 AM UTC-6, [email protected] wrote: > I am Dhananjay Singh,Student of IIIT Manipur. Sir/Mam when > i am double click in python program (Dhananjay.py),it is > opening in Text Editor by Default in Ubuntu.I want to run > this program when i double click on i

Re: why won't slicing lists raise IndexError?

2017-12-08 Thread Rick Johnson
Steve D'Aprano wrote: [...] > You've already been told that there's no indication or > reason to believe that it is a non-action. You've already > been given at least one possible action. It isn't a non- > action, it is two distinct actions: > > - the action you take when the slice is non-empty;

Re: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)

2017-12-10 Thread Rick Johnson
Rustom Mody wrote: [...] > Whether there was nothing wrong in what I did, the "wrong- > right" was de facto, or de jure… I will leave to more wise > persons than myself A file with no extension (regardless of the OS or desktop enviroment that it was created on), is like a sealed box with no

Re: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)

2017-12-11 Thread Rick Johnson
Lawrence D’Oliveiro wrote: > Rick Johnson wrote: > > And it's not like we can just pick file up and shake > > it, in a crude attempt to intuit the contents. > > Yes we can! BO??? Is that you? -- https://mail.python.org/mailman/listinfo/python-list

Re: Please tell me how to execute python file in Ubuntu by double

2017-12-12 Thread Rick Johnson
Chris Angelico wrote: [...] > > Yeah… magic… in the category of mind-reading? sooth- > > saying? > > Which is why OS/2, back in the 1990s, had *multiple* > associations for any given file. You could use file types > (sadly not MIME types - this was before MIME was the one > obvious standard

Re: Please tell me how to execute python file in Ubuntu by double

2017-12-12 Thread Rick Johnson
g more and more shrill are not talking to > each other but past each other I blame the confirmation bias of social media for the current state of dissed-discourse we find ourselves in these days. > > [Rick Johnson wrote] > > A file with no extension (regardless of the OS or desktop >

Re: Please tell me how to execute python file in Ubuntu by double

2017-12-13 Thread Rick Johnson
On Tuesday, December 12, 2017 at 10:42:54 PM UTC-6, eryk sun wrote: [...] > That said, I don't see this feature as being very useful > compared to just using "open with" when I occasionally need > to open a file with a non-default program. That's the point i was trying to make, but i think it may

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-19 Thread Rick Johnson
On Friday, February 16, 2018 at 10:25:32 PM UTC-6, Chris Angelico wrote: [...] > This is often touted as a necessity for industrial-grade > software. It isn't. There are many things that a type > system, no matter how sophisticated, cannot catch; for some > reason, though, we don't hear people sayi

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-19 Thread Rick Johnson
On Saturday, February 17, 2018 at 12:58:49 AM UTC-6, Paul Rubin wrote: [...] > Beyond that, the Python community (with some exceptions) seems to have a > widespread hatred of threads. It instead prefers to handle concurrent > i/o with in-thread async schemes that the rest of the world left behind

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Rick Johnson
On Tuesday, February 20, 2018 at 9:40:37 AM UTC-6, Steven D'Aprano wrote: [...] > Yes you did: you refused to meet the challenge, stating (and I quote): I'm always entertained by Steven's so-called "challenges". You see, Steven is addicted to winning, and he'll do anything to win a debate, even co

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Rick Johnson
On Tuesday, February 20, 2018 at 2:18:31 PM UTC-6, MRAB wrote: > The point he was making is that if you store a person's age, you'd have > to update it every year. It's far better to store the date of birth and > calculate the age on demand. *AHEM* At the risk of being labeled a "quibbler" (wh

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Rick Johnson
On Tuesday, February 20, 2018 at 2:51:56 PM UTC-6, Chris Angelico wrote: [...] > Nope. Even if you need the age many times per second, it's still > better to store the date of birth, because you eliminate boundary > conditions and duplicated data. You failed to provide any examples proving this as

Re: How to make Python run as fast (or faster) than Julia

2018-02-22 Thread Rick Johnson
On Thursday, February 22, 2018 at 1:55:35 PM UTC-6, Jack Fearnley wrote: [...] > I realize that this thread is about benchmarking and not > really about generating fibonacci numbers, but I hope > nobody is using this code to generate them on a > 'production' basis, I've been raising the warning fl

Re: For Loop Dilema [python-list]

2018-02-25 Thread Rick Johnson
On Sunday, February 25, 2018 at 12:19:56 PM UTC-6, [email protected] wrote: > Ex: > > Names = ["Arya","Pupun"] > > for name in Names: >for c in name: >print(c) > > instead use: > > for c in name in Names: > print(c) Hmm. Why stop there? bit = ["kibbles"] bits = [bit, bit

Re: How to make Python run as fast (or faster) than Julia

2018-02-25 Thread Rick Johnson
On Friday, February 23, 2018 at 10:41:45 AM UTC-6, Steven D'Aprano wrote: [...] > There are dozens of languages that have made the design > choice to limit their default integers to 16- 32- or 64-bit > fixed size, and let the user worry about overflow. Bart, > why does it upset you so that Python m

Re: How to make Python run as fast (or faster) than Julia

2018-02-25 Thread Rick Johnson
On Friday, February 23, 2018 at 8:48:55 PM UTC-6, Steven D'Aprano wrote: [...] > Take the Fibonacci double-recursion benchmark. Okay, it > tests how well your language does at making millions of > function calls. Why? Because making "millons of function calls" is what software *DOES*! Granted, an

Re: How to make Python run as fast (or faster) than Julia

2018-02-25 Thread Rick Johnson
On Sunday, February 25, 2018 at 8:45:56 PM UTC-6, Chris Angelico wrote: > On Mon, Feb 26, 2018 at 1:33 PM, Rick Johnson [...] > > but i do wish we pythonistas had a method to turn off this > > (and other) cycle burning "features" -- you know -- in the > > 9

Re: How to make Python run as fast (or faster) than Julia

2018-02-25 Thread Rick Johnson
On Sunday, February 25, 2018 at 8:45:56 PM UTC-6, Chris Angelico wrote: > On Mon, Feb 26, 2018 at 1:33 PM, Rick Johnson > wrote: [...] > > A default "integer-diversity-and-inclusivity-doctrine" is > > all fine and dandy by me, (Hey, even integers need safe spaces), &

Re: How to make Python run as fast (or faster) than Julia

2018-02-25 Thread Rick Johnson
On Sunday, February 25, 2018 at 10:35:29 PM UTC-6, Steven D'Aprano wrote: [...] > Ah, you mean just like the way things were in Python 1.0 > through 2.1? Hands up anyone who has seen an integer > OverflowError in the last 10 years? Anyone? I think Python2.1 is much older than 10 years, so yeah, of

Re: How to make Python run as fast (or faster) than Julia

2018-02-26 Thread Rick Johnson
On Monday, February 26, 2018 at 3:59:40 AM UTC-6, Steven D'Aprano wrote: > On Sun, 25 Feb 2018 20:22:17 -0800, Rick Johnson wrote: > (We tried painting Go Faster stripes on the server, and it > didn't work.) Well of course the server won't work after you drip water-

Re: How to make Python run as fast (or faster) than Julia

2018-02-26 Thread Rick Johnson
On Monday, February 26, 2018 at 4:39:22 AM UTC-6, Steven D'Aprano wrote: > On Sun, 25 Feb 2018 19:26:12 -0800, Rick Johnson wrote: > > > On Friday, February 23, 2018 at 8:48:55 PM UTC-6, Steven D'Aprano wrote: > > [...] > > > Take the Fibonacci double-recursio

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Rick Johnson
On Monday, February 26, 2018 at 8:44:14 AM UTC-6, Steven D'Aprano wrote: > I have a class with a large number of parameters (about > ten) assigned in `__init__`. The class then has a number of > methods which accept *optional* arguments with the same > names as the constructor/initialiser parameter

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Rick Johnson
On Monday, February 26, 2018 at 5:44:18 PM UTC-6, MRAB wrote: [...] > Before using or'd-logic, you need to know whether the value > could be falsey, e.g. 0. True. However. Steven failed to provide any info that might help us determine the types of these parameters, and as such, i was forced to tak

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-26 Thread Rick Johnson
On Tuesday, February 20, 2018 at 5:45:36 PM UTC-6, Steven D'Aprano wrote: > On Tue, 20 Feb 2018 12:42:23 -0800, Rick Johnson wrote: > > > For instance, if the age is queried many times a second, > > it would be a much wiser design to set-up an event that > > will adva

Re: help me ?

2018-02-27 Thread Rick Johnson
On Tuesday, February 27, 2018 at 12:56:52 PM UTC-6, Grant Edwards wrote: [...] > The fun part is giving them a solution that's so obscure and "clever" > that it technically meets the stated requirement but is so far from > what the instructor wanted that they don't get credit for it (and > there's

Re: Detection of ultrasonic side channels in mobile devices with Python?

2018-02-28 Thread Rick Johnson
On Wednesday, February 28, 2018 at 4:34:11 PM UTC-6, Etienne Robillard wrote: > A great number of studies have shown that ultrasonic > neuromodulation of the central nervous system can be > exploited via brain-computer interfaces... It is cutting > edge science however, and my knowledge on techni

Re: RFC: Proposal: Deterministic Object Destruction

2018-02-28 Thread Rick Johnson
On Wednesday, February 28, 2018 at 5:02:17 PM UTC-6, Chris Angelico wrote: > Here's one example: reference cycles. When do they get detected? > Taking a really simple situation: > > class Foo: > def __init__(self): > self.self = self *shudders* Can you provide a real world example in

Re: RFC: Proposal: Deterministic Object Destruction

2018-02-28 Thread Rick Johnson
On Wednesday, February 28, 2018 at 5:50:53 PM UTC-6, Steven D'Aprano wrote: > On Wed, 28 Feb 2018 14:51:09 -0800, ooomzay wrote: > > > > [...] > > > > Specification > > = > > > > When the last reference to an object goes out of scope the > > intepreter must synchronously, in the threa

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Rick Johnson
On Wednesday, February 28, 2018 at 9:00:37 PM UTC-6, Chris Angelico wrote: > On Thu, Mar 1, 2018 at 1:46 PM, Rick Johnson > wrote: > > On Wednesday, February 28, 2018 at 5:02:17 PM UTC-6, Chris Angelico wrote: > > > >> Here's one example: reference cycles. When do

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Rick Johnson
On Wednesday, February 28, 2018 at 10:03:56 PM UTC-6, ROGER GRAYDON CHRISTMAN wrote: [...] > If you want something that looks like a real world example, > consider the very common doubly-linked list: > > [ 1 ] <---> [ 2 ] <---> [ 3 ] <--.--> [ N ] > > This is chock-full of reference cycle

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Rick Johnson
On Wednesday, February 28, 2018 at 10:26:26 PM UTC-6, Steven D'Aprano wrote: > On Wed, 28 Feb 2018 18:46:05 -0800, Rick Johnson wrote: > > > On Wednesday, February 28, 2018 at 5:02:17 PM UTC-6, Chris Angelico > > wrote: > > > >> Here's one example:

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Rick Johnson
On Wednesday, February 28, 2018 at 11:44:39 PM UTC-6, Paul Rubin wrote: > Rick Johnson writes: > > Can you provide a real world example in which you need an > > object which circularly references _itself_? > > DOM trees are a classic example (see the various DOM > modu

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Rick Johnson
On Thursday, March 1, 2018 at 1:54:40 AM UTC-6, Serhiy Storchaka wrote: [...] > Every global function (or method of global class) creates a > reference cycle. > > def f(): pass > > f.__globals__['f'] is f (Note: This is also a response to dieter) This is true, but it does not answer t

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Rick Johnson
On Thursday, March 1, 2018 at 6:10:45 PM UTC-6, Chris Angelico wrote: > On Fri, Mar 2, 2018 at 10:58 AM, Rick Johnson > wrote: > > I don't buy into the religion that _all_ CRs are evil. Those > > who make such claims are dealing in absolutes. And as Obi- > > wan war

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-02 Thread Rick Johnson
On Thursday, March 1, 2018 at 10:13:51 PM UTC-6, Steven D'Aprano wrote: [...] > And for the record, consider a tree of nodes, where each > node points back at the root of the tree, which is also a > node. So what does the root node point back at? Finally! A practical solution is offered that answe

Re: Thank you Python community!

2018-03-19 Thread Rick Johnson
On Monday, March 19, 2018 at 6:37:21 PM UTC-5, Ben Finney wrote: > -- > \ "Success is going from one failure to the next without a loss | > `\ of enthusiasm." -- Winston Churchill | > _o__) | > B

Re: Style Q: Instance variables defined outside of __init__

2018-03-20 Thread Rick Johnson
On Tuesday, March 20, 2018 at 1:43:39 AM UTC-5, Terry Reedy wrote: [...] > > class Card(): > > > > BACK_OF_CARD_IMAGE = pygame.image.load('images/backOfCard.png') > > > > def __init__(self, window, name, suit, value): > > self.window = window > > self.suit = suit > >

Re: Style Q: Instance variables defined outside of __init__

2018-03-20 Thread Rick Johnson
On Tuesday, March 20, 2018 at 6:14:34 AM UTC-5, Alister wrote: > On Tue, 20 Mar 2018 08:52:29 +, Steven D'Aprano wrote: > > On Tue, 20 Mar 2018 02:43:13 -0400, Terry Reedy wrote: > > > > > I think a claim that in all programs all attributes > > > should be set *in* __init__, as opposed to *dur

Re: [OT] Re: Thank you Python community!

2018-03-20 Thread Rick Johnson
On Tuesday, March 20, 2018 at 7:03:11 AM UTC-5, Adriaan Renting wrote: (on the subject of the opioid epidemic) > That sounds more like a conspiracy theory than a real > analysis of the problem. Looking at it from here in > Europe, most of the analysis I've been able to read and > watch about it

Re: Modules

2018-03-21 Thread Rick Johnson
Hmm, let's try a little interactive session, shall we? Did your error message look something like this? >>> import spam Traceback (most recent call last): File "", line 1, in import spam ImportError: No module named spam >>> import eggs Traceback (most recent

Re: Want to convert the msg file in html file so that i can read the tables emebedded in msg file using python

2018-03-21 Thread Rick Johnson
On Wednesday, March 21, 2018 at 5:15:47 AM UTC-5, [email protected] wrote: > TITLE: "Want to convert the msg file in html file so that i > can read the tables emebedded in msg file using python" My guess that the OP meant to say: "msg file *INTO* html file" -- where "msg file" is a file holdin

Re: Modules

2018-03-21 Thread Rick Johnson
On Wednesday, March 21, 2018 at 7:49:42 PM UTC-5, Jacques Bikoundou wrote: > It said: ImportError: no module named 'speedml' I see. And did you check the search path[1] to ensure that the modules you want to import are indeed located in a directory which python normally searches? As an academic e

Re: Accessing parent objects

2018-03-24 Thread Rick Johnson
On Saturday, March 24, 2018 at 1:20:24 PM UTC-5, D'Arcy Cain wrote: > I'm not even sure how to describe what I am trying to do > which perhaps indicates that what I am trying to do is the > wrong solution to my problem in the first place but let me > give it a shot. Look at the following code. >

Re: Accessing parent objects

2018-03-24 Thread Rick Johnson
On Saturday, March 24, 2018 at 6:57:29 PM UTC-5, 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 problem is, Python's super is not intuitive. And i'd

Re: Accessing parent objects

2018-03-24 Thread Rick Johnson
On Saturday, March 24, 2018 at 9:29:02 PM UTC-5, Chris Angelico wrote: > So tell me, how do these other (beautifully intuitive) > languages handle multiple inheritance? I'm sure it's really > easy to make super() work when there's exactly one > superclass that you can lock in at compile time. Afte

Re: Accessing parent objects

2018-03-25 Thread Rick Johnson
On Saturday, March 24, 2018 at 11:31:38 PM UTC-5, Steven D'Aprano wrote: > On Sat, 24 Mar 2018 20:08:47 -0700, Rick Johnson wrote: [...] > > > > the inconsistency of using super _outside_ of Tkinter code > > whilst simultaneously using explicit inheritance _inside_

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

2018-03-25 Thread Rick Johnson
On Sunday, March 25, 2018 at 9:11:35 AM UTC-5, Steven D'Aprano wrote: > On Sun, 25 Mar 2018 04:49:21 -0700, Rick Johnson wrote: [...] > I never said anything about not allowing it. But since > you've gone on the defence about parens-free function > calls, how is this for

Re: Accessing parent objects

2018-03-25 Thread Rick Johnson
On Sunday, March 25, 2018 at 10:02:20 AM UTC-5, Jugurtha Hadjar wrote: [...] > Furthermore, the only case I'd use a positional argument is > if I were 100% certain the code will not change, which I'm > not. And short of you possessing a crystal ball in good working order (mine's currently in the s

Re: Accessing parent objects

2018-03-25 Thread Rick Johnson
On Sunday, March 25, 2018 at 9:52:30 AM UTC-5, Steven D'Aprano wrote: > On Sun, 25 Mar 2018 04:49:21 -0700, Rick Johnson wrote: [...] > But refusing to use super in modern, new-style classes that > don't have anything to do with tkinter is precisely the > sort of *foolish* co

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

2018-03-25 Thread Rick Johnson
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 > intelligent conversation, you

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 > print

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

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

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

2018-03-27 Thread Rick Johnson
On Tuesday, March 27, 2018 at 1:55:01 AM UTC-5, Gregory Ewing wrote: > 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. If Chris means: "how do you get a reference to a Ruby funct

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

2018-03-27 Thread Rick Johnson
On Tuesday, March 27, 2018 at 3:24:48 AM UTC-5, Steven D'Aprano wrote: > On Mon, 26 Mar 2018 11:37:35 -0700, Rick Johnson wrote: > Printing a string and calling a function is obfuscated code? Deary me. When the programmer can't be bothered to invent names more descriptive than

Re: (no subject)

2018-03-27 Thread Rick Johnson
On Tuesday, March 27, 2018 at 7:19:53 AM UTC-5, kevon harris wrote: > Unable to pull up IDLE after downloading Python 3.6.4 > > Sent from Mail for Windows 10 What OS? On Windows running Python2.X, IDLE is located @ '/Python2X/Lib/idlelib/idle.pyw' -- https://mail.python.org/mailman/listinfo/pyt

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

2018-03-27 Thread Rick Johnson
On Tuesday, March 27, 2018 at 8:46:54 AM UTC-5, Chris Angelico wrote: [...] > Cool, so Greg was right: you can't get a reference to a > method or function. You need magic to simulate it. Since when did utilizing a method to request a specific value become some sort of magic? Do you consider this

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

2018-03-27 Thread Rick Johnson
On Tuesday, March 27, 2018 at 11:35:31 AM UTC-5, Chris Angelico wrote: > Why are you suggesting that this is magic? _You_ are the one who leveled the accusation that Ruby's methodology for fetching a function reference (a la): Object.method(meth-name-here) is "magic". I'm merely requesting t

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

2018-03-27 Thread Rick Johnson
On Tuesday, March 27, 2018 at 4:47:05 PM UTC-5, Gregory Ewing wrote: > Rick Johnson wrote: > > rb> Object.method("print_name").call("Meathead") > > Yes, but the point is that you have to have to use a different > syntax to call it. This is like hav

Re: Pep8 for long pattern

2018-03-27 Thread Rick Johnson
On Tuesday, March 27, 2018 at 4:02:37 PM UTC-5, Dan Stromberg wrote: > On Tue, Mar 27, 2018 at 8:18 AM, Michael Torrie wrote: > > But when it's exactly what you need, why do you need to > > shoehorn the expression into 79 characters? Seems > > pointless in a case like this. PEP8 is a guideline, n

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

2018-03-27 Thread Rick Johnson
On Tuesday, March 27, 2018 at 6:55:23 PM UTC-5, Steven D'Aprano wrote: > On Tue, 27 Mar 2018 09:28:34 -0700, Rick Johnson wrote: [...] > > Since when did utilizing a method to request a specific > > value become some sort of magic? > > Since it requires a special metho

<    1   2   3   4   5   6   7   8   9   10   >