Re: [Tutor] beginning to code

2017-09-23 Thread Bill
Steve D'Aprano wrote: On Sun, 24 Sep 2017 08:18 am, Bill wrote: All one has to do, I think, is consider (1) that passing objects by "making copies" of them, would be prohibitively expensive Swift passes certain values (but not others!) by value and makes a copy. That includes many potentially

Re: [Tutor] beginning to code

2017-09-23 Thread Steve D'Aprano
On Sun, 24 Sep 2017 08:18 am, Bill wrote: > All one has to do, I think, is consider (1) that passing objects by > "making copies" of them, would be prohibitively expensive Swift passes certain values (but not others!) by value and makes a copy. That includes many potentially large data types in

Re: [Tutor] beginning to code

2017-09-23 Thread Steve D'Aprano
On Sun, 24 Sep 2017 07:03 am, ROGER GRAYDON CHRISTMAN wrote: > I usually do not encourage people to optimize correctness out of their code. +1 quote of the week :-) -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail

Re: Change project licence?

2017-09-23 Thread Tim Chase
On 2017-09-23 19:14, Chris Angelico wrote: > On Sat, Sep 23, 2017 at 7:07 PM, Kryptxy > wrote: > > Thank you all! I opened a ticket about the same (on github). > > I got response from most of them, and all are agreeing to the > > change. However, one contributor did not respond at all. I tried > >

Re: [Tutor] beginning to code

2017-09-23 Thread Bill
Chris Angelico wrote: On Sun, Sep 24, 2017 at 8:18 AM, Bill wrote: Stephan Houben wrote: Op 2017-09-23, Rick Johnson schreef : These pissing contests over how values are passed in Python are totally irrelevant. What does it matter? Nothing will be gained or lost by arguing over which is true,

Re: [Tutor] beginning to code

2017-09-23 Thread Chris Angelico
On Sun, Sep 24, 2017 at 8:18 AM, Bill wrote: > Stephan Houben wrote: >> >> Op 2017-09-23, Rick Johnson schreef : >>> >>> These pissing contests over how values are passed in Python >>> are totally irrelevant. What does it matter? Nothing will be >>> gained or lost by arguing over which is true, or

Re: [Tutor] beginning to code

2017-09-23 Thread Bill
Stephan Houben wrote: Op 2017-09-23, Rick Johnson schreef : These pissing contests over how values are passed in Python are totally irrelevant. What does it matter? Nothing will be gained or lost by arguing over which is true, or not. Unless the distinction is preventing you from doing something

Re: How to share class relationship representations?

2017-09-23 Thread Pavol Lisy
On 9/23/17, Stephan Houben wrote: > Op 2017-09-22, Pavol Lisy schreef : >> On 9/19/17, leam hall wrote: >>> I'm working on designing the classes, sub-classes, and relationships in >>> my >>> code. What is a good visual way to represent it so it can be stored in >>> git >>> and shared on the list

Re: [Tutor] beginning to code

2017-09-23 Thread ROGER GRAYDON CHRISTMAN
On Fri, Sep 22, 2017 12:03 PM, Dennis Lee Bier wrote:> On Fri, 22 Sep 2017 23:30:34 +1000, Steve D'Aprano > declaimed the following: > >The exercise is to demonstrate pass by reference semantics. That requires > >demonstrating the same semantics as the Pascal swap procedure: > > > >procedure swa

Re: Beginners and experts (Batchelder blog post)

2017-09-23 Thread Ned Batchelder
On 9/23/17 2:52 PM, Leam Hall wrote: On 09/23/2017 02:40 PM, Terry Reedy wrote: https://nedbatchelder.com//blog/201709/beginners_and_experts.html Great post. Yup. Thanks for the link. I often have that "I bet Fred> doesn't get frustrated." thing going. Nice to know Ned bangs his head now and

Re: Beginners and experts (Batchelder blog post)

2017-09-23 Thread Terry Reedy
On 9/23/2017 2:52 PM, Leam Hall wrote: On 09/23/2017 02:40 PM, Terry Reedy wrote: https://nedbatchelder.com//blog/201709/beginners_and_experts.html Great post. Yup. Thanks for the link. I often have that "I bet Fred> doesn't get frustrated." thing going. Nice to know Ned bangs his head now a

Re: what is happening in panda "where" clause

2017-09-23 Thread Pavol Lisy
On 9/22/17, Peter Otten <__pete...@web.de> wrote: > Exposito, Pedro (RIS-MDW) wrote: > >> This code does a "where" clause on a panda data frame... >> >> Code: >> import pandas as pd; >> col_names = ['Name', 'Age', 'Weight', "Education"]; >> # create panda dataframe >> x = pd.read_csv('test.dat', se

Re: [Tutor] beginning to code

2017-09-23 Thread Stephan Houben
Op 2017-09-23, Rick Johnson schreef : > These pissing contests over how values are passed in Python > are totally irrelevant. What does it matter? Nothing will be > gained or lost by arguing over which is true, or not. Unless > the distinction is preventing you from doing something that > you'd lik

Re: Beginners and experts (Batchelder blog post)

2017-09-23 Thread Leam Hall
On 09/23/2017 02:40 PM, Terry Reedy wrote: https://nedbatchelder.com//blog/201709/beginners_and_experts.html Great post. Yup. Thanks for the link. I often have that "I bet Fred> doesn't get frustrated." thing going. Nice to know Ned bangs his head now and again. :P Leam -- https://mail.p

Beginners and experts (Batchelder blog post)

2017-09-23 Thread Terry Reedy
https://nedbatchelder.com//blog/201709/beginners_and_experts.html Great post. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: [Tutor] beginning to code

2017-09-23 Thread Rick Johnson
Mark Lawrence wrote: > [...] > I have no interest it what the C++ does, looks like or > anything else. All I'm bothered about is that two highly > respected members of the Python community have stated quite > clearly that Python is call by object. Many other people > have stated the same in this

Py 3.6 tarfile

2017-09-23 Thread Klaus Jantzen
Hi, if I understand the documentation of the tarfile module correctly writing TarfileObject.add(".../path/to/filename", recursive=False) means that the directory structure of the file object will not be included in the archive. In the following script only "testtext1.pdf" is s

How to get the webpage with socks5 proxy in python3?

2017-09-23 Thread Length Power
sudo lsof -i:1080 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME sslocal 1795 root4u IPv4 16233 0t0 TCP localhost:socks (LISTEN) sslocal 1795 root5u IPv4 16234 0t0 UDP localhost:socks An app was listening on localhost:1080,it is ready for curl's so

How to get the webpage with socks5 proxy in python3?

2017-09-23 Thread Length Power
sudo lsof -i:1080 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME sslocal 1795 root4u IPv4 16233 0t0 TCP localhost:socks (LISTEN) sslocal 1795 root5u IPv4 16234 0t0 UDP localhost:socks An app was listening on localhost:1080,it is ready for curl's soc

Re: [Tutor] beginning to code

2017-09-23 Thread Mark Lawrence via Python-list
On 23/09/2017 04:06, Bill wrote: Mark Lawrence wrote: On 22/09/2017 08:01, Bill wrote: Steve D'Aprano wrote: On Fri, 22 Sep 2017 02:57 pm, Bill wrote: I find Python to be more more like Java, with regard to "passing objects by reference". Which is not a surprise, since both Python and Java u

Re: Old Man Yells At Cloud

2017-09-23 Thread Rick Johnson
Steve D'Aprano wrote: > Paul Rubin wrote: > > Steve D'Aprano writes: > > > Having to spend a few hours being paid to migrate code > > > using "print x" to "print(x)", or even a few months, is > > > not a life-changing experience. > > > > Didn't someone further up the thread mention some company >

Re: PyQt: viewport vs window - how do you translate co-ordinates?

2017-09-23 Thread Michael Torrie
On 09/23/2017 05:38 AM, Veek M wrote: > I didn't understand any of that - could someone expand on that para? > Is there a reading resource that explains the Viewport and translations? I am > not a CS student so I did not study computer graphics. I'm sure there are lots of things that might help.

Re: Change project licence?

2017-09-23 Thread Michael Torrie
On 09/23/2017 03:07 AM, Kryptxy via Python-list wrote: > Thank you all! I opened a ticket about the same (on github). > I got response from most of them, and all are agreeing to the change. > However, one contributor did not respond at all. I tried e-mailing, but no > response. > Can I still proce

Re: Old Man Yells At Cloud

2017-09-23 Thread Paul Moore
On 23 September 2017 at 12:37, Steve D'Aprano wrote: > 95% of Python is unchanged from Python 2 to 3. 95% of the remaining is a > trivial > renaming or other change which can be mechanically translated using a tool > like > 2to3. Only the remaining 5% of 5% is actually tricky to migrate. If your

Re: Old Man Yells At Cloud

2017-09-23 Thread Steve D'Aprano
On Fri, 22 Sep 2017 04:05 pm, Paul Rubin wrote: > Steve D'Aprano writes: >> Having to spend a few hours being paid to migrate code using "print x" >> to "print(x)", or even a few months, is not a life-changing experience. > > Didn't someone further up the thread mention some company that had spe

PyQt: viewport vs window - how do you translate co-ordinates?

2017-09-23 Thread Veek M
pg 329, Rapid GUI Programming http://storage4.static.itmages.com/i/17/0923/h_1506165624_2588733_59fdfcd4cc.png In PyQt terminology the physical coordinate system is called the “viewport”, and confusingly, the logical coordinate system is called the “window”. In Figure 11.4, w

Re: Change project licence?

2017-09-23 Thread Kryptxy via Python-list
Yep. I will wait for a response. Thank you! Original Message On 23 Sep 2017, 16:57, Chris Angelico wrote: > On Sat, Sep 23, 2017 at 7:44 PM, Leam Hall wrote: >> Like Chris said, evaluate the level of effort on the code. Wait, or replace. >> You will be happier when you take the

Re: Python Boolean Logic

2017-09-23 Thread Steve D'Aprano
On Sat, 23 Sep 2017 03:01 pm, Bill wrote: > if (20 - 10) > 15 : > print("true") > else: > print("false"); print(20 - 10 > 15) will do the job. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.or

Re: Change project licence?

2017-09-23 Thread Chris Angelico
On Sat, Sep 23, 2017 at 7:44 PM, Leam Hall wrote: > Like Chris said, evaluate the level of effort on the code. Wait, or replace. > You will be happier when you take the honorable path. Remembering that that, of course, is Plan B; plan A is to keep trying to contact that last contributor.. S/he ha

Re: Change project licence?

2017-09-23 Thread Leam Hall
On 09/23/2017 05:14 AM, Chris Angelico wrote: On Sat, Sep 23, 2017 at 7:07 PM, Kryptxy wrote: Thank you all! I opened a ticket about the same (on github). I got response from most of them, and all are agreeing to the change. However, one contributor did not respond at all. I tried e-mailing, bu

Re: Change project licence?

2017-09-23 Thread Chris Angelico
On Sat, Sep 23, 2017 at 7:07 PM, Kryptxy wrote: > Thank you all! I opened a ticket about the same (on github). > I got response from most of them, and all are agreeing to the change. > However, one contributor did not respond at all. I tried e-mailing, but no > response. > Can I still proceed chan

Re: Change project licence?

2017-09-23 Thread Kryptxy via Python-list
Thank you all! I opened a ticket about the same (on github). I got response from most of them, and all are agreeing to the change. However, one contributor did not respond at all. I tried e-mailing, but no response. Can I still proceed changing the licence? It has been more than a week since the

Re: Python Boolean Logic

2017-09-23 Thread Bill
Chris Warrick wrote: This outputs "False is false", because you used the variable in your expression. You can just do this: print("s is", s) This will print "s is False". Ah, good point! But I do like "self-documenting" output (so I don't mind seeing s)---if you had 5 or more statements a

Re: search and replace first amount of strings instances with one thing and a second amount of instances with another thing-

2017-09-23 Thread Bill
Bill wrote: validationma...@gmail.com wrote: i have a code in python to search and replace what i need though is to replace the first say 10 instances of the number 1 with 2 and the second 10 instances with the number 3. anybody knows how to do that? Do you mean the (integer) number 1 or the ch

Re: Python Boolean Logic

2017-09-23 Thread Chris Warrick
On 23 September 2017 at 06:46, Cai Gengyang wrote: > Output : > > ('bool_one = ', False) > ('bool_two = ', False) > ('bool_three = ', False) > ('bool_four = ', True) > ('bool_five = ', False) You’re using Python 2 with Python 3-style print statements. To make it look good, start your code with:

Re: search and replace first amount of strings instances with one thing and a second amount of instances with another thing-

2017-09-23 Thread Peter Otten
Peter Otten wrote: > validationma...@gmail.com wrote: > >> i have a code in python to search and replace what i need though is to >> replace the first say 10 instances of the number 1 with 2 and the second >> 10 instances with the number 3. anybody knows how to do that? >> >> fin = open(r'F:\1\x

Re: search and replace first amount of strings instances with one thing and a second amount of instances with another thing-

2017-09-23 Thread Bill
validationma...@gmail.com wrote: i have a code in python to search and replace what i need though is to replace the first say 10 instances of the number 1 with 2 and the second 10 instances with the number 3. anybody knows how to do that? Do you mean the (integer) number 1 or the character '1'?

Re: search and replace first amount of strings instances with one thing and a second amount of instances with another thing-

2017-09-23 Thread Peter Otten
validationma...@gmail.com wrote: > i have a code in python to search and replace what i need though is to > replace the first say 10 instances of the number 1 with 2 and the second > 10 instances with the number 3. anybody knows how to do that? > > fin = open(r'F:\1\xxx.txt') > fout = open(r'F:\1

Re: Python Boolean Logic

2017-09-23 Thread Bill
Steve D'Aprano wrote: On Sat, 23 Sep 2017 03:01 pm, Bill wrote: s='(20 - 10) > 15' b=(20 - 10) > 15 print(s, " is ", ("true" if b else "false") ); ## inside parentheses may be removed. I am new to Python. Maybe someone here is familiar with an elegant way to get the the value of b directly