Re: newb question about @property

2017-10-03 Thread Steve D'Aprano
On Wed, 4 Oct 2017 02:00 am, bartc wrote: > Does all this advanced stuff (which I don't understand and which doesn't > look very appealing either; hopefully I will never come across such > code) still count as programming? I could not have hoped to see a more perfect example of the Blub effect in

Re: on a very slow function

2017-10-03 Thread Steve D'Aprano
On Tue, 3 Oct 2017 04:23 am, Ian Kelly wrote: >> py> (2**75 + 7) % 12 # Expected value. >> 3 >> py> ((2**75) % 12 + (7 % 12)) % 12 # Correct. >> 3 >> py> (2**75) % 12 + (7 % 12) # Incorrect. >> 15 > > No, only the final one is necessary. Modding the result of the > exponentiation might be usef

Re: The "loop and a half"

2017-10-03 Thread Chris Angelico
On Wed, Oct 4, 2017 at 2:48 PM, Steve D'Aprano wrote: > On Wed, 4 Oct 2017 01:40 pm, Chris Angelico wrote: > >> You know, you don't HAVE to economize on letters. It's okay to call >> your parameters "prompt" instead of "prmt". Remember, that's part of >> your API. > > > Whn u wste vwels lik that,

Re: The "loop and a half"

2017-10-03 Thread Steve D'Aprano
On Wed, 4 Oct 2017 01:40 pm, Chris Angelico wrote: > You know, you don't HAVE to economize on letters. It's okay to call > your parameters "prompt" instead of "prmt". Remember, that's part of > your API. Whn u wste vwels lik that, dn't b srprsd whn u run ot n hav shrtg of vwel wth nt nuff 4 vryb

Re: optional int- and float arguments

2017-10-03 Thread Steve D'Aprano
On Wed, 4 Oct 2017 12:17 pm, Stefan Ram wrote: > |>>> str(object='abc') > |'abc' That's probably also a bug. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: The "loop and a half"

2017-10-03 Thread Steve D'Aprano
On Wed, 4 Oct 2017 09:08 am, Stefan Ram wrote: > Steve D'Aprano writes: >>On Wed, 4 Oct 2017 04:45 am, Rhodri James wrote: >>>On 03/10/17 18:29, Stefan Ram wrote: Is this the best way to write a "loop and a half" in Python? >>>Define "best". >>I'd start with "define loop and a half". [...] >

Re: The "loop and a half"

2017-10-03 Thread Chris Angelico
On Wed, Oct 4, 2017 at 1:17 PM, Larry Hudson via Python-list wrote: > def get_num(prmt, lo=None, hi=None, dflt=None, flt=False, abrt=False): > """Get a number from the console > > Parameters: > prmt: The prompt to be used with the input function, required. > lo: The m

Re: The "loop and a half"

2017-10-03 Thread Larry Hudson via Python-list
On 10/03/2017 10:29 AM, Stefan Ram wrote: Is this the best way to write a "loop and a half" in Python? x = 1 while x: x = int( input( "Number (enter 0 to terminate)? " )) if x: print( f'Square = { x**2 }' ) In a C-like language, one could write: while x = int( input( "

Re: newb question about @property

2017-10-03 Thread Ian Kelly
On Tue, Oct 3, 2017 at 9:16 AM, Jorge Gimeno wrote: > No, I see this as teaching the skills involved to drive a car. Practicing a > turn, scanning gauges, and checking blind spots are all a part of driving. > When one is learning, it's easier to learn these in isolation so when the > problem must

Re: optional int- and float arguments

2017-10-03 Thread Steve D'Aprano
On Wed, 4 Oct 2017 03:18 am, Stefan Ram wrote: > »int« and »float« seem to behave quite similar: > > |>>> int( x = 8 ) > |8 > |>>> float( x = 8.0 ) > |8.0 I expect that these functions taking a *named* parameter "x" is an accident that shouldn't be relied on. -- Steve “Cheer up,” they said

Re: The "loop and a half"

2017-10-03 Thread Terry Reedy
On 10/3/2017 2:10 PM, Peter Otten wrote: Stefan Ram wrote: Is this the best way to write a "loop and a half" in Python? [snip while loop] Use iter() and a for loop: def input_int(): ... return int(input("Enter number (0 to terminate): ")) ... for x in iter(input_int, 0): ...

Re: The "loop and a half"

2017-10-03 Thread Steve D'Aprano
On Wed, 4 Oct 2017 04:45 am, Rhodri James wrote: > On 03/10/17 18:29, Stefan Ram wrote: >>Is this the best way to write a "loop and a half" in Python? > > Define "best". I'd start with "define loop and a half". -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, a

testbank

2017-10-03 Thread Patty Kramer
do you have testbank for Small Business Management: Launching & Growing Entrepreneurial Ventures, 18th Edition by Justin G. LongeneckerJ. William Petty -- https://mail.python.org/mailman/listinfo/python-list

Re: when is the filter test applied?

2017-10-03 Thread Chris Angelico
On Wed, Oct 4, 2017 at 7:31 AM, ROGER GRAYDON CHRISTMAN wrote: >>> > for rb in filter (lambda b : b in some_seq, seq): >>> > ... some code that might modify some_seq > I think one must always be very careful about modifying anything > that you are iterating across -- if not avoiding that sort of

Re: when is the filter test applied?

2017-10-03 Thread ROGER GRAYDON CHRISTMAN
On Tue, Oct 3, 2017 15:38:42, Neal Becker wrote: > I'm not certain that it isn't behaving as expected - my code is quite >complicated. > >On Tue, Oct 3, 2017 at 11:35 AM Paul Moore wrote: > >> My intuition is that the lambda creates a closure that captures the >> value of some_seq. If that value

[RELEASE] Python 3.6.3 is now available

2017-10-03 Thread Ned Deily
On behalf of the Python development community and the Python 3.6 release team, I am happy to announce the availability of Python 3.6.3, the third maintenance release of Python 3.6. Detailed information about the changes made in 3.6.3 can be found in the change log here: https://docs.python.org/3.

Re: Need some help with argparse

2017-10-03 Thread Ben Finney
Kryptxy via Python-list writes: > I have a group of arguments, say: (-a, -b, -c, -d, -e) [lets call it group1] > I have another group, say: (-z, -y, -x, -w) [lets call it group2] Argument groups are a feature to control the help output from the parser: When an argument is added to the grou

Need some help with argparse

2017-10-03 Thread Kryptxy via Python-list
Hi, I am trying to figure out something with argparse. Here is a scenario: I have a group of arguments, say: (-a, -b, -c, -d, -e) [lets call it group1] I have another group, say: (-z, -y, -x, -w) [lets call it group2] Code: import argparse parser = argparse.ArgumentParser(description="Test this s

Re: The "loop and a half"

2017-10-03 Thread Bill
Stefan Ram wrote: Is this the best way to write a "loop and a half" in Python? Is your goal brevity or clarity, or something else (for instance, what does the code written by the other members of your "team" look like--woudn't it be nice if it matched)? Bill x = 1 while x: x = in

Re: F5 not working?

2017-10-03 Thread Terry Reedy
On 10/3/2017 2:02 PM, Breta Skinner wrote: Hello, I tried looking around the website, but didn't see a question about function keys. Somehow, I "turned off" the F5 function in the IDLE. It no longer "run module", but just does nothing. I have downloaded the newest version, 3.7, but that did not s

Re: newb question about @property

2017-10-03 Thread Bill
Steve D'Aprano wrote: On Tue, 3 Oct 2017 06:51 am, Bill wrote: Can you inspire me with a good decorator problem (standard homework exercise-level will be fine)? Here is a nice even dozen problems for you. Please ask for clarification if any are unclear. Thank you for sharing the problems on

F5 not working?

2017-10-03 Thread Breta Skinner
Hello, I tried looking around the website, but didn't see a question about function keys. Somehow, I "turned off" the F5 function in the IDLE. It no longer "run module", but just does nothing. I have downloaded the newest version, 3.7, but that did not solve the problem. I admit to being clumsy, s

Re: The "loop and a half"

2017-10-03 Thread Thomas Jollans
On 03/10/17 20:05, Dennis Lee Bieber wrote: > > while True: > x = input("Enter a number (blank to exit) => ") > if x: > try: > ix = int(x) > print("Square = %s" % (ix * ix) ) #why invoke > exponential > except chec

Re: The "loop and a half"

2017-10-03 Thread Peter Otten
Stefan Ram wrote: > Is this the best way to write a "loop and a half" in Python? > > x = 1 > while x: > x = int( input( "Number (enter 0 to terminate)? " )) > if x: > print( f'Square = { x**2 }' ) > > In a C-like language, one could write: > > while x = int( input( "Number (

Re: The "loop and a half"

2017-10-03 Thread Rhodri James
On 03/10/17 18:29, Stefan Ram wrote: Is this the best way to write a "loop and a half" in Python? Define "best". x = 1 while x: x = int( input( "Number (enter 0 to terminate)? " )) if x: print( f'Square = { x**2 }' ) I'd usually write it as while True: x = tedious_f

Re: optional int- and float arguments

2017-10-03 Thread Chris Angelico
On Wed, Oct 4, 2017 at 3:18 AM, Stefan Ram wrote: > »int« and »float« seem to behave quite similar: > > |>>> int( x = 8 ) > |8 > |>>> float( x = 8.0 ) > |8.0 > |>>> int() > |0 > |>>> float() > |0.0 > > . Yet the ways their parameters are being documented in > "The Python Library Reference, R

Re: when is filter test applied?

2017-10-03 Thread Paul Moore
On 3 October 2017 at 16:38, Neal Becker wrote: > I'm not certain that it isn't behaving as expected - my code is quite > complicated. OK, so I'd say the filtering would follow any changes made to some_seq - not because it's a documented guarantee as such, but simply as a consequence of the behavi

Re: when is filter test applied?

2017-10-03 Thread Peter Otten
Neal Becker wrote: > In the following code (python3): > > for rb in filter (lambda b : b in some_seq, seq): > ... some code that might modify some_seq > > I'm assuming that the test 'b in some_seq' is applied late, at the start > of each iteration (but it doesn't seem to be working that way in

Re: when is filter test applied?

2017-10-03 Thread Neal Becker
I'm not certain that it isn't behaving as expected - my code is quite complicated. On Tue, Oct 3, 2017 at 11:35 AM Paul Moore wrote: > My intuition is that the lambda creates a closure that captures the > value of some_seq. If that value is mutable, and "modify some_seq" > means "mutate the valu

RE: Research paper "Energy Efficiency across Programming Languages: How does energy, time, and memory relate?"

2017-10-03 Thread 3.1415926535897932384626433832795
The page is fixed BTW >>>import this On Sun, Sep 17, 2017 at 6:13 AM, wrote: > Send Python-list mailing list submissions to > python-list@python.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://mail.python.org/mailman/listinfo/python-list > or, via emai

Re: when is filter test applied?

2017-10-03 Thread Paul Moore
My intuition is that the lambda creates a closure that captures the value of some_seq. If that value is mutable, and "modify some_seq" means "mutate the value", then I'd expect each element of seq to be tested against the value of some_seq that is current at the time the test occurs, i.e. when the

Re: newb question about @property

2017-10-03 Thread Jorge Gimeno
No, I see this as teaching the skills involved to drive a car. Practicing a turn, scanning gauges, and checking blind spots are all a part of driving. When one is learning, it's easier to learn these in isolation so when the problem must be solved in real time, you know what to do. This is no diffe

when is filter test applied?

2017-10-03 Thread Neal Becker
In the following code (python3): for rb in filter (lambda b : b in some_seq, seq): ... some code that might modify some_seq I'm assuming that the test 'b in some_seq' is applied late, at the start of each iteration (but it doesn't seem to be working that way in my real code), so that if 'some

Re: newb question about @property

2017-10-03 Thread bartc
On 03/10/2017 15:39, Ian Kelly wrote: On Tue, Oct 3, 2017 at 4:41 AM, Steve D'Aprano wrote: On Tue, 3 Oct 2017 06:51 am, Bill wrote: Can you inspire me with a good decorator problem (standard homework exercise-level will be fine)? Here is a nice even dozen problems for you. Please ask for

Re: newb question about @property

2017-10-03 Thread Ian Kelly
On Tue, Oct 3, 2017 at 4:41 AM, Steve D'Aprano wrote: > On Tue, 3 Oct 2017 06:51 am, Bill wrote: > >> Can you inspire me with a good decorator problem (standard homework >> exercise-level will be fine)? > > > Here is a nice even dozen problems for you. Please ask for clarification if > any > are

Re: newb question about @property

2017-10-03 Thread Steve D'Aprano
On Tue, 3 Oct 2017 10:01 pm, Lele Gaifax wrote: > Steve D'Aprano writes: > >> (9) [ADVANCED] Modify the decorator from (8) to take an argument specifying >> the path to a file, and use the logging module to log the details to that >> file instead of printing them. > > This may suffer of excessi

Re: newb question about @property

2017-10-03 Thread Lele Gaifax
Steve D'Aprano writes: > (9) [ADVANCED] Modify the decorator from (8) to take an argument specifying > the > path to a file, and use the logging module to log the details to that file > instead of printing them. This may suffer of excessive creativity, as usually the details of *where* a logger

Re: INSTRUCTOR SOLUTIONS MANUAL Elementary Linear Algebra by Kuttler

2017-10-03 Thread fuad
Engineering Fluid Mechanics, 10th Edition by Crowe, Elger solution fuadnassa...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: newb question about @property

2017-10-03 Thread Steve D'Aprano
On Tue, 3 Oct 2017 06:51 am, Bill wrote: > Can you inspire me with a good decorator problem (standard homework > exercise-level will be fine)? Here is a nice even dozen problems for you. Please ask for clarification if any are unclear. (1) Write a decorator which simply prints a descriptive m

Re: Spam

2017-10-03 Thread alister via Python-list
> They are literally criminals, they use computer viruses and malware to > hijack people's computers to send their spam, and you want to trust them > and buy from them? this was probably a "Drive By" posy to get the original spam more attention & possibly bypass spam filters -- Come live w