Re: the best online course

2016-07-10 Thread Bob Martin
in 762247 20160709 223746 Malik Rumi  wrote:
>I want one of those "knuckle down and learn" classes. But even more than th=
>at, I want a class with a real teacher who is available to answer questions=
>and explain things. I've done a lot of books and online video, but there's=
>usually no help. If I search around long enough, I can often find an answe=
>r, but this is just way too fragmented for me. Where can I find classes lik=
>e that - online - paid or free? Thanks.

Having to work for your answer means you are more likely to remember it.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Curious Omission In New-Style Formats

2016-07-10 Thread Ian Kelly
On Sat, Jul 9, 2016 at 11:54 PM, Lawrence D’Oliveiro
 wrote:
> In printf-style formats, you can specify the number of digits for an integer 
> separately from the field width. E.g.
>
> >>> "%#0.5x" % 0x123
> '0x00123'
>
> but not in new-style formats:
>
> >>> "{:#0.5x}".format(0x123)
> Traceback (most recent call last):
>   File "", line 1, in 
> ValueError: Precision not allowed in integer format specifier
>
> The field width itself doesn’t give the right number of digits in this case:
>
> >>> "{:#05x}".format(0x123)
> '0x123'
>
> because you lose 2 characters for the “0x” prefix.

So add 2 to the field width to account for the fixed-size prefix.

>>> '{:#07x}'.format(0x123)
'0x00123'

It's specified in PEP 3101 that the precision is ignored for integer
conversions. Apparently that changed from "ignored" to "not allowed"
in 3.1, as per the documentation. I'm not sure what the reasoning was,
except perhaps that precision doesn't really make sense for integers
in the first place.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Quick poll: gmean or geometric_mean

2016-07-10 Thread Ian Kelly
On Sat, Jul 9, 2016 at 3:45 PM, Chris Angelico  wrote:
> On Sat, Jul 9, 2016 at 3:26 PM, Steven D'Aprano  wrote:
>> I'd like to get a quick show of hands regarding the names. Which do you
>> prefer?
>>
>> hmean and gmean
>>
>> harmonic_mean and geometric_mean
>
> I'd prefer the shorter names.

I'd prefer the longer. Anybody who wants gmean can easily type:

from statistics import geometric_mean as gmean
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Quick poll: gmean or geometric_mean

2016-07-10 Thread Rustom Mody
On Saturday, July 9, 2016 at 10:56:27 AM UTC+5:30, Steven D'Aprano wrote:
> As requested in issue 27181 on the bug tracker, I'm adding functions to
> calculate the harmonic and geometric means to the statistics module.
> 
> I'd like to get a quick show of hands regarding the names. Which do you
> prefer?
> 
> hmean and gmean
> 
> harmonic_mean and geometric_mean
> 
> 
> Remember that the arithmetic mean is just called "mean".
> 
> http://bugs.python.org/issue27181

From fuzzy memory of sitting in statistics classes decades ago 
filled with μ-σ etc I'd suggest μ gμ hμ 

And before I duck and run let me just tell my dear Chris I was only ½-joking
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Quick poll: gmean or geometric_mean

2016-07-10 Thread Jussi Piitulainen
Ian Kelly  writes:

> On Sat, Jul 9, 2016 at 3:45 PM, Chris Angelico  wrote:
>> On Sat, Jul 9, 2016 at 3:26 PM, Steven D'Aprano  wrote:
>>> I'd like to get a quick show of hands regarding the names. Which do you
>>> prefer?
>>>
>>> hmean and gmean
>>>
>>> harmonic_mean and geometric_mean
>>
>> I'd prefer the shorter names.
>
> I'd prefer the longer. Anybody who wants gmean can easily type:
>
> from statistics import geometric_mean as gmean

That argument goes both ways with equal force. Possibly very slightly in
favour of the *shorter* names, for those who are happy to import the
function with its eventual name as is.

I did say "very slightly".
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Quick poll: gmean or geometric_mean

2016-07-10 Thread Steven D'Aprano
On Sun, 10 Jul 2016 05:28 pm, Rustom Mody wrote:

> From fuzzy memory of sitting in statistics classes decades ago
> filled with μ-σ etc I'd suggest μ gμ hμ

In all the stats books and references I've seen, μ is always the population
mean (implicitly the arithmetic mean). When discussing the different kinds
of mean, A, G and H are used for arithmetic, geometric and harmonic means.
(Other means are rarely discussed.)

I don't think I've ever seen gµ or hµ. They're sort of backwards... I'd
expect µ subscript-g or subscript-h, not the other way.



-- 
Steven
“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: Quick poll: gmean or geometric_mean

2016-07-10 Thread Michael Selik
On Sun, Jul 10, 2016, 4:56 AM Steven D'Aprano  wrote:

> On Sun, 10 Jul 2016 05:28 pm, Rustom Mody wrote:
>
> > From fuzzy memory of sitting in statistics classes decades ago
> > filled with μ-σ etc I'd suggest μ gμ hμ
>
> In all the stats books and references I've seen, μ is always the population
> mean (implicitly the arithmetic mean). When discussing the different kinds
> of mean, A, G and H are used for arithmetic, geometric and harmonic means.
> (Other means are rarely discussed.)
>
> I don't think I've ever seen gµ or hµ. They're sort of backwards... I'd
> expect µ subscript-g or subscript-h, not the other way.
>

I'm glad you brought up textbooks as it reminded me to say that most
scientific software is still struggling to shake off the legacy of
abbreviation.

Now even the basic IPython shell has autocomplete :-)

>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Quick poll: gmean or geometric_mean

2016-07-10 Thread Steven D'Aprano
On Sun, 10 Jul 2016 07:24 pm, Michael Selik wrote:

> On Sun, Jul 10, 2016, 4:56 AM Steven D'Aprano  wrote:
> 
>> On Sun, 10 Jul 2016 05:28 pm, Rustom Mody wrote:
>>
>> > From fuzzy memory of sitting in statistics classes decades ago
>> > filled with μ-σ etc I'd suggest μ gμ hμ
>>
>> In all the stats books and references I've seen, μ is always the
>> population mean (implicitly the arithmetic mean). When discussing the
>> different kinds of mean, A, G and H are used for arithmetic, geometric
>> and harmonic means. (Other means are rarely discussed.)
>>
>> I don't think I've ever seen gµ or hµ. They're sort of backwards... I'd
>> expect µ subscript-g or subscript-h, not the other way.
>>
> 
> I'm glad you brought up textbooks as it reminded me to say that most
> scientific software is still struggling to shake off the legacy of
> abbreviation.
> 
> Now even the basic IPython shell has autocomplete :-)

Not all shells or editors are IPython, and not all abbreviations are bad.
Would you rather print, or
write_values_as_strings_to_the_predefined_standard_output_file?

:-)


-- 
Steven
“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: Quick poll: gmean or geometric_mean

2016-07-10 Thread Chris Angelico
On Sun, Jul 10, 2016 at 8:08 PM, Steven D'Aprano  wrote:
>> Now even the basic IPython shell has autocomplete :-)
>
> Not all shells or editors are IPython, and not all abbreviations are bad.
> Would you rather print, or
> write_values_as_strings_to_the_predefined_standard_output_file?

Also: Interesting that the IPython shell is "basic". I thought the
basic Python shell was the one you get when you type "python" with no
args. Idle or IPython or anything else is a layer on top of that.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Quick poll: gmean or geometric_mean

2016-07-10 Thread Rustom Mody
On Sunday, July 10, 2016 at 3:39:02 PM UTC+5:30, Steven D'Aprano wrote:
> On Sun, 10 Jul 2016 07:24 pm, Michael Selik wrote:
> 
> > On Sun, Jul 10, 2016, 4:56 AM Steven D'Aprano  wrote:
> > 
> >> On Sun, 10 Jul 2016 05:28 pm, Rustom Mody wrote:
> >>
> >> > From fuzzy memory of sitting in statistics classes decades ago
> >> > filled with μ-σ etc I'd suggest μ gμ hμ
> >>
> >> In all the stats books and references I've seen, μ is always the
> >> population mean (implicitly the arithmetic mean). When discussing the
> >> different kinds of mean, A, G and H are used for arithmetic, geometric
> >> and harmonic means. (Other means are rarely discussed.)
> >>
> >> I don't think I've ever seen gµ or hµ. They're sort of backwards... I'd
> >> expect µ subscript-g or subscript-h, not the other way.
> >>
> > 
> > I'm glad you brought up textbooks as it reminded me to say that most
> > scientific software is still struggling to shake off the legacy of
> > abbreviation.
> > 
> > Now even the basic IPython shell has autocomplete :-)
> 
> Not all shells or editors are IPython, and not all abbreviations are bad.
> Would you rather print, or
> write_values_as_strings_to_the_predefined_standard_output_file?
> 
> :-)

Newton's law F = -Gm₁m₂/r²

Better seen in its normal math form:
https://en.wikipedia.org/wiki/Newton%27s_law_of_universal_gravitation#Modern_form

De-abbreviated

Force is given by the negative of the universal_gravitational_constant times
the mass_of_first_body times mass_of_second_body divided by the square of the 
distance_between_the_bodies

Cobol anyone?

Ok with typical python naming

Force = (universal_gravitational_constant * mass_of_first_body * 
mass_of_second_body) / (distance_between_the_bodies*distance_between_the_bodies)

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Quick poll: gmean or geometric_mean

2016-07-10 Thread Rustom Mody
On Sunday, July 10, 2016 at 8:00:00 PM UTC+5:30, Rustom Mody wrote:
> Newton's law F = -Gm₁m₂/r²
> 
> Better seen in its normal math form:
> https://en.wikipedia.org/wiki/Newton%27s_law_of_universal_gravitation#Modern_form
> 
> De-abbreviated
> 
> Force is given by the negative of the universal_gravitational_constant times
> the mass_of_first_body times mass_of_second_body divided by the square of the 
> distance_between_the_bodies
> 
> Cobol anyone?

Actually I do injustice to Cobol.
Cobol allowed hyphenated names -- more readable than underscored:

Force is given by the negative of the universal-gravitational-constant times
the mass-of-first-body times mass-of-second-body divided by the square of the 
distance-between-the-bodies
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Quick poll: gmean or geometric_mean

2016-07-10 Thread Ian Kelly
On Sun, Jul 10, 2016 at 8:29 AM, Rustom Mody  wrote:
> Newton's law F = -Gm₁m₂/r²
>
> Better seen in its normal math form:
> https://en.wikipedia.org/wiki/Newton%27s_law_of_universal_gravitation#Modern_form
>
> De-abbreviated
>
> Force is given by the negative of the universal_gravitational_constant times
> the mass_of_first_body times mass_of_second_body divided by the square of the 
> distance_between_the_bodies
>
> Cobol anyone?
>
> Ok with typical python naming
>
> Force = (universal_gravitational_constant * mass_of_first_body * 
> mass_of_second_body) / 
> (distance_between_the_bodies*distance_between_the_bodies)

That's still excessive by any reasonable standards. Names should be
descriptive, but no more verbose than necessary. How about:

force_N = -G * mass1_kg * mass2_kg / distance_m ** 2

I'm fine with "G" as is because it's the standard name for the value
in physics contexts, and it's presumably defined in the code as a
constant. It's every bit as clear as "pi".
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Quick poll: gmean or geometric_mean

2016-07-10 Thread Ian Kelly
On Sun, Jul 10, 2016 at 2:01 AM, Jussi Piitulainen
 wrote:
> Ian Kelly  writes:
>
>> On Sat, Jul 9, 2016 at 3:45 PM, Chris Angelico  wrote:
>>> On Sat, Jul 9, 2016 at 3:26 PM, Steven D'Aprano  wrote:
 I'd like to get a quick show of hands regarding the names. Which do you
 prefer?

 hmean and gmean

 harmonic_mean and geometric_mean
>>>
>>> I'd prefer the shorter names.
>>
>> I'd prefer the longer. Anybody who wants gmean can easily type:
>>
>> from statistics import geometric_mean as gmean
>
> That argument goes both ways with equal force. Possibly very slightly in
> favour of the *shorter* names, for those who are happy to import the
> function with its eventual name as is.
>
> I did say "very slightly".

No, it doesn't. That the user can alias the name in their own code is
not an advantage at all for picking a non-descriptive name. It doesn't
change the fact that you have a non-descriptive name for the function
in the docs, the examples, and as the default. And do you really think
that anybody would ever choose an alias to make the name of a function
*longer*?

If you start out with the descriptive name though, then you get all
the benefits of such, and users who want to can easily shorten it. And
then even in code where it's been aliased to be shorter, the full
descriptive name is still visible in at least one place -- the import
statement -- which is at least somewhat helpful to anybody reading the
module who isn't familiar with the "gmean" function.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Quick poll: gmean or geometric_mean

2016-07-10 Thread Marko Rauhamaa
Ian Kelly :

> That's still excessive by any reasonable standards. Names should be
> descriptive, but no more verbose than necessary. How about:
>
> force_N = -G * mass1_kg * mass2_kg / distance_m ** 2

Why bother with tagging the names with standard units?

Somewhat related: Many programming frameworks standardize on
milliseconds when expressing durations. Python does the honorable thing
and uses the standard unit, the second, for the purpose. For example,

coroutine asyncio.wait(futures, *, loop=None, timeout=None,
   return_when=ALL_COMPLETED)

   [...]

   timeout can be used to control the maximum number of seconds to
   wait before returning. timeout can be an int or float. If timeout
   is not specified or None, there is no limit to the wait time.

   https://docs.python.org/3/library/asyncio-task.html?highligh
   t=asyncio.wait>


Not only is a universal standard followed but the API is future proof as
it allows for (almost) arbitrary granularity. Want to timeout after 17
femtoseconds? Just specify timeout=17e-15.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


one command on backslash and space for review

2016-07-10 Thread Ganesh Pal
Hello Team,

I am on python 2.7 and  Linux , I  want to  form the below sample
command so that I could run it on the shell.

Command is --> run_parallel -za1 -s 'daemon -cf xyz; sleep 1'

Here is how I formed the command and it seems to look fine and work
fine , but I think it could still be better any idea ?

>>> cmd = "run_parallel -za" + str(number) + \
...   " -s" + " \'daemon -cf xyz; sleep 1\'"
>>> cmd
"run_parallel -za1 -s 'daemon -cf xyz; sleep 1'"
>>>

Looking for thoughts around:

1. If backslash are syntactically  correct

2.  " -s" , starting with a leading space , may be its not a good idea
, other ways

3. Iam running sleep command on the cluster i.e , how could I make it
look Python or its fine to have sleep ?

Regards,

Ganesh
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Quick poll: gmean or geometric_mean

2016-07-10 Thread Michael Selik
On Sun, Jul 10, 2016, 5:08 AM Chris Angelico  wrote:

> On Sun, Jul 10, 2016 at 8:08 PM, Steven D'Aprano 
> wrote:
> >> Now even the basic IPython shell has autocomplete :-)
> >
> > Not all shells or editors are IPython, and not all abbreviations are bad.
> > Would you rather print, or
> > write_values_as_strings_to_the_predefined_standard_output_file?
>
> Also: Interesting that the IPython shell is "basic". I thought the
> basic Python shell was the one you get when you type "python" with no
> args. Idle or IPython or anything else is a layer on top of that.
>

It is. I meant the basic terminal version of IPython, rather than the QT or
Jupyter version.

IPython 5 switched from readline to prompt_toolkit, so it gained a few nice
features.

>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Quick poll: gmean or geometric_mean

2016-07-10 Thread Random832
On Sun, Jul 10, 2016, at 10:55, Ian Kelly wrote:
> force_N = -G * mass1_kg * mass2_kg / distance_m ** 2
> 
> I'm fine with "G" as is because it's the standard name for the value
> in physics contexts, and it's presumably defined in the code as a
> constant. It's every bit as clear as "pi".

Shouldn't it be G_N_m2_per_kg2, given your strategy for identifying the
units associated with the other variables?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: the best online course

2016-07-10 Thread Ethan Furman

On 07/10/2016 12:18 AM, Bob Martin wrote:

in 762247 20160709 223746 Malik Rumi wrote:



I want one of those "knuckle down and learn" classes. But even more than th=
at, I want a class with a real teacher who is available to answer questions=
and explain things. I've done a lot of books and online video, but there's=
usually no help. If I search around long enough, I can often find an answe=
r, but this is just way too fragmented for me. Where can I find classes lik=
e that - online - paid or free? Thanks.


Having to work for your answer means you are more likely to remember it.


True, but like most things there is a balance -- searching for hours for 
an answer is frustrating and discouraging, and the thing most likely 
remembered is not the answer the pain in finding it.


--
~Ethan~

--
https://mail.python.org/mailman/listinfo/python-list


Re: Quick poll: gmean or geometric_mean

2016-07-10 Thread Ian Kelly
On Sun, Jul 10, 2016 at 9:03 AM, Marko Rauhamaa  wrote:
> Ian Kelly :
>
>> That's still excessive by any reasonable standards. Names should be
>> descriptive, but no more verbose than necessary. How about:
>>
>> force_N = -G * mass1_kg * mass2_kg / distance_m ** 2
>
> Why bother with tagging the names with standard units?

The point of the example was to demonstrate descriptive names. For
local variables I usually wouldn't bother with the units, but in
general it's a good practice to help avoid crashing your orbiter into
Mars.

> Shouldn't it be G_N_m2_per_kg2, given your strategy for identifying the
> units associated with the other variables?

To me, the use of the standard name implies standard units, so no, "G"
is sufficient. YMMV.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: one command on backslash and space for review

2016-07-10 Thread Ian Kelly
On Sun, Jul 10, 2016 at 9:19 AM, Ganesh Pal  wrote:
> Hello Team,
>
> I am on python 2.7 and  Linux , I  want to  form the below sample
> command so that I could run it on the shell.
>
> Command is --> run_parallel -za1 -s 'daemon -cf xyz; sleep 1'
>
> Here is how I formed the command and it seems to look fine and work
> fine , but I think it could still be better any idea ?
>
 cmd = "run_parallel -za" + str(number) + \
> ...   " -s" + " \'daemon -cf xyz; sleep 1\'"

cmd = "run_parallel -za{} -s 'daemon -cf xyz; sleep 1'".format(number)

> Looking for thoughts around:
>
> 1. If backslash are syntactically  correct

They're correct, but using them before single quotes in a string
delimited by double quotes is unnecessary.

> 3. Iam running sleep command on the cluster i.e , how could I make it
> look Python or its fine to have sleep ?

I don't understand the question.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: one command on backslash and space for review

2016-07-10 Thread Ganesh Pal
On Jul 10, 2016 11:14 PM, "Ian Kelly"  wrote:
> They're correct, but using them before single quotes in a string
> delimited by double quotes is unnecessary.

Thanks .

> > 3. Iam running sleep command on the cluster i.e , how could I make it
> > look Python or its fine to have sleep ?
>
> I don't understand the question.
>
Sorry I was in sleep 😂😂 I typed something wrong . Let me explain it.
Better In the below command I.e

'run_parallel -za1 -s 'daemon -cf xyz; sleep 1'

We have a sleep  1 that's run run as part of abovry shell command . It
looks ok but   is there a way to use something alternative to sleep was my
question. I guess the answer is " no" , because we are executing shell
sleep command I think something pythonic like  time.sleep is not possible.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: one command on backslash and space for review

2016-07-10 Thread Chris Angelico
On Mon, Jul 11, 2016 at 4:35 AM, Ganesh Pal  wrote:
> 'run_parallel -za1 -s 'daemon -cf xyz; sleep 1'
>
> We have a sleep  1 that's run run as part of abovry shell command . It
> looks ok but   is there a way to use something alternative to sleep was my
> question. I guess the answer is " no" , because we are executing shell
> sleep command I think something pythonic like  time.sleep is not possible.

That would be correct.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Curious Omission In New-Style Formats

2016-07-10 Thread Lawrence D’Oliveiro
On Sunday, July 10, 2016 at 7:22:42 PM UTC+12, Ian wrote:
> On Sat, Jul 9, 2016 at 11:54 PM, Lawrence D’Oliveiro wrote:
>> In printf-style formats, you can specify the number of digits for an
>> integer separately from the field width. E.g.
>>
>> >>> "%#0.5x" % 0x123
>> '0x00123'
>>
> except perhaps that precision doesn't really make sense for integers
> in the first place.

Except that it does make sense, as I showed in my example.


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: the best online course

2016-07-10 Thread Rustom Mody
On Sunday, July 10, 2016 at 10:36:39 PM UTC+5:30, Ethan Furman wrote:
> On 07/10/2016 12:18 AM, Bob Martin wrote:
> > in 762247 20160709 223746 Malik Rumi wrote:
> 
> >> I want one of those "knuckle down and learn" classes. But even more than 
> >> th=
> >> at, I want a class with a real teacher who is available to answer 
> >> questions=
> >> and explain things. I've done a lot of books and online video, but there's=
> >> usually no help. If I search around long enough, I can often find an answe=
> >> r, but this is just way too fragmented for me. Where can I find classes 
> >> lik=
> >> e that - online - paid or free? Thanks.
> >
> > Having to work for your answer means you are more likely to remember it.
> 
> True, but like most things there is a balance -- searching for hours for 
> an answer is frustrating and discouraging, and the thing most likely 
> remembered is not the answer the pain in finding it.

Yes balance is key…
Bruno Buchberger formulated the “blackbox-whitebox principle” :

===
Although math software systems, in particular those based on advance symbolic 
computation techniques, are now heavily considered for improving and supporting 
math teaching all over the world, there is still a lot of confusion about their 
appropriate use in math teaching. There seems to exist an unbridgeable 
disagreement between those who believe that these systems must not be used in 
teaching in order not to "spoil the abilities of the students" and those who 
believe that, with the availability of these systems, teaching the mathematical 
techniques covered by theses systems is not any more necessary and , rather we 
should confine ourselves to teach how to use of these systems.

For bridging this disagreement I introduced, in 1989, the "White-Box / 
Black-Box Principle" for the didactics of using symbolic computation systems in 
math teaching: I am advocating that, in the "white-box" phase of teaching a 
particular mathematical topic (i.e. the phase in which the topic is new to the 
students), the pertinent parts of the SC systems should not be used, while in 
the "black-box" phase (in which the students completely master the new topic), 
it is essential for modern teaching of math to use these systems. The principle 
is recursive because, what was "white-box" in a particular phase of teaching 
becomes "black-box" in a later stage and new topics become "white-box" that use 
earlier "black boxes" as building blocks. 


This was formulated in 1989 for computer algebra systems
http://www.risc.jku.at/people/buchberger/white_box.html

Today it applies across the board to anything, any field…

Python is good for black-box – us the ‘batteries included’ without worrying too
much how they are made
Scheme, assembly language, Turing machines etc are at the other end of the
spectrum

People wanting to learn should (IMHO) experience both sides
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: the best online course

2016-07-10 Thread Ethan Furman

On 07/09/2016 04:21 PM, Chris Angelico wrote:


Yes, I hear a lot about Udacity. Has anyone taken any of the pay-for
classes? Are the instructors helpful, skilled, etc? Did it seem like
good value for money?


Yes.  Yes, yes.  Yes.  :)

--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list


Re: one command on backslash and space for review

2016-07-10 Thread Ganesh Pal
>
>
>
>  cmd = "run_parallel -za" + str(number) + \
> > ...   " -s" + " \'daemon -cf xyz; sleep 1\'"
>
> cmd = "run_parallel -za{} -s 'daemon -cf xyz; sleep 1'".format(number)
>
>
How will I format number to strings  using .format ??

Example

>>> str(num)

'100'

>>> cmd = "run_parallel -za{} -s 'daemon -cf xyz; sleep 1'".format(str(num))

>>> cmd

"run_parallel -za100 -s 'daemon -cf xyz; sleep 1'“.

Will Something like format(str(num)) work ? it working though


Regards,

Ganesh
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: one command on backslash and space for review

2016-07-10 Thread Ben Finney
Ganesh Pal  writes:

> How will I format number to strings  using .format ??

To make best use of ‘str.format’, read its documentation thoroughly
https://docs.python.org/3/library/string.html#formatstrings>.

To format numbers to strings, you choose which representation you want;
e.g. “decimal integer”. Then, use the appropriate format syntax for that
representation (in that case, the ‘d’ type specifier).

> Example
>
> >>> str(num)

That creates a new string object, by asking the integer object to return
its string representation. That gives you no choice in the
representation, which is the opposite of what you are asking for.

> >>> cmd = "run_parallel -za{} -s 'daemon -cf xyz; sleep 1'".format(str(num))

The ‘{}‘ format string takes all the defaults for that parameter. If you
want to customise the format, choose the specification and put it inside
the ‘{’ and ‘}’ characters.

-- 
 \ “I know when I'm going to die, because my birth certificate has |
  `\   an expiration date.” —Steven Wright |
_o__)  |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: the best online course

2016-07-10 Thread Steven D'Aprano
On Monday 11 July 2016 13:07, Rustom Mody wrote:

> Python is good for black-box – us the ‘batteries included’ without worrying
> too much how they are made
> Scheme, assembly language, Turing machines etc are at the other end of the
> spectrum

I would put it the other way.

Python is excellent for "white boxes", because the syntax is extremely 
approachable, easy to read and comprehend. (Although you may wish to avoid some 
of the more complicated and hairy features if your emphasis is on learning.) 
It's famous for being "executable pseudo-code" and neither too concise nor too 
verbose, and lacks the syntactic cruft which can impede understanding (braces, 
type declarations), which makes it excellent for teaching about algorithms, 
etc. But for some tasks, at least, it may lack speed and efficiency to be a 
practical "black box".

Scheme, assembly, C, Forth etc are excellent for black boxes, as they are 
extremely efficient languages, but not so approachable, readable and 
comprehensible.

Turing machines are to be avoided except for academic proofs that a certain 
feature or language is equivalent to a Turing machine, in which case we know 
precisely how much power it has, computation-wise. Turing machines are neither 
efficient enough to be used as black boxes, nor comprehensible enough to be 
used for white boxes.

Take Python's StringIO class. Would you rather *read* the Python version or the 
C version? Which would you rather *use*?



-- 
Steve

-- 
https://mail.python.org/mailman/listinfo/python-list


Visualising relationships between packages

2016-07-10 Thread Steven D'Aprano
https://kozikow.com/2016/07/10/visualizing-relationships-between-python-packages-2/


-- 
Steve

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: the best online course

2016-07-10 Thread Bob Martin
in 762282 20160711 063300 Steven D'Aprano 
 wrote:
>On Monday 11 July 2016 13:07, Rustom Mody wrote:
>
>> Python is good for black-box – us the ‘batteries included’ without 
>> worrying
>> too much how they are made
>> Scheme, assembly language, Turing machines etc are at the other end of the
>> spectrum
>
>I would put it the other way.
>
>Python is excellent for "white boxes", because the syntax is extremely
>approachable, easy to read and comprehend. (Although you may wish to avoid some
>of the more complicated and hairy features if your emphasis is on learning.)
>It's famous for being "executable pseudo-code" and neither too concise nor too
>verbose, and lacks the syntactic cruft which can impede understanding (braces,
>type declarations), which makes it excellent for teaching about algorithms,
>etc. But for some tasks, at least, it may lack speed and efficiency to be a
>practical "black box".
>
>Scheme, assembly, C, Forth etc are excellent for black boxes, as they are
>extremely efficient languages, but not so approachable, readable and
>comprehensible.
>
>Turing machines are to be avoided except for academic proofs that a certain
>feature or language is equivalent to a Turing machine, in which case we know
>precisely how much power it has, computation-wise. Turing machines are neither
>efficient enough to be used as black boxes, nor comprehensible enough to be
>used for white boxes.
>
>Take Python's StringIO class. Would you rather *read* the Python version or the
>C version? Which would you rather *use*?

The Rexx version  :-))
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: the best online course

2016-07-10 Thread Rustom Mody
On Monday, July 11, 2016 at 11:03:37 AM UTC+5:30, Steven D'Aprano wrote:
> On Monday 11 July 2016 13:07, Rustom Mody wrote:
> 
> > Python is good for black-box – us the ‘batteries included’ without worrying
> > too much how they are made
> > Scheme, assembly language, Turing machines etc are at the other end of the
> > spectrum
> 
> I would put it the other way.
> 
> Python is excellent for "white boxes", because the syntax is extremely 
> approachable, easy to read and comprehend. (Although you may wish to avoid 
> some 
> of the more complicated and hairy features if your emphasis is on learning.) 
> It's famous for being "executable pseudo-code" and neither too concise nor 
> too 
> verbose, and lacks the syntactic cruft which can impede understanding 
> (braces, 
> type declarations), which makes it excellent for teaching about algorithms, 
> etc. But for some tasks, at least, it may lack speed and efficiency to be a 
> practical "black box".
> 
> Scheme, assembly, C, Forth etc are excellent for black boxes, as they are 
> extremely efficient languages, but not so approachable, readable and 
> comprehensible.
> 
> Turing machines are to be avoided except for academic proofs that a certain 
> feature or language is equivalent to a Turing machine, in which case we know 
> precisely how much power it has, computation-wise. Turing machines are 
> neither 
> efficient enough to be used as black boxes, nor comprehensible enough to be 
> used for white boxes.
> 
> Take Python's StringIO class. Would you rather *read* the Python version or 
> the 
> C version? Which would you rather *use*?

Black box and White box are not mutually exclusive – I think that is one basic
point of Buchberger.
So your examples are fine [Though I dunno what you mean by scheme is efficient]

Here are some examples in the complementary sense

Most used python web framework seems to be Django
How much python does a Django programmer need to know?

Want to play around with a symbolic algebra system?
Install sympy and start off.  How much python is needed?

By contrast, polynomial addition/multiplication (in C) is a typical intermediate
data structure project [You can slot python either way on this one]

A lisp interpreter in lisp is one page/one hour
http://www.paulgraham.com/mcilroy.html
gcc in gcc is 15 million lines 
http://www.phoronix.com/scan.php?page=news_item&px=MTg3OTQ

-- 
https://mail.python.org/mailman/listinfo/python-list