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
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
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,
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
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
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".
[...]
>
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
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( "
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
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
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):
...
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
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
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
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
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.
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
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
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
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
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
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
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
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 (
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
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
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
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
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
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
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
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
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
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
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
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
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
Engineering Fluid Mechanics, 10th Edition by Crowe, Elger solution
fuadnassa...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
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
> 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
40 matches
Mail list logo