Re: we want python software

2017-12-06 Thread Percival John Hackworth
On 05-Dec-2017, km wrote
(in article):

> I dont know how these students are selected into b tech stream in India.
> they are so dumb. All they know is a to open a program we need to double
> click it and it runs.- windoze legacy. most of the time they pay huge
> amount to a greedy college and get into tech stream.
> Now that Java boom (jobs) is over in India and python is booming in AI and
> machine learning these people want to learn python and get easy jobs
> (software coolies). pls dont even entertain such posts.
A friend who deals with outsource Indian developers told me something 
interesting. Apparently, the programmers are paid very poorly in India. 
Managers are paid much better. So the career path over there is to "pay your 
dues" writing code, then become a manager where you no longer have to write 
code. It means that all the product teams that are outsourced to India 
*always* get new, green people because as soon as they get any good, they 
become managers.

That explains a lot, doesn't it. It also means when your company lays off a 
lot of technical staff and outsources tech pubs, 1st line support, and 
development to India, the people left in the US are the "Tiger Team" to fix 
screw ups or major issues in a product release. Then they sell the company.

Another friend hired a programmer from India to develop a java-based web site 
to sell their product in the iOS App Store. He asked me to look at problems 
they were having with the site. I'm a sysadmin, not a java programmer, but I 
knew that you're not supposed to run a Tomcat web server as root. According 
to friends, you're not supposed to expose Tomcat to the internet at all. 
That's not what this developer did. It looked like it was a school project 
that he setup stuff but didn't know how it's done in production with security 
enabled. Nor could he deal with AWS.

It's a nightmare out there for people looking to get development done "on the 
cheap". The good people (e.g. the friends I asked for advice) are to busy to 
do such little projects to bother. So the market is left with Junior people 
in India making crap. It's not a question of them taking jobs away from U.S. 
developers. It's a question of the good ones already have work. Can we train 
Joe to setup Wordpress and secure it or write a Java Web site when all he's 
done before is manufacturing or worked in a grocery store.

Other groups aren't so nice to beginners - the perl group is brutal and tell 
a student to do their own homework. I'm just dipping my toe into python here 
and you guys more helpful. Mostly because there's so much possibility in 
python (compared to other scripting languages).

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


Re: f-string

2017-12-06 Thread Steve D'Aprano
On Wed, 6 Dec 2017 12:21 pm, Chris Angelico wrote:

> On Wed, Dec 6, 2017 at 11:54 AM, John Pote 
> wrote:
>>
>> On 06/12/2017 00:16, Steve D'Aprano wrote:
>>>
>>> Anyone got a handy copy of Python 3.6 available to test something for me?
>>>
>>> What does compile('f"{spam} {eggs}"', '', 'single') return?

[...] 

> I think Steve just wanted to see what we'd all define spam and eggs as.
> 
> ChrisA
> *ducking for cover*

Possibly duck eggs :-)


I was thinking of responding to your comment on Python-Ideas that said there
is no way to represent an unevaluated f-string in Python, but then I decided
that even for me that was too pedantic.




-- 
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: f-string

2017-12-06 Thread Chris Angelico
On Wed, Dec 6, 2017 at 8:24 PM, Steve D'Aprano
 wrote:
> On Wed, 6 Dec 2017 12:21 pm, Chris Angelico wrote:
>
>> On Wed, Dec 6, 2017 at 11:54 AM, John Pote 
>> wrote:
>>>
>>> On 06/12/2017 00:16, Steve D'Aprano wrote:

 Anyone got a handy copy of Python 3.6 available to test something for me?

 What does compile('f"{spam} {eggs}"', '', 'single') return?
>
> [...]
>
>> I think Steve just wanted to see what we'd all define spam and eggs as.
>>
>> ChrisA
>> *ducking for cover*
>
> Possibly duck eggs :-)
>
>
> I was thinking of responding to your comment on Python-Ideas that said there
> is no way to represent an unevaluated f-string in Python, but then I decided
> that even for me that was too pedantic.
>

Considering that it isn't an object, it'd be on par with saying that
there's no way to represent an unevaluated "if-else" expression. You
can wrap it in a function and carry that function around, or you can
use the source code and then exec it when you need it, but neither of
those really represents an unevaluated f-string - they represent
something else that might be equivalent. So yeah, even for the great
D'Aprano, that would be a bit too pedantic. :)

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


Re: we want python software

2017-12-06 Thread Steve D'Aprano
On Wed, 6 Dec 2017 03:45 pm, Abhiram R wrote:

> On Wed, Dec 6, 2017 at 10:08 AM, km  wrote:
> 
>> I dont know how these students are selected into b tech stream in India.
>> they are so dumb. All they know is a to open a program we need to double
>> click it and it runs.
>>
>> We were all once "dumb". We learnt it because someone Taught us.


Since you're so open to being corrected, let me remind you to read your posts
before sending. Somehow you managed to introduce an extra > quote marker at
the beginning of your own comment, (the line starting "We were all once...").
Check it out here:

https://mail.python.org/pipermail/python-list/2017-December/729112.html

and you will see that your comment is quoted, as if it were written by the
person you are replying to.

(Normally I wouldn't bother mentioning something so trivial, but since you
make the excellent point that we don't learn to correct mistakes unless we
have them pointed out, I thought I'd do so.)


> I'd rather not entertain such or refrain from condescending replies

I think you have misunderstood the word "condescending".

It is condescending to assume that the OP, Jyothiswaroop Reddy, is a fragile
and delicate little hothouse flower that needs protecting from reality where
people will tell you "Don't be so lazy and don't waste our time".

I prefer to expect more of people and let them meet my expectations, than to
downgrade my expectations and coddle them into a spiral of lower and lower
competence and ability.

(By the way Rustom, if you're reading, thank you for that link to the video a
few weeks ago about teaching 2 + 2 = 22. My blood pressure just about doubled
watching it.)




-- 
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: Python homework

2017-12-06 Thread D'Arcy Cain

On 12/05/2017 07:33 PM, nick.martinez2--- via Python-list wrote:

I have a question on my homework. My homework is to write a program in which 
the computer simulates the rolling of a die 50
times and then prints
(i). the most frequent side of the die
(ii). the average die value of all rolls.
I wrote the program so it says the most frequent number out of all the rolls for example 
(12,4,6,14,10,4) and will print out "14" instead of 4 like I need.


How did you come up with 4?  I come up with 3.36 with those numbers.


This is what I have so far:
import random

def rollDie(number):
 rolls = [0] * 6


For a small efficiency use "[0] * 7".  See below for reason.


 for i in range(0, number):
 roll=int(random.randint(1,6))
 rolls[roll - 1] += 1


Use "rolls[roll] += 1" here.  You save one arithmetic instruction each 
time through the loop.  Fifty times isn't much saving but imagine fifty 
million.



 return rolls


return rolls[1:].  No matter how many rolls you only need to do the 
slice once.  However, you really need a lot of iterations before it 
really affects the total run time.


You need one more thing though.  Create a new variable called "total" 
and set it to 0.0.  Add "total += roll" to your loop.  your return 
statement is now "return rolls[1:], total/number".




if __name__ == "__main__":
 result = rollDie(50)


Now "result, average = ..."


 print (result)
 print(max(result))


This is why you get 14.  The maximum number of rolls for any one side is 
14 for side 4.  Is that where you got "4"?


--
D'Arcy J.M. Cain
Vybe Networks Inc.
http://www.VybeNetworks.com/
IM:[email protected] VoIP: sip:[email protected]
--
https://mail.python.org/mailman/listinfo/python-list


Re: we want python software

2017-12-06 Thread Steve D'Aprano
On Wed, 6 Dec 2017 02:49 pm, Rustom Mody wrote:

> You are assuming that the strangeness of the request is about 'tech'
> [engineering/tech existed centuries before computers]
> 
> Do remember one can be a tech-{student,professional} without
> - ever having encountered free-software
> - internet/USENET culture
> 
> … from which pov the request would not look so odd

So you're suggesting that rather than being unwilling to google for "Download
Python" because he doesn't understand free software culture, the OP is
unwilling to google for "Download Python" because he thinks it is proprietary
software and wants a bunch of strangers on the Internet to send him a pirate
copy?

I'm not entirely sure that's better...



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


Politeness (was: we want python software)

2017-12-06 Thread Rustom Mody
On Wednesday, December 6, 2017 at 4:05:43 PM UTC+5:30, Steve D'Aprano wrote:
> On Wed, 6 Dec 2017 02:49 pm, Rustom Mody wrote:
> 
> > You are assuming that the strangeness of the request is about 'tech'
> > [engineering/tech existed centuries before computers]
> > 
> > Do remember one can be a tech-{student,professional} without
> > - ever having encountered free-software
> > - internet/USENET culture
> > 
> > … from which pov the request would not look so odd
> 
> So you're suggesting that rather than being unwilling to google for "Download
> Python" because he doesn't understand free software culture, the OP is
> unwilling to google for "Download Python" because he thinks it is proprietary
> software and wants a bunch of strangers on the Internet to send him a pirate
> copy?
> 
> I'm not entirely sure that's better...

Dunno anything about OP so no 'suggesting'…
I did hint one point above which can be restated more explicitly.

An engineering degree (aka “B.Tech”) can be in any of
- IT, CS, Computer Engineering etc
- aeronautics, civil, electrical, mechanical… classical, non-computer related
- bioinformatics, statistics, "scientific computing" etc ie heavy-duty *users*
  of computers

For the latter two classes it would be normal/natural for the student to have
little knowledge/interest in computer-related stuff except as a user.

Are you interested in the latest disk-drive technology? power-supplies?
 kernel? systemd-vs-sysv?  We use these all the time. Likewise these other 
fields are *users* of computers.

Inter alia I will mention: I have a colleague working on ACM's next curriculum
And the inter-disciplinarity of CS is the next big deal it would appear.

ie "unwilling to google" could well be "ignorant of google (usage/practices)"
Do consider the possibility that a student could be a non-owner of a computer
and/or studying in a college in a poor/non networked location.

So…

So while the specific slurs/attacks on some country are of near-zero interest 
to me — to support or oppose — the deeper divisions and inequities are (IMHO) 
more important.

So here's a little statistical exercise for you:
- Take any demographic of your choice containing programmers.
- Compute the male/female programmers in that population
- Now come to this list and work out the same ratio
- How do these ratios compare?
[When's the last time a woman appeared here?]

IOW I would wish Ethan's "control yourself" to be imperated — preferably
by oneself, if not then forcibly.
And especially when the vitriol is flung at a first-time poster.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [Python-Dev] [RELEASE] Python 3.6.4rc1 and 3.7.0a3 now available for testing

2017-12-06 Thread Steve Holden
Ned,

In your role as a representative of the many fine release managers Python
has had over the years I'd like to thank you for continuing to make
high-quality software available to a large and growing community. And
thanks to everyone who contributes to Python so the majority just get to
enjoy it.

Seasons greetings
Steve

Steve Holden

On Wed, Dec 6, 2017 at 2:29 AM, Ned Deily  wrote:

> Announcing the immediate availability of Python 3.6.4 release candidate 1
> and of Python 3.7.0 alpha 3!
>
> Python 3.6.4rc1 is the first release candidate for Python 3.6.4, the next
> maintenance release of Python 3.6.  While 3.6.4rc1 is a preview release
> and,
> thus, not intended for production environments, we encourage you to explore
> it and provide feedback via the Python bug tracker (
> https://bugs.python.org).
> 3.6.4 is planned for final release on 2017-12-18 with the next maintenance
> release expected to follow in about 3 months.  You can find Python 3.6.4rc1
> and more information here:
> https://www.python.org/downloads/release/python-364rc1/
>
> Python 3.7.0a3 is the third of four planned alpha releases of Python 3.7,
> the next feature release of Python.  During the alpha phase, Python 3.7
> remains under heavy development: additional features will be added
> and existing features may be modified or deleted.  Please keep in mind
> that this is a preview release and its use is not recommended for
> production environments.  The next preview release, 3.7.0a4, is planned
> for 2018-01-08. You can find Python 3.7.0a3 and more information here:
> https://www.python.org/downloads/release/python-370a3/
>
> --
>   Ned Deily
>   [email protected] -- []
>
> ___
> Python-Dev mailing list
> [email protected]
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> steve%40holdenweb.com
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Lies (was: we want python software)

2017-12-06 Thread Rustom Mody
On Wednesday, December 6, 2017 at 3:05:33 PM UTC+5:30, Steve D'Aprano wrote:
> (By the way Rustom, if you're reading, thank you for that link to the video a
> few weeks ago about teaching 2 + 2 = 22. My blood pressure just about doubled
> watching it.)

[Ref: https://youtu.be/Zh3Yz3PiXZw ]

Yes… Lies are a big problem today.
[For myself] Between being nice and being truthful, latter should have priority.

I was at first surprised and even a bit shocked when people called me 
right-wing.
Over time Ive come to accept that lies (left-wing) is upstream of hate 
(right-wing).  And to the extent that effects must be stemmed from causes, the 
world
is probably safer with the right than the left

Coming to this thread, I am surprised that you took to task Abhiram R for his
(minor) slips of posting,
neglecting to mention that the repeated vituperative posts of "KM" are 
chock-full of 
- grammatical errors
- spelling errors
- top-posting
- Indianisms like “lakh” “coolie” which are unlikely decipherable by an 
international audience 
And that in a post critical of Indians!
-- 
https://mail.python.org/mailman/listinfo/python-list


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 people in India making
> crap. It's not a question of them taking jobs away from
> U.S. developers. It's a question of the good ones already
> have work. Can we train Joe to setup Wordpress and secure
> it or write a Java Web site when all he's done before is
> manufacturing or worked in a grocery store.

Not easily, no. There are certain fundamental personality
attributes and natural inclinations that lend themselves
nicely to writing code.

(1) Strongly self-reliance

This cannot be stressed enough. If you're the type of person
who requires a micro-manager to hover over your shoulder all
day telling you what to do, then writing software is _not_
for you.

(2) Naturally analytical

If the greatest thought that has ever entered your mind is
"Hmm, i wonder what the Kardasians are doing today?", then
writing software is _not_ for you. There are plenty of
department stores who could use another brain-dead sales
rep. OTOH, if you find yourself intrigued by the inner
workings of just about every system and process in our
universe, then you may be an excellent candidate for this
field -- among many other mentally challenging fields.

(3) Logically inclined

If logic did not come naturally to you, or you feel that
logic is nothing but the philosophical penchant of sadistic
pedantics, then writing software is _absolutely_ not for
you. You simply cannot write software unless you possess a
strong grasp of logic.

(4) Exceptional problem solving skills  

Problem solving requires first breaking a problem structure
down into its component parts using your analytical skills,
and then applying logical solutions to each of these
components in a manner that will satisfy the whole.
Pragmatics is often your best friend. But you must not loose
sight of the bigger picture. For if you dismiss the delicate
and synergistic interplay between these components, your
naive solution will collapse on itself. Problem solving
requires thinking deeply in the abstract using metaphors,
applying diverse methodologies, and identifying the weak
spots in your proposed solution. Typically there isn't a
perfect solution. For, if there were a perfect solution to
every software problem, we could automate the software
development process. Code is not something you just yank out
of your colon like it were a fictional story for
entertainment purposes, no, it's called Engineering for a
_reason_.

The remainder can be taught, and mostly a matter of
memorization.

Any idiot of average intelligence can learn the syntax,
structural formatting rules and library contents of one or
more programming languages, however, if they lack the
aforementioned personality traits and natural skill sets,
they can't do much of anything with such knowledge, and
essentially, all they have accomplished is to fill their
head with useless facts. Facts are only useful when they can
be applied to solve problems. Short of that, they are mental
refuse.

I once encountered a most annoyingly uninformed dolt who
quiped:

DOLT: "Programming is easy! Once you learn the langauge,
it's just a matter of fill-in-the-blanks."

ME: "Oh really?" o_O

ME: "Are you literate in the English?"

DOLT: "Of course i am!"

ME: "I see. And are you literate in English at an _advanced_
level?"

DOLT: "Of course i am!!!" >:-(

ME: "And does being literate in the English language
necessarily mean that you could author a best selling
novel?"

DOLT: "Uh? Uh? (*sigh*) Probably not. No."  :-'(

ME: "Hmm, and could you author _anything_ that is worthy
enough to be included on the shelves of a respectable book
store?"

DOLT: "Muh... Muh... Well, maybe!? :^|"

[Hope springs eternal!] ಠ_ಠ

ME: "And how many books have you authored thus far?"

DOLT: "Well nothing yet. >:-("

ME: "Okay then."

ME: "Next time, think before you open your mouth."

> Other groups aren't so nice to beginners - the perl group
> is brutal and tell a student to do their own homework.

There is clear difference between requesting advice on one
small detail that is unclear, and positing a verbatim
outline of a homework project and then expecting the group
to cough up a complete solution on a silver platter. In the
latter case, the student should be admonished.

However, another approach is to offer an absurd solution.
One which produces the correct result whilst being
structurally, practically, and/or semantically a total train
wreck.

The instructor will "know". ;-)

[Hope springs eternal!] ಠ_ಠ
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python-list Digest, Vol 171, Issue 7

2017-12-06 Thread ROGER GRAYDON CHRISTMAN
I think I also came up with 4 as "the most frequent number". 
It is unclear ot me how you came up with 3.36 as the most common number,
because I tried rolling a six-sided die myself several times,
and somehow 3.36 didn't come up even once!

On Wed, Dec  6, 2017, D'Arcy Cain wrote:
>
On 12/05/2017 07:33 PM, nick.martinez2--- via Python-list wrote:
>> I have a question on my homework. My homework is to write a program in which
the computer simulates the rolling of a die 50
>> times and then prints
>> (i). the most frequent side of the die
>> (ii). the average die value of all rolls.
>> I wrote the program so it says the most frequent number out of all the rolls
for example (12,4,6,14,10,4) and will print out "14" instead of 4 like I need.
>
>How did you come up with 4?  I come up with 3.36 with those numbers.
>

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


Re: csv.DictReader line skipping should be considered a bug?

2017-12-06 Thread Steve D'Aprano
On Thu, 7 Dec 2017 02:33 am, Dennis Lee Bieber wrote:

> On Wed, 06 Dec 2017 11:06:39 +1100, Steve D'Aprano
>  declaimed the following:
> 
> 
>>I wouldn't want to guess your mental health based just on this isolated
>>incident, but if I had to make a diagnosis, I'd say, yes, crazy as a loon.
>>
> 
> Loons aren't crazy; they just sound that way. Kookaburras, OTOH...

Don't knock kookaburras. Anything that makes a living by eating Australian
snakes is worth respecting.



-- 
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: Politeness (was: we want python software)

2017-12-06 Thread Igor Korot
Rustom,

On Wed, Dec 6, 2017 at 6:25 AM, Rustom Mody  wrote:
> On Wednesday, December 6, 2017 at 4:05:43 PM UTC+5:30, Steve D'Aprano wrote:
>> On Wed, 6 Dec 2017 02:49 pm, Rustom Mody wrote:
>>
>> > You are assuming that the strangeness of the request is about 'tech'
>> > [engineering/tech existed centuries before computers]
>> >
>> > Do remember one can be a tech-{student,professional} without
>> > - ever having encountered free-software
>> > - internet/USENET culture
>> >
>> > … from which pov the request would not look so odd
>>
>> So you're suggesting that rather than being unwilling to google for "Download
>> Python" because he doesn't understand free software culture, the OP is
>> unwilling to google for "Download Python" because he thinks it is proprietary
>> software and wants a bunch of strangers on the Internet to send him a pirate
>> copy?
>>
>> I'm not entirely sure that's better...
>
> Dunno anything about OP so no 'suggesting'…
> I did hint one point above which can be restated more explicitly.
>
> An engineering degree (aka “B.Tech”) can be in any of
> - IT, CS, Computer Engineering etc
> - aeronautics, civil, electrical, mechanical… classical, non-computer related
> - bioinformatics, statistics, "scientific computing" etc ie heavy-duty *users*
>   of computers

I would agree with you here, but... (see below).

>
> For the latter two classes it would be normal/natural for the student to have
> little knowledge/interest in computer-related stuff except as a user.
>
> Are you interested in the latest disk-drive technology? power-supplies?
>  kernel? systemd-vs-sysv?  We use these all the time. Likewise these other 
> fields are *users* of computers.
>
> Inter alia I will mention: I have a colleague working on ACM's next curriculum
> And the inter-disciplinarity of CS is the next big deal it would appear.
>
> ie "unwilling to google" could well be "ignorant of google (usage/practices)"
> Do consider the possibility that a student could be a non-owner of a computer
> and/or studying in a college in a poor/non networked location.

We live in a XXI century. This person do have access t the Internet. And he
does say "send us", which implies that (s)he request the Python not just for
one person.
Moreover, Google should not be banned from any and all college.
In fact it should be a standard policy for any technical
school/college/university
to have access to Google.
But I'm actually more curious why a student request the help and the
lab tech/teacher
if he doesn't have a computer and work/study from the college.

Thank you.

>
> So…
>
> So while the specific slurs/attacks on some country are of near-zero interest 
> to me — to support or oppose — the deeper divisions and inequities are (IMHO) 
> more important.
>
> So here's a little statistical exercise for you:
> - Take any demographic of your choice containing programmers.
> - Compute the male/female programmers in that population
> - Now come to this list and work out the same ratio
> - How do these ratios compare?
> [When's the last time a woman appeared here?]
>
> IOW I would wish Ethan's "control yourself" to be imperated — preferably
> by oneself, if not then forcibly.
> And especially when the vitriol is flung at a first-time poster.
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


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 a general web search is really such a good
idea, as it is vital for the OP to download a _legitimate_
copy of the software, one that is not filled  with bloatware
and/or infected with exploits. And the only way to know you
have a legit copy of Python software is to download it from
the official Python.org website.

Random web searches are great when you know what you're
looking for, however, if the OP finds himself/herself on a
shady site like downloads.com, or worse, somewhere in the
filthy virus infected catacombs of Bill and Hillary
Clinton's private email server haphazardly jammed into a
bathroom closet with all manner of toiletries and even a
commercial quality washing machine filled with Clinton Cash,
you never know what you might find in there! 

Eh comrade? o_O
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Lies (was: we want python software)

2017-12-06 Thread Ian Kelly
On Wed, Dec 6, 2017 at 5:53 AM, Rustom Mody  wrote:
> I was at first surprised and even a bit shocked when people called me 
> right-wing.
> Over time Ive come to accept that lies (left-wing) is upstream of hate 
> (right-wing).  And to the extent that effects must be stemmed from causes, 
> the world
> is probably safer with the right than the left

In my experience with politics, lies are the most universally
bipartisan thing that we have. Just look at Donald Trump.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Politeness (was: we want python software)

2017-12-06 Thread Steve D'Aprano
On Wed, 6 Dec 2017 11:25 pm, Rustom Mody wrote:

> On Wednesday, December 6, 2017 at 4:05:43 PM UTC+5:30, Steve D'Aprano wrote:
>> On Wed, 6 Dec 2017 02:49 pm, Rustom Mody wrote:
>> 
>> > You are assuming that the strangeness of the request is about 'tech'
>> > [engineering/tech existed centuries before computers]
>> > 
>> > Do remember one can be a tech-{student,professional} without
>> > - ever having encountered free-software
>> > - internet/USENET culture
>> > 
>> > … from which pov the request would not look so odd
>> 
>> So you're suggesting that rather than being unwilling to google for
>> "Download Python" because he doesn't understand free software culture, the
>> OP is unwilling to google for "Download Python" because he thinks it is
>> proprietary software and wants a bunch of strangers on the Internet to send
>> him a pirate copy?
>> 
>> I'm not entirely sure that's better...
> 
> Dunno anything about OP so no 'suggesting'…

Rustom, you LITERALLY suggested that the OP could be a tech student who isn't
familiar with free-software and that would explain the "strangeness" of the
request. What other interpretation of your words quoted above is reasonable?

You suggested that if he wasn't familiar with free software, his request that
people send him a copy of Python wouldn't look so odd. Okay, if Python
weren't free software, it would be non-free software, and you are saying that
it wouldn't look so odd for somebody to join a mailing list and request a
bunch of strangers to gift him a copy of non-free software.

That seems pretty odd to me. Laziness I get. Being so naive as to expect that
someone will purchase a legal copy and give it to a perfect stranger out of
the goodness of their heart, I don't think is so believable. But maybe that
happens all the time in India *shrug*

If the OP was as ignorant of software (whether free or not) and the Internet
as your defence of him makes out, I would expect his question would have
been "How do I get the Python? software" rather than "Send me the Python
software".

The OP clearly understands that Python is something that will run on his
computer, that it can be sent to him, that there are people willing and able
to do so, and he understands the internet well enough to expect those people
will be able to contact him without his needing to explicitly give them his
address.


> I did hint one point above which can be restated more explicitly.
> 
> An engineering degree (aka “B.Tech”) can be in any of
> - IT, CS, Computer Engineering etc
> - aeronautics, civil, electrical, mechanical… classical, non-computer
> related - bioinformatics, statistics, "scientific computing" etc ie
> heavy-duty *users*
>   of computers
> 
> For the latter two classes it would be normal/natural for the student to
> have little knowledge/interest in computer-related stuff except as a user.

None of this is the slightest bit relevant. The OP explicitly said that he
wants to learn Python. He's not some random civil engineering or biology
student, he is a tech student who wants to learn to program in Python.

And the idea that "users of computers" don't know how to use Google is
ludicrous. Google hasn't become one of the biggest tech companies in the
world because only a tiny number of Open Source programmers use it. It is
2017, not 1997, and Google is ubiquitous. Even my dad knows about Google and
he doesn't even have a computer, not even a smart phone.


[...]
> ie "unwilling to google" could well be "ignorant of google
> (usage/practices)" Do consider the possibility that a student could be a
> non-owner of a computer and/or studying in a college in a poor/non networked
> location.

Your hypothetical that the OP is a tech student who has barely used a computer
before and doesn't know about Google but nevertheless knows about Python
(which is about a million times less well-known) *and* is internet-savvy
enough to send an email to this mailing list is such a remote possibility
that I don't know why I'm even responding to it.


[...]
> IOW I would wish Ethan's "control yourself" to be imperated — preferably
> by oneself, if not then forcibly.
> And especially when the vitriol is flung at a first-time poster.

KM also appears to be a first-time poster. And after all the critical attacks
he's received, I doubt he'll hang around.



-- 
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: Politeness (was: we want python software)

2017-12-06 Thread Random832
On Wed, Dec 6, 2017, at 11:18, Steve D'Aprano wrote:
> You suggested that if he wasn't familiar with free software, his
> request that people send him a copy of Python wouldn't look so odd.
> Okay, if Python weren't free software, it would be non-free software,
> and you are saying that it wouldn't look so odd for somebody to join a
> mailing list and request a bunch of strangers to gift him a copy of
> non-free software.

The third possibility is that he believes that this list is official
in some corporate sense, that if he asks for the software and it is not
free he will receive a price quote.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: we want python software

2017-12-06 Thread Steve D'Aprano
On Wed, 6 Dec 2017 04:54 pm, Chris Angelico wrote:

> On Wed, Dec 6, 2017 at 4:27 PM, km  wrote:
>> Remember that you are wasting time of lakhs of  python subscribers by
>> asking such dumb questions being tech students.  You people can Google and
>> watch movies / songs online  and you can't find how to download and install
>> python ? That's ridiculous!
>>
> 
> This attack is unwarranted. Please don't set fire to people simply
> because they asked a question like this.

I'm going to defend KM (srikrishnamohan) -- his comments were not "an attack",
they are a well-deserved criticism of a *tech student* who apparently made
zero effort to find out how to download Python before asking others to do it
for him.

I'm sorry for the length of this post. It is trivially easy to sink the boots
in and tell KM off for his blunt criticism of the OP's request. But in the
face of this hostile environment (out of the nine people who responded to
this thread, no fewer than three have piled onto KM to tell him off), it
isn't so easy to get through the message of why we shouldn't always coddle
people asking questions like that asked by the OP, and why KM's response was
tough but fair.

It's not enough to merely shout back "No, you're wrong!", hence the length of
this reply.


Its been a while since I've seen anyone here link to "How to ask questions the
smart way":

http://catb.org/~esr/faqs/smart-questions.html


and quote this:


When you ask your question, display the fact that you have done
these things [try to find an answer] first; this will help establish
that you're not being a lazy sponge and wasting people's time.


(And more importantly: *you might learn something* by trying to solve your own
problem.)

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]

The difference is, I have many years of answering other people's questions,
I'm well known here, and I have a proven track record of not being a lazy
sponge. But if somebody wants to take me to task for not explicitly stating
why I wasn't running the code myself, I will preemptively take it in good
grace and accept the criticism. Mea culpa.

How likely is it that somebody who is tech-savvy enough to sign up and post to
the Python-List mailing list is not savvy enough to have heard of google or
to have thought of search terms "download Python"?

https://duckduckgo.com/html/?q=download%20python

We're not talking about a young child, or some other barely computer literate
person, but somebody studying for a Bachelor of Technology in India.

Offering criticism is not attacking somebody. Not even tough criticism.

And if you are thinking that it is, well, consider the beam in your own eye
before the mote in KM's. You have just "attacked" (criticised) KM quite
harshly, accusing him of making an "unwarranted" attack (I think it was very
warranted), and using a metaphor which has particular cultural and colonial
associations in India and neighbouring countries which we Westerners should
be wary of making without good cause.[2]

When somebody mildly breaches social norms, even the norms of a tech forum,
mild shaming is often an effective method of enforcement. I'm not saying that
the OP should be doxxed, his family and employer harassed, ripped apart on
social media, but KM telling him off for wasting people's time seems fair to
me. We can assume that the OP isn't a two year old. He should know better,
and we ought to expect more from him. Its not a crime if he doesn't, but we
don't have to molly-coddle him either.

Consider your bible: a soft answer turns away wrath. But the bible never says
that the wrath wasn't justified in the first place. KM is clearly angry at
the OP's behaviour, hence his strong words. We should balance our concern
about driving away newbies like the OP with some concern about the justified
anger at needy, entitled, demanding people who take, take, take and never
give back. "Smart Questions" (above) is not just good advice, it is also a
set of social norms, and the OP violated them.

And again, consider your own beam: what you are complaining about KM doing to
the OP, is exactly what you, Ethan and others are attempting to do to KM. You
consider KM's actions to have violated *your* social norm of "be nice" and
consequently you are trying to shame KM into changing his behaviour to meet
those norms, by chastising him and telling him off for supposedly attacking
the OP, for being condescending, for being hateful.

Ironically, it appears that both KM and the OP are newbies. Aren't we supposed
to be more welcoming to newbies?


> You can be far more courteous 
> than this, even if you refuse to help. Particularly, the "you people"
> sounds like a blanket statement, which is almost certainly not useful
> to the discussion.

I think that given both posters appear to be Indian, perhaps there's some
cultural baggage

Re: we want python software

2017-12-06 Thread Gene Heskett
On Wednesday 06 December 2017 11:33:14 Steve D'Aprano wrote:

> On Wed, 6 Dec 2017 04:54 pm, Chris Angelico wrote:
> > On Wed, Dec 6, 2017 at 4:27 PM, km  wrote:
> >> Remember that you are wasting time of lakhs of  python subscribers
> >> by asking such dumb questions being tech students.  You people can
> >> Google and watch movies / songs online  and you can't find how to
> >> download and install python ? That's ridiculous!
> >
> > This attack is unwarranted. Please don't set fire to people simply
> > because they asked a question like this.
>
> I'm going to defend KM (srikrishnamohan) -- his comments were not "an
> attack", they are a well-deserved criticism of a *tech student* who
> apparently made zero effort to find out how to download Python before
> asking others to do it for him.
>
> I'm sorry for the length of this post. It is trivially easy to sink
> the boots in and tell KM off for his blunt criticism of the OP's
> request. But in the face of this hostile environment (out of the nine
> people who responded to this thread, no fewer than three have piled
> onto KM to tell him off), it isn't so easy to get through the message
> of why we shouldn't always coddle people asking questions like that
> asked by the OP, and why KM's response was tough but fair.
>
> It's not enough to merely shout back "No, you're wrong!", hence the
> length of this reply.
>
>
> Its been a while since I've seen anyone here link to "How to ask
> questions the smart way":
>
> http://catb.org/~esr/faqs/smart-questions.html
>
>
> and quote this:
>
>
> When you ask your question, display the fact that you have done
> these things [try to find an answer] first; this will help
> establish that you're not being a lazy sponge and wasting people's
> time.
>
>
> (And more importantly: *you might learn something* by trying to solve
> your own problem.)
>
> 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]
>
> The difference is, I have many years of answering other people's
> questions, I'm well known here, and I have a proven track record of
> not being a lazy sponge. But if somebody wants to take me to task for
> not explicitly stating why I wasn't running the code myself, I will
> preemptively take it in good grace and accept the criticism. Mea
> culpa.
>
> How likely is it that somebody who is tech-savvy enough to sign up and
> post to the Python-List mailing list is not savvy enough to have heard
> of google or to have thought of search terms "download Python"?
>
> https://duckduckgo.com/html/?q=download%20python
>
> We're not talking about a young child, or some other barely computer
> literate person, but somebody studying for a Bachelor of Technology in
> India.
>
> Offering criticism is not attacking somebody. Not even tough
> criticism.
>
> And if you are thinking that it is, well, consider the beam in your
> own eye before the mote in KM's. You have just "attacked" (criticised)
> KM quite harshly, accusing him of making an "unwarranted" attack (I
> think it was very warranted), and using a metaphor which has
> particular cultural and colonial associations in India and
> neighbouring countries which we Westerners should be wary of making
> without good cause.[2]
>
> When somebody mildly breaches social norms, even the norms of a tech
> forum, mild shaming is often an effective method of enforcement. I'm
> not saying that the OP should be doxxed, his family and employer
> harassed, ripped apart on social media, but KM telling him off for
> wasting people's time seems fair to me. We can assume that the OP
> isn't a two year old. He should know better, and we ought to expect
> more from him. Its not a crime if he doesn't, but we don't have to
> molly-coddle him either.
>
> Consider your bible: a soft answer turns away wrath. But the bible
> never says that the wrath wasn't justified in the first place. KM is
> clearly angry at the OP's behaviour, hence his strong words. We should
> balance our concern about driving away newbies like the OP with some
> concern about the justified anger at needy, entitled, demanding people
> who take, take, take and never give back. "Smart Questions" (above) is
> not just good advice, it is also a set of social norms, and the OP
> violated them.
>
> And again, consider your own beam: what you are complaining about KM
> doing to the OP, is exactly what you, Ethan and others are attempting
> to do to KM. You consider KM's actions to have violated *your* social
> norm of "be nice" and consequently you are trying to shame KM into
> changing his behaviour to meet those norms, by chastising him and
> telling him off for supposedly attacking the OP, for being
> condescending, for being hateful.
>
> Ironically, it appears that both KM and the OP are newbies. Aren't we
> supposed to be more welcoming to newbies?
>
> > You can be far more courteous
> > than this, 

Fwd: pip3 file in Scripts folder is missing - Python installation - Tensor flow upgrade

2017-12-06 Thread pavan kopparthi
Hi,

Installed Python 3.6.3 Amd64 in Windows 10 OS.

Want to install Tensor flow using native pip as suggested...

C:\> *pip3 install --upgrade tensorflow*

But, observed that pip3 file in Scripts folder is missing. Also, Scripts
folder is empty.

-- 
Reg,
Pavan Kumar K



Virus-free.
www.avg.com

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [Python-Dev] [RELEASE] Python 3.6.4rc1 and 3.7.0a3 now available for testing

2017-12-06 Thread Ned Deily
On Dec 6, 2017, at 07:30, Steve Holden  wrote:
> In your role as a representative of the many fine release managers Python has 
> had over the years I'd like to thank you for continuing to make high-quality 
> software available to a large and growing community. And thanks to everyone 
> who contributes to Python so the majority just get to enjoy it.

Thank you for your kind words, Steve, but, as you know, in our roles as release 
managers, we are just the conductors, making sure that the release trains get 
scheduled and arrive at their station stops on time.  Without the enormous 
contributions of all core developers and an increasing body of other 
contributors, all volunteering their time, the trains would be empty.  For 
those of you who might be tempted to contribute your time to working on Python, 
feel free to hop on board: https://devguide.python.org.  Or if you or perhaps 
your organization would like to help the Python community in other ways, 
consider supporting the Python Software Foundation: 
https://www.python.org/psf-landing/.

--
  Ned Deily
  [email protected] -- []

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


Re: Politeness (was: we want python software)

2017-12-06 Thread Gene Heskett
On Wednesday 06 December 2017 11:28:22 Random832 wrote:

> On Wed, Dec 6, 2017, at 11:18, Steve D'Aprano wrote:
> > You suggested that if he wasn't familiar with free software, his
> > request that people send him a copy of Python wouldn't look so odd.
> > Okay, if Python weren't free software, it would be non-free
> > software, and you are saying that it wouldn't look so odd for
> > somebody to join a mailing list and request a bunch of strangers to
> > gift him a copy of non-free software.
>
> The third possibility is that he believes that this list is official
> in some corporate sense, that if he asks for the software and it is
> not free he will receive a price quote.

Sadly, that an attitude even college profs don't get, having gotten their 
sheepskin with only M$ stuff, that something could be both free and 
good.

It's a concept that makes no sense to the teachers, so of course they 
don't teach it either.  Hell of a way to run a train.

Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python-list Digest, Vol 171, Issue 7

2017-12-06 Thread Chris Angelico
On Thu, Dec 7, 2017 at 3:56 AM, Dennis Lee Bieber  wrote:
> Granted, the statistics module in newer Python releases makes the
> entire assignment trivial...
>
> ClgubaJva 3.5.3 (qrsnhyg, Wha 26 2017, 16:17:54) [ZFP i.1900 64 ovg
> (NZQ64)] ba jva32.

Is this from the Function Call of Cthulu?

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


Re: Politeness (was: we want python software)

2017-12-06 Thread Ian Kelly
On Wed, Dec 6, 2017 at 9:42 AM, Gene Heskett  wrote:
> On Wednesday 06 December 2017 11:28:22 Random832 wrote:
>> The third possibility is that he believes that this list is official
>> in some corporate sense, that if he asks for the software and it is
>> not free he will receive a price quote.
>
> Sadly, that an attitude even college profs don't get, having gotten their
> sheepskin with only M$ stuff, that something could be both free and
> good.
>
> It's a concept that makes no sense to the teachers, so of course they
> don't teach it either.  Hell of a way to run a train.

Depends where you went to school, probably. The CS department at my
college was all over using Linux and free software.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Politeness (was: we want python software)

2017-12-06 Thread Gene Heskett
On Wednesday 06 December 2017 12:14:32 Ian Kelly wrote:

> On Wed, Dec 6, 2017 at 9:42 AM, Gene Heskett  
wrote:
> > On Wednesday 06 December 2017 11:28:22 Random832 wrote:
> >> The third possibility is that he believes that this list is
> >> official in some corporate sense, that if he asks for the software
> >> and it is not free he will receive a price quote.
> >
> > Sadly, that an attitude even college profs don't get, having gotten
> > their sheepskin with only M$ stuff, that something could be both
> > free and good.
> >
> > It's a concept that makes no sense to the teachers, so of course
> > they don't teach it either.  Hell of a way to run a train.
>
> Depends where you went to school, probably. The CS department at my
> college was all over using Linux and free software.

Then why not promote that seat of higher learning by naming it? Word of 
mouth publicity is the best kind.

Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: we want python software

2017-12-06 Thread Grant Edwards
On 2017-12-05, Igor Korot  wrote:
> Hi, Tony,
>
> On Tue, Dec 5, 2017 at 11:10 AM, Tony van der Hoff  
> wrote:
>> On 05/12/17 16:55, Igor Korot wrote:
>>> Hi,
>>>
>>> On Tue, Dec 5, 2017 at 9:10 AM, Jyothiswaroop Reddy
>>>  wrote:
 Sir,
 I am b.tech student I would like to learn python. So please send 
 the python software.
>>> Sorry, we don't send anything. You will have to go get it yourself. -)
>>>
>> Well, at least try to be helpful:
>> https://www.python.org/downloads/
>
> This is LMGIFY.
> If they say they are tech students - they should know how to work with Google.

Yea, I've always been baffled by requests like that.

How is somebody able figure out how to post a question to the mailing
list, but is unable to type "Install Python" into Google?

-- 
Grant Edwards   grant.b.edwardsYow! Now KEN and BARBIE
  at   are PERMANENTLY ADDICTED to
  gmail.comMIND-ALTERING DRUGS ...

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


Re: Python-list Digest, Vol 171, Issue 7

2017-12-06 Thread Peter Otten
Chris Angelico wrote:

> On Thu, Dec 7, 2017 at 3:56 AM, Dennis Lee Bieber 
> wrote:
>> Granted, the statistics module in newer Python releases makes the
>> entire assignment trivial...
>>
>> ClgubaJva 3.5.3 (qrsnhyg, Wha 26 2017, 16:17:54) [ZFP i.1900 64 ovg
>> (NZQ64)] ba jva32.
> 
> Is this from the Function Call of Cthulu?
> 
> ChrisA

Perhaps. It is also rot13.

Fun fact: in Python 2 you could run an actual session using rot13:

$ PYTHONIOENCODING=rot13 python
Python 2.7.6 (default, Nov 23 2017, 15:49:48) 
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> vzcbeg fgngvfgvpf
>>> vzcbeg enaqbz
>>> aEbyyf = 50
>>> ebyyf = [enaqbz.enaqvag(1, 6) sbe wax va enatr(aEbyyf)]
>>> fgngvfgvpf.zrna(ebyyf)
3.5


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


Re: Python-list Digest, Vol 171, Issue 7

2017-12-06 Thread ROGER GRAYDON CHRISTMAN
On Wed, Dec  6, 2017, ssghotra1997 wrote:
import random

def rollDie(num):
sides = {'One':0, 'Two':0,'Three':0,'Four':0,'Five':0,'Six':0}

for i in range(num):
rolls = int(random.randint(1, 6)
if rolls == 1:
sides['One'] += 1
if rolls == 2:
sides['Two'] += 1
if rolls == 3:
sides['Three'] += 1
if rolls == 4:
sides['Four'] += 1
if rolls == 5:
sides['Five'] += 1
if rolls == 6:
sides['Six'] += 1

return sides,max(sides,key=sides.get)

print(rollDie(50)


*** OUTPUT *
({'One': 10, 'Two': 7, 'Three': 7, 'Four': 11, 'Five': 7, 'Six': 8}, 'Four')

You should always be suspicious if any case where you see identical
or nearly-identical code duplicated more than three times, because that
strongly suggests that there is a much better way that avoids such 
code duplication.

This problem of identifying a most frequent die roll could be applicable
to imaginary dice of any size, since the concept would e the same.
Imagine how much tedious work you would have to do if the question
was about a 20-sided die or a 34-sided die!

Of course, there is the special feature here of using words ('One', 'Two'..)
to stand for the numbers, but even those could be addressed very neatly
with a hand data structure and no code complexity.

It might not make much difference for a homework assignment of this
size at this point in your curriculum.  But later on, you would pay a heavy
price for choosing implementations that require 5, 10, or 20 times as much
code as necessary.   The increase in program size would have a multiplicative
effect on writing time and debugging time and would have an adverse affect
on a course grade, product delivery date, customer satisfaction, and
job security.

So learn how to find the efficient solutions now while you still have
instructors around to help you.

Roger Christman
Pennsylvania State University


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


Re: we want python software

2017-12-06 Thread Chris Angelico
On Thu, Dec 7, 2017 at 3:33 AM, Steve D'Aprano
 wrote:
> On Wed, 6 Dec 2017 04:54 pm, Chris Angelico wrote:
>
>> On Wed, Dec 6, 2017 at 4:27 PM, km  wrote:
>>> Remember that you are wasting time of lakhs of  python subscribers by
>>> asking such dumb questions being tech students.  You people can Google and
>>> watch movies / songs online  and you can't find how to download and install
>>> python ? That's ridiculous!
>>>
>>
>> This attack is unwarranted. Please don't set fire to people simply
>> because they asked a question like this.
>
> I'm going to defend KM (srikrishnamohan) -- his comments were not "an attack",
> they are a well-deserved criticism of a *tech student* who apparently made
> zero effort to find out how to download Python before asking others to do it
> for him.
>
> I'm sorry for the length of this post. It is trivially easy to sink the boots
> in and tell KM off for his blunt criticism of the OP's request. But in the
> face of this hostile environment (out of the nine people who responded to
> this thread, no fewer than three have piled onto KM to tell him off), it
> isn't so easy to get through the message of why we shouldn't always coddle
> people asking questions like that asked by the OP, and why KM's response was
> tough but fair.

I was the first to tell KM off, so I wasn't "piling on". The others
may or may not have been aware of my post at the time they made
theirs. It's easy to look at the end of a thread and say that people
were piling on, but usually that isn't the intention (how often do you
deliberately set out to make a thread nothing but attacks on the same
person?).

> How likely is it that somebody who is tech-savvy enough to sign up and post to
> the Python-List mailing list is not savvy enough to have heard of google or
> to have thought of search terms "download Python"?
>
> https://duckduckgo.com/html/?q=download%20python
>
> We're not talking about a young child, or some other barely computer literate
> person, but somebody studying for a Bachelor of Technology in India.
>
> Offering criticism is not attacking somebody. Not even tough criticism.
>
> And if you are thinking that it is, well, consider the beam in your own eye
> before the mote in KM's. You have just "attacked" (criticised) KM quite
> harshly, accusing him of making an "unwarranted" attack (I think it was very
> warranted), and using a metaphor which has particular cultural and colonial
> associations in India and neighbouring countries which we Westerners should
> be wary of making without good cause.[2]

I, on the other hand, think that it was indeed unwarranted.

1) The OP makes a lazy post
2) KM responds harshly
3) I respond, criticizing the harshness of KM's response
4) You respond, criticizing the harshness of my response.

While I absolutely agree with you that the OP should have done more
research before asking, I don't think that KM's attack was fully
warranted - at least, not in the way it was made. The text is still
above, in the quoted section; do you really think that that tone is
justified in response to a person's first post?

That said, though, I was wrong to use the metaphor I did. Mea culpa. I
did not think of the implications to people in India. KM, please
accept my apology for this.

> In our urge to be inclusive, we forget that it is just basic simple politeness
> that before asking strangers for a favour, we should make an honest attempt
> to solve the problem ourselves. If you don't, but still expect others to
> solve your problems for you, that's a violation of some pretty deeply
> embedded cultural norms about social cheating (taking advantage of others
> without giving back). Those norms are so deeply embedded they might even be
> biological. I can completely understand KM's apparant anger.
>
> The bottom line is, I disagree that KM's posts were out of line and more
> worthy of chastisement than Jyothiswaroop's post.

I would say they were comparably out of line, similarly worthy of
chastisement. Both of them were wrong. I'd like to think that my
response to KM was less wrong than either of the preceding posts, but
if you want to assert that I was also just as wrong, I'll accept that
(there were parts of it which I should definitely have thought more
about before sending). Bottom line is, I still think KM was wrong to
use the tone he did.

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


rot13 as I/O encoding (was Re: Python-list Digest, Vol 171, Issue 7)

2017-12-06 Thread Chris Angelico
On Thu, Dec 7, 2017 at 5:11 AM, Peter Otten <[email protected]> wrote:
> Chris Angelico wrote:
>
>> On Thu, Dec 7, 2017 at 3:56 AM, Dennis Lee Bieber 
>> wrote:
>>> Granted, the statistics module in newer Python releases makes the
>>> entire assignment trivial...
>>>
>>> ClgubaJva 3.5.3 (qrsnhyg, Wha 26 2017, 16:17:54) [ZFP i.1900 64 ovg
>>> (NZQ64)] ba jva32.
>>
>> Is this from the Function Call of Cthulu?
>>
>> ChrisA
>
> Perhaps. It is also rot13.

I know, but it looked hilarious. :)

> Fun fact: in Python 2 you could run an actual session using rot13:
>
> $ PYTHONIOENCODING=rot13 python
> Python 2.7.6 (default, Nov 23 2017, 15:49:48)
> [GCC 4.8.4] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
 vzcbeg fgngvfgvpf
 vzcbeg enaqbz
 aEbyyf = 50
 ebyyf = [enaqbz.enaqvag(1, 6) sbe wax va enatr(aEbyyf)]
 fgngvfgvpf.zrna(ebyyf)
> 3.5
>

Curiously, that doesn't seem to affect everything.

>>> znc(beq, "abcd")
[97, 98, 99, 100]

According to "python --help", that env var should be setting the
encoding for all three standard streams. So I would expect that the
actual string would contain "nopq", which - when mapped through ord()
- should be [110, 111, 112, 113]. Oh. I'm an idiot. Or rather, I've
gotten so used to Python 3 that I forget how Python 2 works...

>>> znc(beq, h"abcd")
[110, 111, 112, 113]

And that's what I was expecting to see. Except that... variable names
get decoded. And error messages don't.

>>> abcd
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'nopq' is not defined

Curiouser and curiouser!

>>> cevag("abcd")
abcd
>>> cevag(h"abcd")
abcd
>>> "abcd"
'abcd'
>>> h"abcd"
u'nopq'

All tested using Python 2.7.13 on Debian GNU/Linux, if that makes any
difference (I doubt that it will, but you never know).

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


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 here, whilst quite impressive indeed,
won't distract from that over-the-knee-spanking you received
from me in the "Slicing Thread" started by Jason Maldonis.

But uh, nice try ;-)

--

https://plus.google.com/u/0/collection/UAv9UE
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Politeness (was: we want python software)

2017-12-06 Thread Ian Kelly
On Wed, Dec 6, 2017 at 10:56 AM, Gene Heskett  wrote:
> On Wednesday 06 December 2017 12:14:32 Ian Kelly wrote:
>
>> On Wed, Dec 6, 2017 at 9:42 AM, Gene Heskett 
> wrote:
>> > On Wednesday 06 December 2017 11:28:22 Random832 wrote:
>> >> The third possibility is that he believes that this list is
>> >> official in some corporate sense, that if he asks for the software
>> >> and it is not free he will receive a price quote.
>> >
>> > Sadly, that an attitude even college profs don't get, having gotten
>> > their sheepskin with only M$ stuff, that something could be both
>> > free and good.
>> >
>> > It's a concept that makes no sense to the teachers, so of course
>> > they don't teach it either.  Hell of a way to run a train.
>>
>> Depends where you went to school, probably. The CS department at my
>> college was all over using Linux and free software.
>
> Then why not promote that seat of higher learning by naming it? Word of
> mouth publicity is the best kind.

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


Re: why won't slicing lists raise IndexError?

2017-12-06 Thread Python
On Tue, Dec 05, 2017 at 06:23:04PM -0800, Rick Johnson wrote:
> [bunch of old, irrelevant context snipped]
> > item = seq[n:n+1]
> > if item:
> >  process(item)
> > else:
> >  do_without_item()
> 
> When Python follows a logic clause like a train skating
> along a set of railroad tracks, and finds itself in a *GHOST
> TOWN*, that's not an action -- "Steve-o" -- it's a non-
> action.

Geez, seriously?  The snippet is purely academic, obviously not a
complete or useful program, intended to illustrate that python can
take two different branches depending on whether or not the slicing
operation yeilded a non-empty container, using uncomplicated syntax.
It effectively serves that purpose.

Moreover, in order for the example to make sense, we must assume the
existence of unspecified code:  The variables need to have been
initialized previously, or else the snippet is non-functional.  The if
conditional would never be reached.  We can as easily assume that the
hypothetical example continues with other, unspecified code, and that
the equally unspecified do_without_item() actually does something,
which renders your argument completely invalid and pointless.

The whole thing is entirely academic; continuing to argue this is an
utter waste of time and bandwidth.

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


Re: Politeness (was: we want python software)

2017-12-06 Thread Andrew Z
Looks like the longest thread for past 2 months.
Should we push it to be the longest for 2017?

:)


On Dec 6, 2017 15:34, "Ian Kelly"  wrote:

> On Wed, Dec 6, 2017 at 10:56 AM, Gene Heskett 
> wrote:
> > On Wednesday 06 December 2017 12:14:32 Ian Kelly wrote:
> >
> >> On Wed, Dec 6, 2017 at 9:42 AM, Gene Heskett 
> > wrote:
> >> > On Wednesday 06 December 2017 11:28:22 Random832 wrote:
> >> >> The third possibility is that he believes that this list is
> >> >> official in some corporate sense, that if he asks for the software
> >> >> and it is not free he will receive a price quote.
> >> >
> >> > Sadly, that an attitude even college profs don't get, having gotten
> >> > their sheepskin with only M$ stuff, that something could be both
> >> > free and good.
> >> >
> >> > It's a concept that makes no sense to the teachers, so of course
> >> > they don't teach it either.  Hell of a way to run a train.
> >>
> >> Depends where you went to school, probably. The CS department at my
> >> college was all over using Linux and free software.
> >
> > Then why not promote that seat of higher learning by naming it? Word of
> > mouth publicity is the best kind.
>
> Earlham College.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2017-12-06 Thread Python
On Wed, Dec 06, 2017 at 10:35:58AM +1100, Steve D'Aprano wrote:
> On Tue, 5 Dec 2017 07:58 pm, 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”.
> 
> 
> Then how does my Linux box know that when I double-click on a text file, it
> launches kwrite rather than (say) the Gimp or LibreOffice?

The answer to that is (sadly) complicated.  How it knows indeed
depends on the context of the click, what desktop environment you're
using, what application(s) you're using, and what configurations
you've made to those things to address any file associations.  There
isn't one answer.  On the same system, the answer could well be
completely different for any two users, or even for the same user,
given different application contexts.  The latter is less true than it
used to be, but still true nonetheless.

Granted, this isn't a very useful answer, but it's the only one you
can give that is certainly correct, without more context.
-- 
https://mail.python.org/mailman/listinfo/python-list


Module _socket not found in python3.6 "No module named _socket"

2017-12-06 Thread Bryan Zimmer
I have been getting this message, "No module named '_socket'", since I
installed python 3.6, about two months ago.

My platform is Slackware Linux (14.2). I compiled python3.6 from source,
because binary python packages aren't distributed by python.org for Linux.
I have the same experience on multiple Slackware computers, not just one.
Actually, this problem hits the 64-bit distribution. I have a 32-bit
Slackware box that has no trouble with _socket.

I can not 'import socket' into a program, nor can I use 'pip' to install
modules. These require the _socket module, which doesn't exist. What does
exist is a shared library object called '_
socket.cpython-36m-i386-linux-gnu.so'. This looks tantalizingly like the
missing module, but it is for a 32-bit architecture.

This is not the only missing module for 64-bit Slackware Linux. I can not
find a trace of the 'math' module, which, again, works fine on my 32-bit
computer.

I am far from an expert on installing python modules, so I am asking for
advice on how I should proceed to find these modules.

Thanks in advance.

"BryGuy" (my handle on linuxquestions.org)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: why won't slicing lists raise IndexError?

2017-12-06 Thread Terry Reedy

On 12/5/2017 9:23 PM, Rick Johnson wrote:

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;

- the action you take when the slice is empty.


When Python follows a logic clause like a train skating
along a set of railroad tracks, and finds itself in a *GHOST
TOWN*, that's not an action -- "Steve-o" -- it's a non-
action.


Rick, cut the crap.  If you do not understand that 'something_else()' != 
'pass', re-read the tutorial.

---

The OP asked: "Why is slicing 'forgiving'?"  The current behavior could 
be interpreted as 'letting errors pass silently'.  It would be if 
slicing meant 'give me exactly the length stop-start subsequence from 
start to stop (or raise)'.  But slicing actually means 'give me whatever 
subsequence exists between start and stop'.


My examples attempted to show why this looser definition of slicing is 
*useful*.  The focus of the third example was entirely on the condition, 
not the alternative actions.  (Reminder: either action can be the 
if-action, and the other the else-action, depending on how the condition 
is written.)


I should have mentioned, and others did, that the OP can write a custom 
__getitem__ method that implements stricter slicing for instances of a 
custom class.


I think we have collectively answered the OP's question quite well.

--
Terry Jan Reedy

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


Re: Module _socket not found in python3.6 "No module named _socket"

2017-12-06 Thread Chris Angelico
On Thu, Dec 7, 2017 at 7:59 AM, Bryan Zimmer  wrote:
> I have been getting this message, "No module named '_socket'", since I
> installed python 3.6, about two months ago.
>
> My platform is Slackware Linux (14.2). I compiled python3.6 from source,
> because binary python packages aren't distributed by python.org for Linux.
> I have the same experience on multiple Slackware computers, not just one.
> Actually, this problem hits the 64-bit distribution. I have a 32-bit
> Slackware box that has no trouble with _socket.
>
> I can not 'import socket' into a program, nor can I use 'pip' to install
> modules. These require the _socket module, which doesn't exist. What does
> exist is a shared library object called '_
> socket.cpython-36m-i386-linux-gnu.so'. This looks tantalizingly like the
> missing module, but it is for a 32-bit architecture.
>
> This is not the only missing module for 64-bit Slackware Linux. I can not
> find a trace of the 'math' module, which, again, works fine on my 32-bit
> computer.
>
> I am far from an expert on installing python modules, so I am asking for
> advice on how I should proceed to find these modules.

The 'socket' module (with the '_socket' helper) is part of the
standard library, so it sounds like something failed during
compilation. I don't know Slackware specifically, but my guess is that
you need to install development libraries for something in order to
compile _socket, and you installed the 32-bit but not the 64-bit of
it.

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


Re: Python homework

2017-12-06 Thread Bill
I think carelessness in choosing variable names may be at the root of 
the problem.



[email protected] wrote:

I have a question on my homework. My homework is to write a program in which 
the computer simulates the rolling of a die 50
times and then prints
(i). the most frequent side of the die
(ii). the average die value of all rolls.
I wrote the program so it says the most frequent number out of all the rolls for example 
(12,4,6,14,10,4) and will print out "14" instead of 4 like I need.
This is what I have so far:
import random

def rollDie(number):
 rolls = [0] * 6
 for i in range(0, number):
 roll=int(random.randint(1,6))
 rolls[roll - 1] += 1
 return rolls

if __name__ == "__main__":
 result = rollDie(50)
 print (result)
 print(max(result))


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


Re: we want python software

2017-12-06 Thread Terry Reedy

On 12/5/2017 4:39 PM, Igor Korot wrote:

Hi, Tony,

On Tue, Dec 5, 2017 at 11:10 AM, Tony van der Hoff  wrote:

On 05/12/17 16:55, Igor Korot wrote:

Hi,

On Tue, Dec 5, 2017 at 9:10 AM, Jyothiswaroop Reddy
 wrote:

Sir,
 I am b.tech student I would like to learn python. So please send the 
python software.

Sorry, we don't send anything. You will have to go get it yourself. -)


Well, at least try to be helpful:
https://www.python.org/downloads/


This is LMGIFY.
If they say they are tech students - they should know how to work with Google.

And I even tried to be polite. I should have probably write something like:

1. Open the Web browser.
2. In the "Address Bar" type "www.pyton.org".


Fortunately, this wrong url does not currently lead to a fake site with 
malware binaries.



3. Find the link which reads "Downloads". Click on it.
4. Carefully read what version you need to install for your OS.
5. Apply the acquired knowledge and download the appropriate version.
6. Click on the installer (if on Windows).
7. Follow all the prompts.
8. Enjoy.

but this is too much for the tech student.

Thank you.


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



--
Terry Jan Reedy

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


Re: we want python software

2017-12-06 Thread Chris Angelico
On Thu, Dec 7, 2017 at 9:21 AM, Terry Reedy  wrote:
> On 12/5/2017 4:39 PM, Igor Korot wrote:
>>
>> Hi, Tony,
>>
>> On Tue, Dec 5, 2017 at 11:10 AM, Tony van der Hoff 
>> wrote:
>>>
>>> On 05/12/17 16:55, Igor Korot wrote:

 Hi,

 On Tue, Dec 5, 2017 at 9:10 AM, Jyothiswaroop Reddy
  wrote:
>
> Sir,
>  I am b.tech student I would like to learn python. So please
> send the python software.

 Sorry, we don't send anything. You will have to go get it yourself. -)

>>> Well, at least try to be helpful:
>>> https://www.python.org/downloads/
>>
>>
>> This is LMGIFY.
>> If they say they are tech students - they should know how to work with
>> Google.
>>
>> And I even tried to be polite. I should have probably write something
>> like:
>>
>> 1. Open the Web browser.
>> 2. In the "Address Bar" type "www.pyton.org".
>
>
> Fortunately, this wrong url does not currently lead to a fake site with
> malware binaries.

Which is why I recommend using a search engine. I tried four of them
on the misspelled word "pyton", and all four had www.python.org
(correctly spelled) as the first non-sponsored link.

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


Re: we want python software

2017-12-06 Thread Gregory Ewing

Rick Johnson wrote:


DOLT: "Programming is easy! Once you learn the langauge,
it's just a matter of fill-in-the-blanks."


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, and I had
no trouble seeing how to apply them. I unconsciously
assumed it would be the same for anyone else with a
reasonable level of intelligence.

It was a while before it became clear to me that this is
not the case at all.

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


Re: we want python software

2017-12-06 Thread Andrew Z
Can we mark the entire thread "spam", please?


On Dec 6, 2017 17:55, "Gregory Ewing"  wrote:

> Rick Johnson wrote:
>
> DOLT: "Programming is easy! Once you learn the langauge,
>> it's just a matter of fill-in-the-blanks."
>>
>
> 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, and I had
> no trouble seeing how to apply them. I unconsciously
> assumed it would be the same for anyone else with a
> reasonable level of intelligence.
>
> It was a while before it became clear to me that this is
> not the case at all.
>
> --
> Greg
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


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 whether or not the slicing operation
> yeilded a non-empty container, using uncomplicated syntax.
> It effectively serves that purpose.

"Uncomplicated" is a relative term, not an absolute.

The following is Terry's original:

if item:
process(item)
else:
do_without_item()

And here is the functioning equivalent, sans any fuzzy
semantics:

if item:
process(item)
else:
pass

And finally, here is the functioning equivalent, sans the
fuzzy semantics *AND* the forced vist to a little "ghost
town".

if item:
process(item)

My point is simple: What good could possibly come from
posting bloat-ware example code? The else-clause is
superfluous. How many times must i explain this simple
concept before you will admit you are wrong?

> Moreover, in order for the example to make sense, we must
> assume the existence of unspecified code: The variables
> need to have been initialized previously, or else the
> snippet is non-functional.

Agreed.

> The if conditional would never be reached.  We can as
> easily assume that the hypothetical example continues with
> other, unspecified code, and that the equally unspecified
> do_without_item() actually does something,

Fine. Why stop at a single if/else binary? Why not offer
N more irrelevant clauses?

import os, re
value = "foo"
if value:
do_something1(value)
elif isinstance(value, (int, float)):
do_something_else1(value)
elif os.path.exists(value):
do_something_else2(value)
elif re.match(r'.*ly', value):
do_something_else3(value)
else:
do_nothing()

The possibilities are literally endless.

> which renders your argument completely invalid and
> pointless.

And that's an opinion you get to have.

> The whole thing is entirely academic; continuing to argue
> this is an utter waste of time and bandwidth.

Yet, here you are, apeaking on behalf of others. It boggles
the mind.

--

https://plus.google.com/u/0/collection/UAv9UE

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


Re: why won't slicing lists raise IndexError?

2017-12-06 Thread Python
On Wed, Dec 06, 2017 at 03:08:51PM -0800, Rick Johnson wrote:
> The following is Terry's original:
> 
> if item:
> process(item)
> else:
> do_without_item()
> 
> And here is the functioning equivalent, sans any fuzzy
> semantics:
> 
> if item:
> process(item)
> else:
> pass
> 

THIS IS FALSE.  CALLING A FUNCTION IS NOT FUNCTIONALLY EQUIVALENT TO
THE PASS STATEMENT.  Therefore your entire premise is false, and the
remainder of what you said is meaningless.

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


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 that "something_else()" is
merely a semantical placeholder which is synonomous with
"fill_in_the_blank()" or "do_as_you_please()".

I'm sure the OP is competent enough to decide when his/her
if-clauses need to grow a complementary else-clause, or when
a chain of elif-clauses are required as well. My intention
was not to make you out as some sort of boogeyman, i simply
want to inform those watching. So no need to take any of
this personally.

> The OP asked: "Why is slicing 'forgiving'?"  The current
> behavior could be interpreted as 'letting errors pass
> silently'. It would be if slicing meant 'give me exactly
> the length stop-start subsequence from start to stop (or
> raise)'.  But slicing actually means 'give me whatever
> subsequence exists between start and stop'.

Agreed.

> My examples attempted to show why this looser definition of
> slicing is *useful*.  The focus of the third example was
> entirely on the condition, not the alternative actions.
> (Reminder: either action can be the if-action, and the
> other the else-action, depending on how the condition is
> written.)

True. But your conditional presented a specific binary
choice, where the if-clause takes the role of a
"TRUTHY_CLAWS", and the else-clause takes the role of a
"FALSEY_CLAWS".

Unfortunately i didn't get a chance to work FLASEY_CLAWS
into my metaphor, hmm, as i was afraid the power dynamic
between the two "clawed marsupials" might distract from the
narrative. TC always has to be first in everything. That's
the way she is, i'm afraid.


> I should have mentioned, and others did, that the OP can
> write a custom __getitem__ method that implements stricter
> slicing for instances of a custom class.

Yep. Could name it "StrictSlice".

> I think we have collectively answered the OP's question
> quite well.

Yes. 

But i like to take advantage of any tangential teaching
moments whenever they arise. And don't forget, the OP is not
the only person who is learning from this exchange. We are
all students of knowledge.

--

https://plus.google.com/u/0/collection/UAv9UE
-- 
https://mail.python.org/mailman/listinfo/python-list


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 recent call last):
  File "", line 1, in 
do_without_item()
NameError: name 'do_without_item' is not defined
>>> foo()

Traceback (most recent call last):
  File "", line 1, in 
foo()
NameError: name 'foo' is not defined
>>> bar()

Traceback (most recent call last):
  File "", line 1, in 
bar()
NameError: name 'bar' is not defined

if "do_without_item()" had been defined, then you could call
it a function. But until you do, it's just a NameError.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: why won't slicing lists raise IndexError?

2017-12-06 Thread Alexandre Brault
process() wasn't defined either, nor were n and seq and yet you're not 
complaining about them.


It seems it was clear to everyone but you that seq was a sequence 
defined elsewhere, n was an index defined elsewhere, and both process 
and do_without_item were functions defined elsewhere.


And even if you want to be so incredibly pedantic that do_without_item 
(and only do_without_item, because the rest of the code fragment seems 
to get your seal of approval) is not defined, your "functioning 
equivalent" is still not equivalent, because the original code would 
have raised a NameError that yours doesn't.



On 2017-12-06 7:05 PM, Rick Johnson wrote:

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 recent call last):
   File "", line 1, in 
 do_without_item()
 NameError: name 'do_without_item' is not defined
 >>> foo()

 Traceback (most recent call last):
   File "", line 1, in 
 foo()
 NameError: name 'foo' is not defined
 >>> bar()

 Traceback (most recent call last):
   File "", line 1, in 
 bar()
 NameError: name 'bar' is not defined

if "do_without_item()" had been defined, then you could call
it a function. But until you do, it's just a NameError.


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


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, and I had no trouble seeing how to
> apply them. I unconsciously assumed it would be the same
> for anyone else with a reasonable level of intelligence.
> It was a while before it became clear to me that this is
> not the case at all.

Indeed. It's not simply a matter of being intelligent
"enough". A prospect must also possess some very specific
innate skills and personality traits. And these attributes
simply cannot be taught. You either have them, or you don't.

That's why these huge advertising campaigns to bring new
folk into the programming arts have been a total flop. I
guess you can teach anybody how to be a code monkey, but
without a bonafide software engineer on the team directing
the Orcestrial Circus (ook-ook!), not much will get done. I
can't imagine how awful it would be to stand over people's
shoulder all day and tell them how to write each and every
line of code. That's not what any software engineer was born
to do. It's just shameful.

--

https://plus.google.com/u/0/collection/UAv9UE

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


Re: Politeness (was: we want python software)

2017-12-06 Thread Gene Heskett
On Wednesday 06 December 2017 15:33:40 Ian Kelly wrote:

> On Wed, Dec 6, 2017 at 10:56 AM, Gene Heskett  
wrote:
> > On Wednesday 06 December 2017 12:14:32 Ian Kelly wrote:
> >> On Wed, Dec 6, 2017 at 9:42 AM, Gene Heskett 
> >
> > wrote:
> >> > On Wednesday 06 December 2017 11:28:22 Random832 wrote:
> >> >> The third possibility is that he believes that this list is
> >> >> official in some corporate sense, that if he asks for the
> >> >> software and it is not free he will receive a price quote.
> >> >
> >> > Sadly, that an attitude even college profs don't get, having
> >> > gotten their sheepskin with only M$ stuff, that something could
> >> > be both free and good.
> >> >
> >> > It's a concept that makes no sense to the teachers, so of course
> >> > they don't teach it either.  Hell of a way to run a train.
> >>
> >> Depends where you went to school, probably. The CS department at my
> >> college was all over using Linux and free software.
> >
> > Then why not promote that seat of higher learning by naming it? Word
> > of mouth publicity is the best kind.
>
> Earlham College.

Thank you, but at first the only Earlham I could think of was Earlham, 
IA. Which isn't the home of a higher ed facility that I know of.

Sounds like an interesting place that google sent me to.

Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page 
-- 
https://mail.python.org/mailman/listinfo/python-list


Round to 2 decimal places

2017-12-06 Thread nick martinez via Python-list
I'm stuck. I need my program to round the end solution to 2 decimal places but 
cant figure it out. Can someone help? I've been trying between printf and 
round() but cant seem to get either to work. Python 3.5 is what I'm using.
import math

print("This program will calculate the surface area and volume of a 
3-dimensional cone: ")
print()
print()
r = input("What is the radius in feet? (no negatives): ")
h = input("What is the height in feet? (no negatives): ")
r = float(r)
h = float(h)
if r > 0 and h > 0:

   surfacearea = math.pi*r**2+r*math.pi*(math.sqrt(r**2+h**2))
   volume = (1/3)*math.pi*r**2*h



   print()
   print("Your Answer is:")
   print()

   print("A cone with radius", r, "\nand height of", h, "\nhas a volume of : ", 
volume, "\nand surface area of : ", surfacearea,)
else:
print("No negatives allowed, try again.")
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Round to 2 decimal places

2017-12-06 Thread ssghotra1997
import math

print("This program will calculate the surface area and volume of a 
3-dimensional cone: ")
print()
print()
r = input("What is the radius in feet? (no negatives): ")
h = input("What is the height in feet? (no negatives): ")
r = float(r)
h = float(h)
if r > 0 and h > 0:

surfacearea = math.pi * r ** 2 + r * math.pi * (math.sqrt(r ** 2 + h ** 2))
volume = (1 / 3) * math.pi * r ** 2 * h

print()
print("Your Answer is:")
print()

print("A cone with radius", r, "\nand height of", h, "\nhas a volume of : 
", round(volume,2), "\nand surface area of : ",
  round(surfacearea,2), )
else:
print("No negatives allowed, try again.")
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Round to 2 decimal places

2017-12-06 Thread ssghotra1997
The following works:

import math

print("This program will calculate the surface area and volume of a 
3-dimensional cone: ")
print()
print()
r = input("What is the radius in feet? (no negatives): ")
h = input("What is the height in feet? (no negatives): ")
r = float(r)
h = float(h)
if r > 0 and h > 0:

surfacearea = math.pi * r ** 2 + r * math.pi * (math.sqrt(r ** 2 + h ** 2))
volume = (1 / 3) * math.pi * r ** 2 * h

print()
print("Your Answer is:")
print()

print("A cone with radius", r, "\nand height of", h, "\nhas a volume of : 
", round(volume,2), "\nand surface area of : ",
  round(surfacearea,2), )
else:
print("No negatives allowed, try again.")
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python homework

2017-12-06 Thread ssghotra1997
On Wednesday, December 6, 2017 at 9:28:26 PM UTC+11, D'Arcy Cain wrote:
> On 12/05/2017 07:33 PM, nick.martinez2--- via Python-list wrote:
> > I have a question on my homework. My homework is to write a program in 
> > which the computer simulates the rolling of a die 50
> > times and then prints
> > (i). the most frequent side of the die
> > (ii). the average die value of all rolls.
> > I wrote the program so it says the most frequent number out of all the 
> > rolls for example (12,4,6,14,10,4) and will print out "14" instead of 4 
> > like I need.
> 
> How did you come up with 4?  I come up with 3.36 with those numbers.
> 
> > This is what I have so far:
> > import random
> > 
> > def rollDie(number):
> >  rolls = [0] * 6
> 
> For a small efficiency use "[0] * 7".  See below for reason.
> 
> >  for i in range(0, number):
> >  roll=int(random.randint(1,6))
> >  rolls[roll - 1] += 1
> 
> Use "rolls[roll] += 1" here.  You save one arithmetic instruction each 
> time through the loop.  Fifty times isn't much saving but imagine fifty 
> million.
> 
> >  return rolls
> 
> return rolls[1:].  No matter how many rolls you only need to do the 
> slice once.  However, you really need a lot of iterations before it 
> really affects the total run time.
> 
> You need one more thing though.  Create a new variable called "total" 
> and set it to 0.0.  Add "total += roll" to your loop.  your return 
> statement is now "return rolls[1:], total/number".
> 
> > 
> > if __name__ == "__main__":
> >  result = rollDie(50)
> 
> Now "result, average = ..."
> 
> >  print (result)
> >  print(max(result))
> 
> This is why you get 14.  The maximum number of rolls for any one side is 
> 14 for side 4.  Is that where you got "4"?
> 
> -- 
> D'Arcy J.M. Cain
> Vybe Networks Inc.
> http://www.VybeNetworks.com/
> IM:[email protected] VoIP: sip:[email protected]

The 'four' is the number which was rolled the highest during the 50 rolls
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: why won't slicing lists raise IndexError?

2017-12-06 Thread Ned Batchelder
After a certain point, the only thing you can do with a troll is ignore 
them.


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


Re: Round to 2 decimal places

2017-12-06 Thread nick martinez via Python-list
On Wednesday, December 6, 2017 at 8:13:36 PM UTC-5, [email protected] wrote:
> The following works:
> 
> import math
> 
> print("This program will calculate the surface area and volume of a 
> 3-dimensional cone: ")
> print()
> print()
> r = input("What is the radius in feet? (no negatives): ")
> h = input("What is the height in feet? (no negatives): ")
> r = float(r)
> h = float(h)
> if r > 0 and h > 0:
> 
> surfacearea = math.pi * r ** 2 + r * math.pi * (math.sqrt(r ** 2 + h ** 
> 2))
> volume = (1 / 3) * math.pi * r ** 2 * h
> 
> print()
> print("Your Answer is:")
> print()
> 
> print("A cone with radius", r, "\nand height of", h, "\nhas a volume of : 
> ", round(volume,2), "\nand surface area of : ",
>   round(surfacearea,2), )
> else:
> print("No negatives allowed, try again.")

Tried this but it doesn't seem to work. It still prints out all of the decimals 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Module _socket not found in python3.6 "No module named _socket"

2017-12-06 Thread Steve D'Aprano
On Thu, 7 Dec 2017 07:59 am, Bryan Zimmer wrote:

> I have been getting this message, "No module named '_socket'", since I
> installed python 3.6, about two months ago.
> 
> My platform is Slackware Linux (14.2). I compiled python3.6 from source,
> because binary python packages aren't distributed by python.org for Linux.
> I have the same experience on multiple Slackware computers, not just one.
> Actually, this problem hits the 64-bit distribution. I have a 32-bit
> Slackware box that has no trouble with _socket.

You need to look at the output of compilation. That might mean doing it
again :-(

Unfortunately the default is to output everything including the kitchen sink,
which makes it hard to notice the errors.

Take note of which files failed to compile, and if need be, post the list
here. Chances are you are missing some development library. You may have the
32-bit dev library installed, but not the 64-bit version.


> I can not 'import socket' into a program, nor can I use 'pip' to install
> modules. These require the _socket module, which doesn't exist. What does
> exist is a shared library object called '_
> socket.cpython-36m-i386-linux-gnu.so'. This looks tantalizingly like the
> missing module, but it is for a 32-bit architecture.

Where is that file? On your 64-bit box?

Do you have the 32-bit Python 3.6 already installed on that machine? If so,
make sure you install the 64-bit version in a different location.

If this isn't enough to diagnose the problems, best to go back to basics and
post *each* step you take and any error output. (The config and make steps
tend to send a metric ton of uninformative output to stdout, probably best to
just capture stderr.) Trivial steps that you are sure are correct can be
summarised (e.g. "Downloaded Python3.6.tar.gz, unpacked it, and cd'ed into
the resulting directory") but if you have any doubt that you are doing it
correctly, better to post too much information than not enough.



-- 
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: 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 to everyone but you that seq was a
> sequence defined elsewhere, n was an index defined
> elsewhere, and both process and do_without_item were
> functions defined elsewhere.

OMG! I never would have guessed that! O_O

And whilst we can see that your cryptology skills are quite
impressive -- and by impressive, i mean, like up there with
some of the best cryptologist in the world, impressive --
your ability to distinguish between the portions of this
teeny tiny example that are _relevant_ to the action of
performing a slice, and the portions that are _irrelevant_
to performing a slice, leads me to the conclusion that your
ability to make simple value judgments is seriously
flawed, or missing altogether.

If we consider the entire working sample that Ned offered
(because Ned is the only person from your side who's
bothered to offer error-free code) and we break this code
down into its relevant parts, starting from the most
relevant part (the actual slice), and extending the scope
outwards from there, each time enveloping only the minimum
structures required to maintain legal code, we will see that
all of the structures *SANS* the else-clause can be
justified. The function can be justified because it wraps
the contents in a self contained reusable code object.
Likewise, the conditional *if-clause* can be justified
because it brings logic into the equation. But the else-
clause is only relevant to the if-clause, and does not offer
_enough_ useful content of its own to validate its own
existence.

> And even if you want to be so incredibly pedantic that
> do_without_item (and only do_without_item, because the rest
> of the code fragment seems to get your seal of approval) is
> not defined, your "functioning equivalent" is still not
> equivalent, because the original code would have raised a
> NameError that yours doesn't.

Oh this is rich. Now i'm wrong because my code executes
_cleanly_? You must be joking!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Round to 2 decimal places

2017-12-06 Thread ssghotra1997
On Thursday, December 7, 2017 at 12:39:38 PM UTC+11, nick martinez wrote:
> On Wednesday, December 6, 2017 at 8:13:36 PM UTC-5, [email protected] wrote:
> > The following works:
> > 
> > import math
> > 
> > print("This program will calculate the surface area and volume of a 
> > 3-dimensional cone: ")
> > print()
> > print()
> > r = input("What is the radius in feet? (no negatives): ")
> > h = input("What is the height in feet? (no negatives): ")
> > r = float(r)
> > h = float(h)
> > if r > 0 and h > 0:
> > 
> > surfacearea = math.pi * r ** 2 + r * math.pi * (math.sqrt(r ** 2 + h ** 
> > 2))
> > volume = (1 / 3) * math.pi * r ** 2 * h
> > 
> > print()
> > print("Your Answer is:")
> > print()
> > 
> > print("A cone with radius", r, "\nand height of", h, "\nhas a volume of 
> > : ", round(volume,2), "\nand surface area of : ",
> >   round(surfacearea,2), )
> > else:
> > print("No negatives allowed, try again.")
> 
> Tried this but it doesn't seem to work. It still prints out all of the 
> decimals

This is the output from the code above (Working):

What is the radius in feet? (no negatives): >? 2
What is the height in feet? (no negatives): >? 4
Your Answer is:
A cone with radius 2.0 
and height of 4.0 
has a volume of :  16.76 
and surface area of :  40.67
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Round to 2 decimal places

2017-12-06 Thread MRAB

On 2017-12-07 01:39, nick martinez via Python-list wrote:

On Wednesday, December 6, 2017 at 8:13:36 PM UTC-5, [email protected] wrote:

The following works:

import math

print("This program will calculate the surface area and volume of a 3-dimensional 
cone: ")
print()
print()
r = input("What is the radius in feet? (no negatives): ")
h = input("What is the height in feet? (no negatives): ")
r = float(r)
h = float(h)
if r > 0 and h > 0:

surfacearea = math.pi * r ** 2 + r * math.pi * (math.sqrt(r ** 2 + h ** 2))
volume = (1 / 3) * math.pi * r ** 2 * h

print()
print("Your Answer is:")
print()

print("A cone with radius", r, "\nand height of", h, "\nhas a volume of : ", 
round(volume,2), "\nand surface area of : ",
  round(surfacearea,2), )
else:
print("No negatives allowed, try again.")


Tried this but it doesn't seem to work. It still prints out all of the decimals


Try using .format:

print("A cone with radius {}\nand height of {}\nhas a volume of : 
{:.2f}\nand surface area of : {:.2f}".format(r, h, volume, surfacearea)))


round(volume,2) will round the volume to 2 decimal places, but 
floating-point numbers in Python are stored in binary, and you can't 
always represent a fractional decimal number exactly in binary. For 
example, you can't store 0.1 exactly as a float.

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


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

2017-12-06 Thread Steve D'Aprano
On Thu, 7 Dec 2017 08:22 am, Python wrote:

> On Wed, Dec 06, 2017 at 10:35:58AM +1100, Steve D'Aprano wrote:
>> On Tue, 5 Dec 2017 07:58 pm, 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”.
>> 
>> 
>> Then how does my Linux box know that when I double-click on a text file, it
>> launches kwrite rather than (say) the Gimp or LibreOffice?
> 
> The answer to that is (sadly) complicated.

Actually, no, the answer to my question is very simple: Lawrence is mistaken
about Linux not doing file associations. It does -- it is merely handled by
the desktop environment (if there is one).

Lawrence is showing off his geek cred with an answer that is pedantically
correct but in practice not just useless but actually false. Of course Linux
computers can associate certain files with certain applications.

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 OS X and maybe even
Windows itself.


> How it knows indeed 
> depends on the context of the click, what desktop environment you're
> using, what application(s) you're using, and what configurations
> you've made to those things to address any file associations.

Indeed you are correct, which is why it may not be a trivial matter to answer
the OP's question about how to get the behaviour he wants. But that isn't
what my comment is about. I'm simply replying to Lawrence's insinuation that
Linux computers don't associate file types to applications.

I'm sure that Lawrence worded his statement *ever so carefully* to ensure that
it was pedantically correct if read to the letter, while still insinuating
something completely wrong. It takes a lot of care to provide information
which is both true and utterly misleading at the same time, but Lawrence does
it very, very well indeed.

If only he would use his considerable intellect to provide *useful* answers
instead of *accurate but misleading* answers.



-- 
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: Round to 2 decimal places

2017-12-06 Thread nick martinez via Python-list
On Wednesday, December 6, 2017 at 9:03:27 PM UTC-5, [email protected] wrote:
> On Thursday, December 7, 2017 at 12:39:38 PM UTC+11, nick martinez wrote:
> > On Wednesday, December 6, 2017 at 8:13:36 PM UTC-5, [email protected] 
> > wrote:
> > > The following works:
> > > 
> > > import math
> > > 
> > > print("This program will calculate the surface area and volume of a 
> > > 3-dimensional cone: ")
> > > print()
> > > print()
> > > r = input("What is the radius in feet? (no negatives): ")
> > > h = input("What is the height in feet? (no negatives): ")
> > > r = float(r)
> > > h = float(h)
> > > if r > 0 and h > 0:
> > > 
> > > surfacearea = math.pi * r ** 2 + r * math.pi * (math.sqrt(r ** 2 + h 
> > > ** 2))
> > > volume = (1 / 3) * math.pi * r ** 2 * h
> > > 
> > > print()
> > > print("Your Answer is:")
> > > print()
> > > 
> > > print("A cone with radius", r, "\nand height of", h, "\nhas a volume 
> > > of : ", round(volume,2), "\nand surface area of : ",
> > >   round(surfacearea,2), )
> > > else:
> > > print("No negatives allowed, try again.")
> > 
> > Tried this but it doesn't seem to work. It still prints out all of the 
> > decimals
> 
> This is the output from the code above (Working):
> 
> What is the radius in feet? (no negatives): >? 2
> What is the height in feet? (no negatives): >? 4
> Your Answer is:
> A cone with radius 2.0 
> and height of 4.0 
> has a volume of :  16.76 
> and surface area of :  40.67

interesting, what version of python are you using? Tried it multiple times and 
it still isn't working.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Module _socket not found in python3.6 "No module named _socket"

2017-12-06 Thread pavan kopparthi
I too facing the same issue related to pip file for other models
installation.

Installed Python 3.6.3 Amd64 in Windows 10 OS.

Want to install Tensor flow using native pip as suggested...
But, observed that pip3 file in Scripts folder is missing. Also, Scripts
folder is empty.

On 7 Dec 2017 3:02 a.m., "Bryan Zimmer"  wrote:

I have been getting this message, "No module named '_socket'", since I
installed python 3.6, about two months ago.

My platform is Slackware Linux (14.2). I compiled python3.6 from source,
because binary python packages aren't distributed by python.org for Linux.
I have the same experience on multiple Slackware computers, not just one.
Actually, this problem hits the 64-bit distribution. I have a 32-bit
Slackware box that has no trouble with _socket.

I can not 'import socket' into a program, nor can I use 'pip' to install
modules. These require the _socket module, which doesn't exist. What does
exist is a shared library object called '_
socket.cpython-36m-i386-linux-gnu.so'. This looks tantalizingly like the
missing module, but it is for a 32-bit architecture.

This is not the only missing module for 64-bit Slackware Linux. I can not
find a trace of the 'math' module, which, again, works fine on my 32-bit
computer.

I am far from an expert on installing python modules, so I am asking for
advice on how I should proceed to find these modules.

Thanks in advance.

"BryGuy" (my handle on linuxquestions.org)
--
https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Round to 2 decimal places

2017-12-06 Thread nick martinez via Python-list
On Wednesday, December 6, 2017 at 9:32:27 PM UTC-5, nick martinez wrote:
> On Wednesday, December 6, 2017 at 9:03:27 PM UTC-5, [email protected] wrote:
> > On Thursday, December 7, 2017 at 12:39:38 PM UTC+11, nick martinez wrote:
> > > On Wednesday, December 6, 2017 at 8:13:36 PM UTC-5, [email protected] 
> > > wrote:
> > > > The following works:
> > > > 
> > > > import math
> > > > 
> > > > print("This program will calculate the surface area and volume of a 
> > > > 3-dimensional cone: ")
> > > > print()
> > > > print()
> > > > r = input("What is the radius in feet? (no negatives): ")
> > > > h = input("What is the height in feet? (no negatives): ")
> > > > r = float(r)
> > > > h = float(h)
> > > > if r > 0 and h > 0:
> > > > 
> > > > surfacearea = math.pi * r ** 2 + r * math.pi * (math.sqrt(r ** 2 + 
> > > > h ** 2))
> > > > volume = (1 / 3) * math.pi * r ** 2 * h
> > > > 
> > > > print()
> > > > print("Your Answer is:")
> > > > print()
> > > > 
> > > > print("A cone with radius", r, "\nand height of", h, "\nhas a 
> > > > volume of : ", round(volume,2), "\nand surface area of : ",
> > > >   round(surfacearea,2), )
> > > > else:
> > > > print("No negatives allowed, try again.")
> > > 
> > > Tried this but it doesn't seem to work. It still prints out all of the 
> > > decimals
> > 
> > This is the output from the code above (Working):
> > 
> > What is the radius in feet? (no negatives): >? 2
> > What is the height in feet? (no negatives): >? 4
> > Your Answer is:
> > A cone with radius 2.0 
> > and height of 4.0 
> > has a volume of :  16.76 
> > and surface area of :  40.67
> 
> interesting, what version of python are you using? Tried it multiple times 
> and it still isn't working.

Never mind its working now, just had to change something up real quick, thank 
you.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Round to 2 decimal places

2017-12-06 Thread Steve D'Aprano
On Thu, 7 Dec 2017 11:58 am, nick martinez wrote:

> I'm stuck. I need my program to round the end solution to 2 decimal places
> but cant figure it out. Can someone help? I've been trying between printf
> and round() but cant seem to get either to work.

It might help if you show exactly what values you have tried. This works for
me:

py> volume = 1.23456789
py> print(volume )
1.23456789
py> print(round(volume , 2))
1.23

The rest of your code is interesting but irrelevant to your question. If you
want to learn how to round to 2 decimal places, the actual calculation of
surface area and volume aren't necessary. The only really important part is
this line:

>print("A cone with radius", r, "\nand height of", h, "\nhas a volume of :
>", volume, "\nand surface area of : ", surfacearea,)


and even that can be cut down to just:

volume = 2345.987654321  # for example
print(volume)


We can round the result first, then print it:


print(round(volume, 2))


or we can change the display by using string formatting:


print("%.2f" % volume)

print("{:.2f}".format(volume))



-- 
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: Round to 2 decimal places

2017-12-06 Thread Steve D'Aprano
On Thu, 7 Dec 2017 01:31 pm, nick martinez wrote:

> interesting, what version of python are you using? Tried it multiple times
> and it still isn't working.


Please launch a terminal window, copy this command exactly into the terminal
and hit ENTER. You should have a $ or maybe % prompt for this to work.

python3.5 -c "volume = 257.148345678; print(round(volume, 2))"

(Do you need help opening a terminal window? If so, ask. We'll need to know
your operating system, and if you are using Linux, which desktop environment
you are using.)

If your prompt is ">>>" (without the quotes) or something similar to "In [1]:"
then copy these two lines to the prompt and hit ENTER:

volume = 257.148345678
print(round(volume, 2))

Either way, reply here with the output. Make sure you copy it.



-- 
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: we want python software

2017-12-06 Thread Ethan Furman

On 12/06/2017 08:33 AM, Steve D'Aprano wrote:


I'm going to defend KM (srikrishnamohan) -- his comments were not "an attack",


On 12/05/2017 08:38 PM, km wrote:
> I dont know how these students are selected into b tech stream in India.
> they are so dumb.

On 12/05/2017 09:27 PM, km wrote:
> You people can Google and watch movies / songs online  and you can't find
> how to download and install python ? That's ridiculous!

Really, Steve?

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


Re: we want python software

2017-12-06 Thread Ben Finney
Ethan Furman  writes:

> On 12/06/2017 08:33 AM, Steve D'Aprano wrote:
>
> > I'm going to defend KM (srikrishnamohan) -- his comments were not "an 
> > attack",
>
> On 12/05/2017 08:38 PM, km wrote:
> > I dont know how these students are selected into b tech stream in India.
> > they are so dumb.
>
> On 12/05/2017 09:27 PM, km wrote:
> > You people can Google and watch movies / songs online  and you can't find
> > how to download and install python ? That's ridiculous!
>
> Really, Steve?

I'm with Ethan; “km” took what appears to be a sincere request from a
newcomer, and responded with what I'd classify as personal attacks.

That is both unnecessary for the substance of “km”'s points, and
contrary to our Code of Conduct. Let's not defend that behaviour.

-- 
 \ “Nothing worth saying is inoffensive to everyone. Nothing worth |
  `\saying will fail to make you enemies. And nothing worth saying |
_o__)will not produce a confrontation.” —Johann Hari, 2011 |
Ben Finney

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


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

2017-12-06 Thread Karsten Hilbert
On Thu, Dec 07, 2017 at 01:29:11PM +1100, Steve D'Aprano wrote:

> Actually, no, the answer to my question is very simple: Lawrence is mistaken
> about Linux not doing file associations. It does -- it is merely handled by
> the desktop environment (if there is one).

We _can_ go one level below that: mailcap is independant of
the desktop environment, it does associate file (content)
types with suitable (hopefully) applications. The one thing
it doesn't "do" that's relevant to OPs post is that it
doesn't react to clicks or taps in order to _execute_ those
associations.

Best,
Karsten
-- 
GPG key ID E4071346 @ eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: we want python software

2017-12-06 Thread Marko Rauhamaa
Gregory Ewing :

> Rick Johnson wrote:
>> DOLT: "Programming is easy! Once you learn the langauge,
>> it's just a matter of fill-in-the-blanks."
>
> 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, and I had no trouble seeing how to
> apply them. I unconsciously assumed it would be the same for anyone
> else with a reasonable level of intelligence.
>
> It was a while before it became clear to me that this is not the case
> at all.

A junior programmer sees the unlimited possibilities of programming. No
montain is too high to climb.

A seasoned programmer is elated if they can get anything to work at all.


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