Re: Python Book for a C Programmer?

2012-05-24 Thread boB Stepp
On Thu, May 24, 2012 at 8:28 AM, Javier Novoa C.
 wrote:
> On 2012-05-24, alister  wrote:
>> On Wed, 23 May 2012 16:45:05 -0700, hsaziz wrote:
>>
>>> I am trying to join an online class that uses python. I need to brush up
>>> on the language quickly. Is there a good book or resource that covers it
>>> well but does not have to explain what an if..then..else statement is?
>>>
>>> Thanks.
>>
>> Dive into python seems to be quite popular & can be read online fro free
>>
>>
>
> Learning Python by Mark Lutz, from O'Reilly is a good one, I've been
> reading it and it also enforces a comparison between C programming and
> Python. However, it's focused on Python 2, but it also mentions Python
> 3 things in the text...
>

There is a new edition out, copyright 2010 if I recall correctly, that
updates its coverage to Python 3.x, which is the book's primary focus,
though it points out where 3.x syntax does not work in version 2.x.

Cheers!
boB
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Questions.

2017-09-08 Thread boB Stepp
On Fri, Sep 8, 2017 at 9:54 PM, Michael Torrie  wrote:
> On 09/08/2017 08:35 PM, V Vishwanathan wrote:
>> Hi, From what I see in the recent 4/5 digests, this forum seems to be for 
>> advanced
>>
>> and professional programmers.
>>
>> So wondering if a newbie can post some questions to understand errors in his 
>> code
>>
>> or will it look silly?
>
> Yes you may indeed post here.  There's also a beginners list called
> python-help, which may seem less intimidating.

That would be Python Tutor.  Subscription information may be found at

https://mail.python.org/mailman/listinfo/tutor

It is a moderated list, so there may be a short delay before your
first post(s) may come through.



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


Re: The "loop and a half"

2017-10-09 Thread boB Stepp
On Sun, Oct 8, 2017 at 5:36 AM, bartc  wrote:
>
> On 08/10/2017 10:12, Steve D'Aprano wrote:
>>
>> On Sun, 8 Oct 2017 02:06 am, bartc wrote:

>>> I'm getting fed up with this thread now.
>>
>>
>> This thread would be a lot less frustrating if you would enter into it with a
>> spirit of open-minded enquiry rather than an overbearing sense of superiority
>> that anything others do that you don't must be worthless.
>
>
> Frustrating for whom?
>
> It seems to me that it's pretty much everyone here who has an overbearing 
> sense of superiority in that everything that Unix or Linux does is a million 
> times better than anything else.

I follow this list in an effort to learn as much as I can even though
I am usually a fish out of water here.  But this thread in all its
twists and turns and various subject line changes seems to have gotten
totally out of hand.  Even though I am quoting only part of this one
message, there are actually many others that I am responding to here.

In my opinion (Honestly admitting my lack of technical competence.),
this insatiable thirst on this list to get every bit of technical
minutiae exactly correct is doing a severe disservice to the
friendliness of this community.  Yes, gently correct the (perceived)
errors, because we all want to have it right, but please cease this
incessant pounding of points (and people) into the ground to prove we
are right and they are wrong!

I doubt any of this is going to change Bart's mind.  Why can we not
allow him to make his points, respond to them appropriately, and then
let it go when it is clear he has strongly held opinions that are not
likely to change?

And Bart, when large numbers of technical experts in their fields have
spent many hours/months/years, yea, even several decades, developing
these software systems, why do you think that you, all by yourself,
know better?  Can you not see how frustrating this is for people who
have spent good chunks of their lives trying to do the best they can
on these software systems?  Don't you think it is a better approach to
perhaps do some self-examination and approach things from a more
humble learner's perspective?  And BTW, there are many users of
non-*nix systems on this list, or who do work on multiple operating
system platforms.

Can we not let people be who they are, perceived warts (valid or not)
and all, and after responding (hopefully gently) to technical errors
just let them be???

Peace.


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


OT: MPC-HC project ending? [Re: Lies in education [was Re: The "loop and a half"]]

2017-10-11 Thread boB Stepp
On Wed, Oct 11, 2017 at 4:45 PM, Mikhail V  wrote:

>
> PS Off-topic:
> I have a related observation regarding popularity of software.
> There is such a program "VLC", which is a video player. Some would
> think it is sort of best free player, etc. I was also under impression,
> but then I've found a video player called "MPC-HC".
> I have started to use it and quickly understood that it is by far more
> superior player than VLC, literally by all core parameters - performance,
> codec support, customizable key bindings with a lot of internal commands.
> (Remark for Linux users: there is no Linux version of that player, it
> is Windows-only)

I went to https://mpc-hc.org/2017/07/16/1.7.13-released-and-farewell/
and it says:



 July 16, 2017  XhmikosR

v1.7.13, the latest, and probably the last release of our project…

For quite a few months now, or even years, the number of active
developers has been decreasing and has inevitably reached zero. This,
unfortunately, means that the project is officially dead and this
release would be the last one.

…Unless some people step up that is.

So, if someone’s willing to really contribute and has C/C++
experience, let me know on IRC or via e-mail.

Otherwise, all things come to an end and life goes on. It’s been a
nice journey and I’m personally pretty overwhelmed having to write
this post.

Thanks to everyone who has contributed in any way all these years;
Remember, MPC-HC is an 11-year old project.






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


Re: Python 2 -> 3, urllib.urlOpen

2017-10-13 Thread boB Stepp
On Fri, Oct 13, 2017 at 5:27 PM, Irv Kalb  wrote:

> I've looked at the Python 3.6 documentation for urllib, and I see that 
> certain calls have been changed and others have been eliminated.  But my eyes 
> glaze over trying to figure out what to use instead.
>
> My question is: Is there a simple (hopefully one or two line) replacement for 
> my call to url lib.urlopen().read()

I don't know much about this, but might you be looking for
urllib.request.urlopen()?  See

https://docs.python.org/3/library/urllib.request.html#module-urllib.request

in the docs.

> I know that there are other modules out there that handle requests (like the 
> Requests module), but this is a strictly controlled university environment.  
> I cannot download any external packages (other then pygame, which I got 
> special permission for) onto the computers in the school.  Therefore, I'm 
> looking for something in the Python 3.6 Standard Library.

The above is in the standard library.
-- 
boB
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python noob having a little trouble with strings

2017-10-26 Thread boB Stepp
On Thu, Oct 26, 2017 at 9:25 PM,   wrote:
> If s1 = "Welcome students", what is the output when you print the following:
>
> 1. s4 = 3 * s1
>
> 2. s1[3 : 6]
>
> 3. 'W' in s1
>
> 4. S1[-1]
>
> 5. S1[:-1]
>
> Any help would be great, thanks!

Why not find out for yourself and print these in the Python
interpreter?  For instance:

> py
Python 3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:57:36) [MSC v.1900 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
py3: s1 = "Welcome students"
py3: s4 = 3 * s1
py3: print(s4)
Welcome studentsWelcome studentsWelcome students



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


Are the critiques in "All the things I hate about Python" valid?

2018-02-16 Thread boB Stepp
This article is written by Nathan Murthy, a staff software engineer at
Tesla.  The article is found at:
https://medium.com/@natemurthy/all-the-things-i-hate-about-python-5c5ff5fda95e

Apparently he chose his article title as "click bait".  Apparently he
does not really hate Python (So he says.).  His leader paragraph is:

"Python is viewed as a ubiquitous programming language; however, its
design limits its potential as a reliable and high performance systems
language. Unfortunately, not every developer is aware of its
limitations."

As I currently do not have the necessary technical knowledge to
properly evaluate his claims, I thought I would ask those of you who
do.  I have neither the knowledge or boB-hours to write a large
distributed system code base, but I am curious if Python is truly
limited for doing these in the ways he claims.

BTW, I am not trying to start (another) heated, emotional thread.  You
guys do sometimes get carried away!  I honestly just what to know the
truth of the matters out of my continuing to learn Python.  I suspect
there is probably some truth in his claims, but I am not sure if he is
taking things out of their proper application contexts or not.

Thanks!
-- 
boB
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-16 Thread boB Stepp
On Fri, Feb 16, 2018 at 10:05 PM, Ben Finney  wrote:

> He blithely conflates “weakly typed” (Python objects are not weakly, but
> very strongly typed) with “dynamically typed” (yes, Python's name
> binding is dynamically typed). Those are two, orthognal dimensions to
> describe a language.
>
> All the assertions about “strongly typed” should instead be read as
> “statically typed”. I do not think the author understands the
> differences, nor the trade-offs involved, in the weak–strong dimension
> nor the static–dynamic dimension.

I should have caught the "weakly typed" error.  But I was too
distracted by his "type safety" train of thought.  And this is one I
am still puzzling over:  Are statically-typed languages inherently
"safer" than properly implemented dynamically-typed languages?  I can
see the advantages of catching type errors at compile time versus run
time.  And with the relatively recent introduction of type hints to
python, I was wondering if this was indeed a perceived,
need-to-correct weakness by the python devs?  But I have seen myself
the advantages of being able to rebind identifiers to differently
typed objects than what they started out being bound to.  So I do not
have enough knowledge to properly evaluate software safety or
robustness in terms of how a language is typed.

> A strong hint is in the complaint about the Global Interpreter Lock.
> This is a property of only one implementation: the CPython
> implementation. It is a known limitation and many people have worked for
> many years to ameliorate it; it is unclear whether the author knows of
> anything done in recent years (the only specific information cited is
> for 2012; a reminder, that's *six years ago*, a aeon in platform
> development).

This is another of my big technical weak spots.  I currently believe
that doing concurrent and asynchronous programming is a difficult
chore in any language, but I have yet gotten to the point of where I
know enough to start struggling myself with these forms of
programming.  I do know from some of my books that there are ways
despite the GIL to handle these types of programming problems with the
current CPython implementation.  But I do not know enough to evaluate
how well or poorly python can make use of multicore processors.

> The author also uses very old information when complaining about Python
> 2 versus Python 3. The citation of grave fears is to a 2014 article. The
> author shows no signs of awareness that the Python 3 ecosystem is very
> healthy today compared to Python 2.

I mostly dismissed out of hand this section.  The only disturbing
part, in my mind, was the claim that individual companies have python
2 vs. 3 rifts within their companies.  I hope that is not really true.

> The complaint about abstractions makes another silly conflation; the
> author seems to think any language that does object-orientation
> differently from Java, is obviously wrong. The author may benefit from
> reading http://dirtsimple.org/2004/12/python-is-not-java.html>
> (advice which is no less relevant than in 2004). But maybe not.

Again, my only concern here was software safety issue claims.  Does
locking down object attribute access by the language necessarily
improve software safety or robustness?  I actually like python's
"we're all consenting adults" mentality.  It seems to me that the
quality of the code is more reflective of the quality of the
programmers than protecting (mediocre?) programmers from themselves by
language design.  But then again, maybe these sorts of language design
restrictions make for fewer errors, even by excellent programmers,
than not doing so.  Again, I don't believe I know enough to
intelligently evaluate the pros and cons.

> The author acknowledges in the conclusion that “nothing I’ve said is
> new”. I would argue that most of what is said is not even true; the
> article should not be referenced at all, IMO.
>
Ben, I guess I am trying to be more charitable in my interpretation of
the author's intent and actual knowledge.  I was led to this article
via one of the two weekly python news collation email services that I
subscribe to, so I am hoping to learn something from the article and
everyone's feedback.  What's the old saw?  Even a blind squirrel finds
a nut once in a while?

Thanks!
-- 
boB
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-16 Thread boB Stepp
On Fri, Feb 16, 2018 at 10:25 PM, Chris Angelico  wrote:

>
> 1) Type safety.
>
> This is often touted as a necessity for industrial-grade software. It
> isn't...

Chris, would you mind expanding on this point?  What is necessary for
industrial-grade, safe, robust software?  Do statically-typed
languages give any real advantage over dynamically-typed languages in
this context?  I know much is achieved by how the software is designed
and the practices used to implement the design that are independent of
the language used.  But what language features/components are
essential for industrial-grade software?




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


Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-16 Thread boB Stepp
I've just reread everyone's replies and one point you mentioned about
the GIL caught my eye ...

On Fri, Feb 16, 2018 at 11:16 PM, Chris Angelico  wrote:

> Asynchronicity and concurrency are hard. Getting your head around a
> program that is simultaneously doing two things is inherently tricky.
> Anything that simplifies this (such as providing atomic and
> thread-safe operations on high-level data structures) will make this
> sort of work FAR easier. That's what Python gives you. CPython's
> current implementation (with the GIL) is reasonably easy to
> conceptualize, and requires very few other locks to make everything
> work sanely; all attempts to remove the GIL from CPython have involved
> other tradeoffs, usually resulting in significant performance
> penalties on single-threaded code.

I am curious as to what efforts have been attempted to remove the GIL
and what tradeoffs resulted and why?  Is there a single article
somewhere that collates this information?  I fear if I try to Google
this I will get a lot of scattered pieces that I will have to wade
through to get to what I want to know, where you (or someone else)
might be able to point me to a good link.  Or kindly summarize
yourself the relevant information.

Thanks!


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


Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-16 Thread boB Stepp
On Sat, Feb 17, 2018 at 12:54 AM, Chris Angelico  wrote:
> On Sat, Feb 17, 2018 at 5:25 PM, boB Stepp  wrote:

>>
>> I am curious as to what efforts have been attempted to remove the GIL
>> and what tradeoffs resulted and why?  Is there a single article
>> somewhere that collates this information?  I fear if I try to Google
>> this I will get a lot of scattered pieces that I will have to wade
>> through to get to what I want to know, where you (or someone else)
>> might be able to point me to a good link.  Or kindly summarize
>> yourself the relevant information.
>>
>> Thanks!
>
> No, there isn't a single article, at least not that I know of. A good
> word to search for is "gilectomy", which brought me to this talk by
> Larry Hastings:
>
> https://www.youtube.com/watch?v=pLqv11ScGsQ

Thanks for the link.  I'll give it a look tomorrow.  Must get some sleep soon!

Meanwhile I just finished reading "Efficiently Exploiting Multiple
Cores with Python" (from Nick Coghlan's Python Notes) at
http://python-notes.curiousefficiency.org/en/latest/python3/multicore_python.html
 It answered some of my questions and has a lot of good information.
It appears that a "gilectomy" as you put it is a really tough problem.
It looks to me that it might require a major
backwards-compatibility-breaking change to CPython to implement if I
am even close to understanding the issues involved.

> Broadly speaking, what happens is that removing a large-scale lock
> (the GIL) requires using a whole lot of small-scale locks. That gives
> finer granularity, but it also adds a whole lot of overhead; the CPU
> features required for implementing those locks are not fast. With the
> GIL, you claim it, and you can do what you like. Without the GIL, you
> have to claim a lock on each object you manipulate, or something along
> those lines. (Different attempts have gone for different forms of
> granularity, so I can't generalize too much here.) That means claiming
> and relinquishing a lot more locks, which in turn means a lot more
> CPU-level "lock" primitives. That's a lot of overhead.

Thanks for this explanation.  It really helps me a lot!

> One of the best ways to multi-thread CPU-intensive work is to push a
> lot of the work into an extension library. Take a function like this:
>
> def frobnosticate(stuff):
> magic magic magic
> magic magic more magic
> return result
>
> As long as the returned object is a newly-created one and the
> parameter is not mutated in any way, you can do all the work in the
> middle without holding the GIL. That can't be done in pure Python, but
> in a C function, it certainly can. You still have the coarse-grained
> locking of the GIL, you still have all the protection, but you can now
> have two threads frobnosticating different stuff at the same time.

Yeah, Coghlan's article mentioned this.  I guess using Cython would be
one approach to this.

Thanks, Chris!


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


Re: How to make Python run as fast (or faster) than Julia

2018-02-23 Thread boB Stepp
On Fri, Feb 23, 2018 at 1:16 PM, Chris Angelico  wrote:
> On Sat, Feb 24, 2018 at 6:09 AM, Python  wrote:
>> On Sat, Feb 24, 2018 at 05:56:25AM +1100, Chris Angelico wrote:
>>> No, not satisfied. Everything you've said would still be satisfied if
>>> all versions of the benchmark used the same non-recursive algorithm.
>>> There's nothing here that says it's testing recursion, just that (for
>>> consistency) it's testing the same algorithm. There is no reason to
>>> specifically test *recursion*, unless that actually aligns with what
>>> you're doing.
>>
>> It seems abundantly clear to me that testing recursion is the point of
>> writing a benchmark implementing recursion (and very little of
>> anything else).  Again, you can decide for yourself the suitability of
>> the benchmark, but I don't think you can really claim it doesn't
>> effectively test what it means to.
>
> Where do you get that it's specifically a recursion benchmark though?
> I can't find it anywhere in the explanatory text.

I hope I am not missing something blatantly obvious, but in the page
Python linked to (https://julialang.org/benchmarks/), in the opening
paragraph it states:


These micro-benchmarks, while not comprehensive, do test compiler
performance on a range of common code patterns, such as function
calls, string parsing, sorting, numerical loops, random number
generation, recursion, and array operations.


Recursion is listed above as one code pattern to specifically target
with one of their micro-benchmarks.  I did not exhaustively go through
each language's code examples, but it does appear that the authors of
these benchmarks are implementing as exactly as possible the same
algorithm chosen for each of these code patterns in each language.
Now to me the real question is whether the Julia people were trying to
be intellectually honest in their choices of coding patterns and
algorithms or were they deliberately cherry picking these to make
Julia look better than the competition?  Myself, I would rather be
charitable than accusatory about the benchmarkers' intentions.  For
instance, the authors were aware of numpy and used it for some of the
python coding -- the array operations they were targeting IIRC.
Instead, if they were being deliberately dishonest, they could have
come up with some really contrived python code.



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


Re: Application window geometry specifier

2021-01-13 Thread boB Stepp
On Wed, Jan 13, 2021 at 7:28 PM Chris Angelico  wrote:

> I love how "I think" is allowed to trump decades of usability research.

Can you recommend a good reference for someone relatively new to GUI
programming that is based on such research?  Book or web reference
would be fine.

Cheers!
boB
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: IDE tools to debug in Python?

2021-02-05 Thread boB Stepp

On Sat, Feb 06, 2021 at 01:27:34AM +, flaskee via Python-list wrote:


On Friday, February 5, 2021 5:03 PM, Schachner, Joseph 
 wrote:
As regards the Alan pdb note; yes -- I was trying for
a full IDE & integrated debugging,
along the lines of Visual Studio, pre-sneaky-Telemetry API.


You do know that there is a 100% open source version of Microsoft VS Code
with absolutely no tracking?  It is VSCodium:  https://vscodium.com/
Perhaps it is more along the lines of what you are looking for?

--
Wishing you only the best,

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


Re: New Python implementation

2021-02-16 Thread boB Stepp

On 21/02/16 11:03AM, Alan Gauld wrote:


Python v1 was a good teaching language. v2 complicated it a bit
but it was still usable. v3 is no longer a good teaching language
(unless maybe you are teaching CompSci at university.)


[...]


And that's just one example, the language is now full of meta goodness
that makes it incomprehensible to beginners. In a teaching environment,
with a teacher present to answer questions, it's probably usable,
but for a self guided course it's increasingly inscrutable.


Hmm.  I'm not sure I can agree, Alan.  My son took to Python 3 like a duck to
water.  Occasionally he has had questions for me, but, for the most part, he
has been entirely on his own with no issues.  He now has several projects that
others are using, including a significant update to someone else's project he
was interested online to both update the Python and Qt.

Yes, there is a ton of meta-goodness in Python, but most of it can be ignored
to be able to *just use it*.  My wife is using Python 3 in a robotics class
she teaches and her high school students find it accessible.  AP computer
science second semester uses Python.  I really don't think it is much of a
problem for most people.  Of course on the Tutor list there often seems to be
some greatly puzzled people, but I think their issues stem from *never* having
tried to do anything even remotely technical other than clicking around in
the GUI programs they have become comfortable with.

--
Wishing you only the best,

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


Re: If you have Python Cookbook, 3rd ed.

2021-05-20 Thread boB Stepp
On Thu, May 20, 2021 at 11:43 AM Terry Reedy  wrote:
>
> can you verify that the Algorithm chapter (near end in 2nd ed.) does
> *NOT* have an introduction by Tim Peters?
> (Info needed to verify timeit doc correction
> https://github.com/python/cpython/pull/21744)

In my 3rd edition copy chapter 1 is "Data Structures and Algorithms".
The only thing comprising an introduction is a brief paragraph that
starts the chapter and has no attribution.

HTH,
boB Stepp
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: If you have Python Cookbook, 3rd ed.

2021-05-20 Thread boB Stepp
On Thu, May 20, 2021 at 3:48 PM Terry Reedy  wrote:
>
> On 5/20/2021 1:14 PM, boB Stepp wrote:
> > On Thu, May 20, 2021 at 11:43 AM Terry Reedy  wrote:
> >>
> >> can you verify that the Algorithm chapter (near end in 2nd ed.) does
> >> *NOT* have an introduction by Tim Peters?
> >> (Info needed to verify timeit doc correction
> >> https://github.com/python/cpython/pull/21744)
> >
> > In my 3rd edition copy chapter 1 is "Data Structures and Algorithms".
> > The only thing comprising an introduction is a brief paragraph that
> > starts the chapter and has no attribution.
>
> Hmm. 2nd ed starts with 1. Text.  The intro mentioned was for 18.
> Algorithms, starting with removing duplicates from a sequence.

3rd edition in chapter 1 starts with "1.1 Unpacking a Sequence into
Separate Variables"

Later in chapter is "1.10 Removing Duplicates from a Sequence while
Maintaining Order".

The preface does say the third edition is a major rewrite, so I
suppose there will be significant differences from the 2nd edition
which I don't own.

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


Re: Turtle module

2021-05-26 Thread boB Stepp
On Wed, May 26, 2021 at 10:59 AM Michael F. Stemper  wrote:

> In order to turn the turtle, I need to select a way to represent
> angles. I could use either degrees or radians (or, I suppose,
> grads). However, for my functions to work, I need to set the
> turtle to that mode. This means that I could possibly mess up
> things for the caller. What I would like to do is capture the
> angle-representation mode on entry and restore it on return.
> However, looking through the methods of turtle.Turtle(), I
> can't find any means of capturing this information

In the "Tell Turtle's state" section
(https://docs.python.org/3/library/turtle.html#tell-turtle-s-state) I
would think that you could roll your own function by using your
knowledge of the coordinates of where the turtle is at and the
turtle.towards(0, 0).  By computing your own angle (knowing what units
you are using) and comparing with what is returned you should be able
to determine what angular units are currently set.

HTH!
boB Stepp
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: imaplib: is this really so unwieldy?

2021-05-27 Thread boB Stepp
On Thu, May 27, 2021 at 6:22 PM Cameron Simpson  wrote:
>
> On 27May2021 18:42, hw  wrote:

> >So it seems that IMAP support through python is virtually non-existent.
>
> This still sureprises me, but I've not tried to use IMAP seriously. I
> read email locally, and collect it with POP instead. With a tool I wrote
> myself in Python, as it happens.

I am out of my league here, but what I found in one of my books might
be helpful.  Al Sweigart wrote a useful book, "Automate the Boring
Stuff in Python".  In chapter 16 he considers email.  In the "IMAP"
section he states:


Just as SMTP is the protocol for sending email, the Internet Message
Access Protocol (IMAP) specifies how to communicate with an email
provider’s server to retrieve emails sent to your email address.
Python comes with an imaplib module, but in fact the third-party
imapclient module is easier to use. This chapter provides an
introduction to using IMAPClient; the full documentation is at
http://imapclient.readthedocs.org/.

The imapclient module downloads emails from an IMAP server in a rather
complicated format. Most likely, you’ll want to convert them from this
format into simple string values. The pyzmail module does the hard job
of parsing these email messages for you. You can find the complete
documentation for PyzMail at http://www.magiksys.net/pyzmail/.

Install imapclient and pyzmail from a Terminal window. Appendix A has
steps on how to install third-party modules.


In the next little section he shows how to retrieve and delete emails
with IMAP using the two third-party tools mentioned above.  And of
course there is more.  Apparently this book is now in its second
edition.  The first edition is available online for free.  The link to
chapter 16 which discusses email is:
https://automatetheboringstuff.com/chapter16/  Hopefully this will
prove helpful to the OP.

HTH!
boB Stepp
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: imaplib: is this really so unwieldy?

2021-05-30 Thread boB Stepp
On Sun, May 30, 2021 at 1:04 AM hw  wrote:
>
> On 5/28/21 2:36 AM, boB Stepp wrote:

> > 
> > Just as SMTP is the protocol for sending email, the Internet Message
> > Access Protocol (IMAP) specifies how to communicate with an email
> > provider’s server to retrieve emails sent to your email address.
> > Python comes with an imaplib module, but in fact the third-party
> > imapclient module is easier to use. This chapter provides an
> > introduction to using IMAPClient; the full documentation is at
> > http://imapclient.readthedocs.org/.
> >
> > The imapclient module downloads emails from an IMAP server in a rather
> > complicated format. Most likely, you’ll want to convert them from this
> > format into simple string values. The pyzmail module does the hard job
> > of parsing these email messages for you. You can find the complete
> > documentation for PyzMail at http://www.magiksys.net/pyzmail/.
> >
> > Install imapclient and pyzmail from a Terminal window. Appendix A has
> > steps on how to install third-party modules.
> > 

> I don't know which imaplib the author uses; the imaplib I found
> definitely doesn't give uids of the messages, contrary to the example
> he's giving.

Look at the above three paragraphs quoted from my original response.
The author is using *imapclient* and *pyzmail* as the author
indicates.

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


Re: python 3.9.5

2021-05-31 Thread boB Stepp
On Mon, May 31, 2021 at 8:43 AM said ganoune  wrote:
>
> Hi
> Just installed python 3.9.5 in my HP laptop, cant open it.
> Laptop hp I3 running with windows 10.

Did you try going to your Start Menu list of programs?  There should
be a Python folder.  Click to expand.  Click on IDLE to open an
IDE-like environment where you can either write Python program files
and run them or instead type Python commands into the interpreter
after the ">>>" prompt.

Or you can click on Python 3.9 which will take you to a Windows
terminal-like window (cmd.exe) and present you with the Python
interpreter and the ">>>" prompt for typing in Python commands.

Hope this helps!
boB Stepp
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to debug python + curses? [was: RE: Applying winpdb_reborn]

2021-06-01 Thread boB Stepp
On Tue, Jun 1, 2021 at 12:20 PM Dennis Lee Bieber  wrote:
>
> On Tue, 1 Jun 2021 08:04:54 +1000, Cameron Simpson 
> declaimed the following:
>
> >On 30May2021 20:36, Dennis Lee Bieber  wrote:
> >>On Mon, 31 May 2021 08:07:21 +1000, Cameron Simpson 
> >>declaimed the following:
> >>>Open another terminal, note its terminal device with the "tty"
> >>>command.
> >>>Start your programme like this:
> >>>python .. 2>/dev/tty-of-the-other-termina
> >>>
> >>  The OP specified Win10, so the above is dead from the start.
> >
> >Good point; I wasn't aware that curses worked in Windows.
>
> https://docs.python.org/3/howto/curses.html
> "The Windows version of Python doesn’t include the curses module. A ported
> version called UniCurses is available."
>
> Appears the easiest is to PIP "windows-curses" then track down
> piecemeal installs (it is unclear if UniCurses includes PDCurses, or needs
> that as a separate install).

windows-curses 2.2.0 has been working well for me so far on Win10:
https://pypi.org/project/windows-curses/

"Adds support for the standard Python curses module on Windows. Based
on these wheels. Uses the PDCurses curses implementation."

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


Re: Uninstall and Re-install Python - Windows 10 issues

2021-06-23 Thread boB Stepp
Disclaimer:  I am no Python or programming expert!  However, I
recently installed Python 3.9.5 on my Windows 10 laptop, so I may be
able to help with some things.

On Wed, Jun 23, 2021 at 11:29 AM Suretha Weweje  wrote:
>
> After I uninstalled Python 3.7and Python 3.9 and installed Python 3.9.5 and
> is displayed in Apps & features:
>
> Python 3.9.5 Python 3.9.5 (64-bit), size 101 MB, and
> Python Launcher, size 1.80 MB
>
> Upon checking the python version, I get the following error message:
> C:\>python --version
> Python was not found; run without arguments to install from the Microsoft
> Store, or disable this shortcut from Settings > Manage App Execution
> Aliases.

Unless you checked the checkbox to add Python to your path in the
installer then this is normal.  To check your version, instead type:

PS C:\Users\boB> py --version
Python 3.9.5

If you did not add Python 3.9.5 to your path you will need to use "py"
wherever you think you would use "python" to launch whatever, for
instance

py -m pip install ...

if you were going to install a package.  BTW, if you *want* to add
Python 3.9.5 to your path it is not very difficult to do so.  Search
online if you do not know how.

> In the Start Menu, Python 3.9 shortcut is present, and when I click on that
> it takes me to Python 3.9(64-bit) CMD.  Just to test, I add a print
> statement.
>
> Python 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64
> bit (AMD64)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> print("This is Tuesday")
> This is Tuesday
> >>>
>
> Python 3.9.5 was installed in the C:\Python3.9.5 folder and it seems that
> not all the files were downloaded and for some reason, old files were added.
>
> On the Local Disk (C:) > Python3.9.5 and the folder created for the
> installation displays:
>
> Folders - DLLs, Doc, include, Lib, libs, Scripts, tcl, Tools
>
> The date on the above-mentioned folders is the same date as when Python
> 3.9.5 was installed (2021/06/21) however, the dates are displayed
> (2021/05/03) on the rest of the files as below:
>
> Text Document - LICENSE, NEWS,
> Application - python, pythonw
> Application extention - python3.dll, python39.dll, vcruntime140.dll,
> vcruntime140_1.dll
> The dates are different from the date of Python 3.9.5 installation

I believe these differing dates are normal as I show similar results.
For instance the individual files you mention all have the same date
of "5/3/2021 5:35 PM" on my laptop.  However, the folders all have a
date of "5/12/2021 7:25 (or 7:24)PM" with one exception, the "Scripts"
folder which has a date of "5/28/2021 9:52 PM".  This makes sense to
me.  The heading for this date/time column in the file explorer is
"Date modified".  Neither of us have "modified" the dll's for
instance.  The date of release of Python 3.9.5 was, in fact,
"5/3/2021", so that checks out.  OTOH, after installing Python 3.9.5 I
*later* installed (using pip) pytest and spacy.  The most recent of
these two installations reflects the "Scripts" folder's date modified
stamp.  If I go into the "Scripts" folder I do in fact see that pytest
was installed earlier and its date modified reflects that correct date
and time. As for the other folders I believe (Someone correct me if I
am mistaken.) that the folder dates normally reflect the installation
date by you as that is when those folders were created.  However, if
you open one of them and examine the contents you will see that the
individual files have the Python 3.9.5 release date since you have not
modified those files.

> I have no way of fully uninstalling the separate python installations and
> install a new python version.

As for your Python 3.7 installation still being around it all depends.
You will get different results when you originally installed Python
3.7.x if you (1) install for all users; (2) install with
administrative privileges; or (3) install just for the current user.
For instance I had Python 3.7.x installed prior to installing 3.9.5.
I uninstalled Python 3.7.x.  But it is still available!  If I run "py
-3.7 --version" I see it is still there.  If I look in my Windows
Start folder there is an entry for Python 3.7.  What gives?  In my
case my son also uses my laptop and *he* installed his own version of
Python 3.7.x as a *user*.  My uninstalling *my* installation of Python
3.7.x did not affect his installation.  And since my laptop account
has administrator privileges I can still see it in the Start Menu, but
*not* in the settings uninstall programs list.  Perhaps you are
experiencing something similar?

I don't fully understand how Windows implements user privileges and
the full details of what an administrator account can and cannot see.
Wiser heads than mine will have to chime in and explain as needed.

HTH!
boB Stepp
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-12-21 Thread boB Stepp

On 21/12/22 12:14PM, Python wrote:

On 30/11/2021 12.31, Cameron Simpson wrote:

On 30Nov2021 10:59, DL Neil  wrote:

...


I've nominated Kitty as
Fedora's default terminal. We'll see how it goes with work-loads beyond
raising the flag...


I'd like to hear how that goes down the track. If I find myself on a
Linux desktop again a good terminal emulator would be very welcome.



(given that @A-R has brought this thread back-to-life)


I have been surprised/shocked/horrified/annoyed to discover that the
(Linux) clipboard is not accessible from "Kitty".


Huh?  I use kitty and copy to and from the clipboard all the time.
1) ctrl+shift+c Copy to clipboard
2) ctrl+shift+v Paste from the clipboard
3) Using mouse to select text automatically copies it to the primary 
clipboard.
4) Middle-click of mouse to paste from the primary clipboard.


--
Wishing you only the best,
boB Stepp

Speeches are like steer horns -- a point here, a point there and a lot of bull
in between.
-- E. Anderson
--
https://mail.python.org/mailman/listinfo/python-list


Re: Is 'learning python 5th edition' a good book to beginner?

2016-09-25 Thread boB Stepp
On Sun, Sep 25, 2016 at 3:50 PM, Lawrence D’Oliveiro
 wrote:
> Judging from the table of contents 
> , it spends too much time 
> (i.e. > 0) talking about Python 2.

I own this book.  The 5th edition covers both Python 3.3 and 2.7.  Its
emphasis is slanted to 3.3, but it *thoroughly* covers the core
language for both.

As far as the OP's original question, if he is comfortable with
programming in other languages, then this book can serve him well if
he wants to know all the details of the language.  The author does use
a tutorial approach, but it is a massive text that tries to cover
everything in the core language with selected examination of parts of
the standard library.

HTH!
-- 
boB
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python list index - an easy question

2016-12-17 Thread boB Stepp
On Sat, Dec 17, 2016 at 1:10 PM, John  wrote:
>
> Hi,
>
>I am new to Python, and I believe it's an easy question. I know R and 
> Matlab.
>
> 
> >>> x=[1,2,3,4,5,6,7]
> >>> x[0]
> 1
> >>> x[1:5]
> [2, 3, 4, 5]
> *
>
> My question is: what does x[1:5] mean? By Python's convention, the first 
> element of a list is indexed as "0". Doesn't x[1:5] mean a sub-list of x, 
> indexed 1,2,3,4,5? If I am right, it should print [2,3,4,5,6]. Why does it 
> print only [2,3,4,5]?
>

What you are asking about is "slicing".  x[1:5] returns everything
between index 1 through, but NOT including, index 5.  See

https://docs.python.org/3/tutorial/introduction.html#strings

which will give examples using strings.  A bit later the tutorial
addresses slicing in a list context.

BTW, the Python Tutorial is well worth reading in full!


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


Re: Clickable hyperlinks

2017-01-03 Thread boB Stepp
On Tue, Jan 3, 2017 at 10:46 PM, Deborah Swanson
 wrote:
>

>
> I didn't try printing them before, but I just did. Got:
>
> >>> print([Example](http://www.example.com)
>
> SyntaxError: invalid syntax  (arrow pointing at the colon)

As Steve had said, you need to put everything inside quotes.  Also,
you are missing a matching paren.  Thus:

py3: print("[Example](http://www.example.com)")
[Example](http://www.example.com)

As to whether anything will be "clickable" or not, what has already
been said about different types of terminals applies.

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


Re: Clickable hyperlinks

2017-01-06 Thread boB Stepp
On Tue, Jan 3, 2017 at 10:46 PM, Deborah Swanson
 wrote:
>

>
> I didn't try printing them before, but I just did. Got:
>
> >>> print([Example](http://www.example.com)
>
> SyntaxError: invalid syntax  (arrow pointing at the colon)

As Steve had said, you need to put everything inside quotes.  Also, you are 
missing a matching paren.  Thus:

py3: print("[Example](http://www.example.com)") 
[Example](http://www.example.com)

As to whether anything will be "clickable" or not, what has already been said 
about different types of terminals applies.

--
boB

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


Re: why do I get syntax error on if : break

2018-05-24 Thread boB Stepp
On Thu, May 24, 2018 at 9:12 PM,   wrote:
> here is the code, i keep getting an error, "break outside loop". if it is 
> false just exit function
>
>
> def d(idx):
> if type(idx) != int:
> break
>
> d('k')

"break" (and "continue") are only meaningful inside for or while
loops.  You do not have one of these inside your function.  See
https://docs.python.org/3/reference/simple_stmts.html#break

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


Re: The PIL show() method looks for the default viewer. How do I change this to a different viewer (of my choice)?

2018-05-25 Thread boB Stepp
On Fri, May 25, 2018 at 6:04 AM, Paul St George  wrote:
> I am using the Python Imaging Library (PIL), Python 2 and Raspberry Pi 3 B+
>
> My code is simply:
>
> from PIL import Image
>
> im = Image.open(‘somepic.jpg’)
> im.show() # display image
>
>
> But the show() method looks for the default viewer (probably xv). How do I
> change this (in the code, or in some settings) to a different viewer (of my
> choice)?

In the PIL docs for show() at
https://pillow.readthedocs.io/en/5.1.x/reference/Image.html#PIL.Image.Image.show
it says:


Image.show(title=None, command=None)

Displays this image. This method is mainly intended for debugging purposes.

On Unix platforms, this method saves the image to a temporary PPM
file, and calls either the xv utility or the display utility,
depending on which one can be found.

On macOS, this method saves the image to a temporary BMP file, and
opens it with the native Preview application.

On Windows, it saves the image to a temporary BMP file, and uses the
standard BMP display utility to show it (usually Paint).

Parameters:

title – Optional title to use for the image window, where possible.
command – command used to show the image


I have not had occasion to use PIL, but perhaps this command parameter
can be used to do what you want?  If not then perhaps you can write
your own function to load your image into your favorite image viewer.


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


Re: syntax difference

2018-06-23 Thread boB Stepp
I've finally found time to examine this rather long, rambling thread.

On Wed, Jun 20, 2018 at 5:46 AM  wrote:
>
> Yeah, people keep bringing that up when they run out of arguments.
>
> So, every programmer must always use the most advanced, most esoteric 
> features possible at every opportunity? Coding should only be for the elite?
>
> There is a place for various levels of programming language. I'm saying that 
> Python which is always touted as a 'simple' language suitable for beginners, 
> is missing a surprising number of basics.

I still feel like a rank beginner, but on the Tutor list some
disagree.  Perhaps I feel this way because the more I try to study and
research programming/computer science topics, the more I realize how
little I know and how much remains to be learned, so I continue to
feel like a beginner.  But I am beginner enough that I can respond to
the above points.

A handful of years ago at the job I do, I started to get tired of
doing the same basic things over and over, so I investigated what
possibilities the software I used on the OS it used had in order to
automate these tasks.  Perl proved to be available, but Python wasn't
uniformly then, so I wrote some programs in Perl.  I got it figured
out and wrote some useful program in Perl, but the language never did
feel natural and easy to understand to me.

Later the OS and hardware got updated and I found Python was now fully
available in the 2.4 version.  I started writing new programs in
Python and found it quite easy to use and understand.  As I needed to,
I started rewriting earlier programs I had done in Perl in Python
instead, and was happier for it.  As an aside we just had another
round of software, OS and hardware upgrades.  Now I can use Python
2.7!

Because I read and study about new things as I take them up, I soon
learned that I had only so far scratched the surface of Python's
depths.  But despite knowing that Python had many more features to
explore, both in the core language and the standard library, this
never hindered me in writing my beginner-level programs.  I got things
done, and I got them done fairly easily, and never felt burdened by
all the "other stuff" that Python had to offer.

But I am continually grateful that this "other stuff" exists!  For
instance, recently I was working on a problem for home use that I was
doing in Python 3 (Not that 3 vs. 2 matters here.).  I was concerned
about loading potentially really large files into RAM and not having
enough memory for it.  Alan Gauld suggested I try a generator
approach.  I had not used these yet, though I was aware of this
feature's existence.  So I did some reading up on them, wrote some
code with my attempted implementation of them, submitted my efforts to
the Tutor list for critique, and while I am sure I did not do a
professional job of things, I was quite happy with the result as it
solved the problem I was concerned about.  So even dipping my big toe
into the "other stuff" proved an enjoyable and understandable
experience.  This has always been my experience with Python.  When the
time comes that I need something, I find it is there either in the
core language or the standard library, and it proves not burdensome to
learn the new feature(s).

This has been my beginner's journey with Python:  Easy to do useful
stuff, easy to read and easy to understand.  When I need something
_more_, I find it already exists and proves relatively easy to
understand *as long as* I am willing to put in a bit of study.  And I
don't think needing to put in a bit of study to learn how to use a new
feature is unreasonable for me or anyone else.

Anyway, so far Python has not lacked for anything I have needed so
far.  Of course, I realize that if I need to do something closer to
the machine level, Python is probably not going to be the preferred go
to tool, and even being a beginner I have enough sense to realize
this.  But then again, I would not be too surprised if Python or a
third party library did not already meet this future, hypothetical
need.

> That these are useful is demonstrated by the cumbersome add-ons that need to 
> be used to provide that functionality. Often in over the top ways and often 
> in a bewildering variety of ways in the case of records.

All I can say is I have yet to find much at all in Python cumbersome
or bewildering.

As to the original point of this thread concerning type-hints, I am
aware of them, once asked a bit on Tutor about them, but decided I am
not ready to go there yet.  But to (I hope.) help my learning of
Python syntax, I am forcing myself to *not* use linters, etc.  Once I
feel that I have Python in my head and in my fingers, then I will
start using such sensible tools and will probably reexamine
type-hints.

As an aside to Bart, if you strongly feel that Python is missing a
really useful feature, then why don't you do the usual thing, start a
very specific thread about just that feature (Not just a collection of
things you like 

Re: syntax difference

2018-06-23 Thread boB Stepp
On Sat, Jun 23, 2018 at 5:35 PM Bart  wrote:
>
> On 23/06/2018 20:52, boB Stepp wrote:

> The first programming exercise I ever did involved asking for three
> numbers, then determining whether those numbers could form the sides of
> a triangle.
>
> Then [40 years ago], the easy part was reading the three numbers. Now
> that would be the more challenging part.
>
> This is one of the basics that is missing. Getting around it is not
> hard, but it's some messing about and it's a distraction. But 40 years
> ago it was just 'readln a,b,c'; it was just taken for granted.

I don't think there are any *basics* missing.  One of the differences
between then and now is that trying to live in a simpler
ASCII/extended ASCII world is no longer possible.  The Internet and
open source movements among other things have brought in more (most?)
of the world as participants in the programming endeavor.  The many
peoples of this world and their many, varied cultures is quite rich
and complex, and they have real needs to express their thoughts as
naturally as they can.  I would contend that the basics are there, but
the complexity of the data and ideas that need to be dealt with these
days is what makes the programming journey more challenging but also
more interesting than in the days of yore.  When I first went to
college in the seventies, it was all punch cards, main frames, a few
minicomputers, time sharing IBM selectrics, etc.  I would *not* want
to go back to that!  I find today's challenges and opportunities much
more fascinating!!

> > Anyway, so far Python has not lacked for anything I have needed so
> > far.
>
> I'd be surprised if Python lacked anything; there can't be anything that
> someone has thought of that is either built-in or bolted on, if not
> always that elegantly or that efficiently.

I am not qualified to speak to issues of Python's language design, but
as a user of Python I have yet to be disappointed.  But I imagine all
languages, including yours, have accumulated cruft that in retrospect
the creators would like to remove.  But the difference, as far as I
can tell, between your languages and Python is that Python has a huge
number of active users with who knows how many LOC in production
environments, but your languages do not.  So you have the benefit, as
their creator and essentially sole user, to keep polishing and
refining your ideas.  The Python devs don't have that luxury.  But
they are obviously, even to me, constantly not only adding new
functionality, but trying to minimize the cruft as best they can
without compromising people's production code.  I imagine that the
transition from version 2 to 3 was not undertaken halfheartedly, but
only after much thought and discussion since it did break backwards
compatibility.  But now having used both Python 2 (Which I still have
to code in at work.) and 3, even I with my limited knowledge and
capabilities appreciate the positive benefits of the changes.

> However, imagine having to use a language which didn't have assignments
> as you are used to, and that you would expect to exist. Then you might
> well remark that it's missing something that you regard as a basic,
> while the proponents of that language point out that it doesn't stop you
> writing programs; it just needs a different approach.

But the beauty of things as they are today, is that if someone has
thought of it, it is probably accessible and available to use.  Not
only that, but one can cruise through the many different programming
languages and see what others have imagined and thought to be useful
and grow one's knowledge and insight much more easily than ever
before.  And if I have a need that Python or any other language I use
does not address, I can surely find one online.

> (I believe that you can write any program using just IF-GOTO statements
> and ASSIGNMENT statements, and no other flow control (given suitable
> data-types and means of I/O). But if you wanted to try out an
> interesting experiment along those lines (eg. transcribe any flowchart
> to code), a large number of languages, including Python, make it hard
> because 'goto' is missing.)

I have done the "GOTO" thing ages ago.  I would not want to go back to
that bad place.  There are too many better alternatives now for flow
control.  With today's hardware I don't think any benefit from any
theoretical optimizations would be of any benefit in practice.  As a
person who does not have much time for studying and writing programs,
I have a hard enough time understanding what I wrote after a break
from programming.  I would not want to put any more stumbling blocks
in my code for later maintainability, not to imagine having to do so
for other people's code.

> > All I can say is I have yet to find much at all in

Re: syntax difference

2018-06-24 Thread boB Stepp
On Sun, Jun 24, 2018 at 5:21 AM Bart  wrote:
>
> On 24/06/2018 00:44, boB Stepp wrote:
> > On Sat, Jun 23, 2018 at 5:35 PM Bart  wrote:
>
> >> I'm not a user...
> >
> > Then I am truly puzzled, Bart.  Why do you even bother to hang out on
> > this list?  If you do not want to use Python and you do not want to
> > improve Python's design and implementation, what is your point of
> > being here?
>
> I wonder why it is just me that constantly needs to justify his
> existence in this group?

You snipped the unpleasant part of my paragraph:
"... You *do* seem to generate a lot of ill will, I hope
unintentionally..."

> Does someone need to be that much of a user of a language in order
> to discuss its design or its features or its efficiency, or how it
> compares with any other? You can do that from without as well as
> from within.

I don't dispute this.  But there are good ways to do this and there
are bad ways to do this.  You seem to fall into the latter category
enough that at a minimum you irritate people who care very deeply
about Python, and, at worst, outright enrage some.



> As for why Python, it's the dynamic language I'm most familiar
> with, and I've been following it since the 1990s.

And this gets to the crux of the matter.  If this is so, why is it
that you repeatedly demonstrate a lack of understanding of the very
things you are critiquing?  I cannot recall how many times you have
been called out on this point, but it is certainly not an uncommon
event.  It is one thing to have demonstrable technical understanding
of one or more concepts, and critique those concepts with valid, or at
least, interesting points, but it is entirely another thing to be
criticizing (How you are often perceived.) something in Python while
at the same time demonstrating you don't really understand the
particular Pythonic implementation or usage you are criticizing.
Don't you see the difference?  Don't you see what it is that so riles
people?  But things do not have to be this way!  As I said later in my
paragraph I have been referencing:

"... But why not take a different, more helpful tack?
You seem to have a lot of ideas.  If you really think they are
applicable to improving the Python language, why not take your ideas,
one at a time, and have serious discussion, perhaps better on
Python-Ideas, on how Python can be meaningfully made better?  That
would be a helpful approach which I think, if done with the intention
of helping Python to be the best language it can be (Within the
constraints it has to operate within in practice.), then I would hope
your potential contributions would be positively received by the
community..."

And:

"... And of course, you would have to know how to use Python properly in
idiomatic style.  Why not choose this positive approach?  I think it
would be a win-win for both you and Python."

Just show you genuinely care about the language and the community.
Use and understand the language as well as you can before jumping into
criticisms.  Adopt the path of the humble learner, who does not know
everything about Python.  Is this too much to ask?



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


Re: syntax difference

2018-06-25 Thread boB Stepp
From: boB Stepp 

I've finally found time to examine this rather long, rambling thread.

On Wed, Jun 20, 2018 at 5:46 AM  wrote:
>
> Yeah, people keep bringing that up when they run out of arguments.
>
> So, every programmer must always use the most advanced, most esoteric
features possible at every opportunity? Coding should only be for the elite?
>
> There is a place for various levels of programming language. I'm saying that
Python which is always touted as a 'simple' language suitable for beginners, is
 missing a surprising number of basics.

I still feel like a rank beginner, but on the Tutor list some disagree. 
Perhaps I feel this way because the more I try to study and research
programming/computer science topics, the more I realize how little I know and
how much remains to be learned, so I continue to feel like a beginner.  But I
am beginner enough that I can respond to the above points.

A handful of years ago at the job I do, I started to get tired of doing the
same basic things over and over, so I investigated what possibilities the
software I used on the OS it used had in order to automate these tasks.  Perl
proved to be available, but Python wasn't uniformly then, so I wrote some
programs in Perl.  I got it figured out and wrote some useful program in Perl,
but the language never did feel natural and easy to understand to me.

Later the OS and hardware got updated and I found Python was now fully
available in the 2.4 version.  I started writing new programs in Python and
found it quite easy to use and understand.  As I needed to, I started rewriting
 earlier programs I had done in Perl in Python instead, and was happier for it.
  As an aside we just had another round of software, OS and hardware upgrades. 
 Now I can use Python 2.7!

Because I read and study about new things as I take them up, I soon learned
that I had only so far scratched the surface of Python's depths.  But despite
knowing that Python had many more features to explore, both in the core
language and the standard library, this never hindered me in writing my
beginner-level programs.  I got things done, and I got them done fairly easily,
 and never felt burdened by all the "other stuff" that Python had to offer.

But I am continually grateful that this "other stuff" exists!  For instance,
recently I was working on a problem for home use that I was doing in Python 3
(Not that 3 vs. 2 matters here.).  I was concerned about loading potentially
really large files into RAM and not having enough memory for it.  Alan Gauld
suggested I try a generator approach.  I had not used these yet, though I was
aware of this feature's existence.  So I did some reading up on them, wrote
some code with my attempted implementation of them, submitted my efforts to the
 Tutor list for critique, and while I am sure I did not do a professional job
of things, I was quite happy with the result as it solved the problem I was
concerned about.  So even dipping my big toe into the "other stuff" proved an
enjoyable and understandable experience.  This has always been my experience
with Python.  When the time comes that I need something, I find it is there
either in the core language or the standard library, and it proves not
burdensome to learn the new feature(s).

This has been my beginner's journey with Python:  Easy to do useful stuff, easy
 to read and easy to understand.  When I need something _more_, I find it
already exists and proves relatively easy to understand *as long as* I am
willing to put in a bit of study.  And I don't think needing to put in a bit of
 study to learn how to use a new feature is unreasonable for me or anyone else.

Anyway, so far Python has not lacked for anything I have needed so far.  Of
course, I realize that if I need to do something closer to the machine level,
Python is probably not going to be the preferred go to tool, and even being a
beginner I have enough sense to realize this.  But then again, I would not be
too surprised if Python or a third party library did not already meet this
future, hypothetical need.

> That these are useful is demonstrated by the cumbersome add-ons that need to
be used to provide that functionality. Often in over the top ways and often in
a bewildering variety of ways in the case of records.

All I can say is I have yet to find much at all in Python cumbersome or
bewildering.

As to the original point of this thread concerning type-hints, I am aware of
them, once asked a bit on Tutor about them, but decided I am not ready to go
there yet.  But to (I hope.) help my learning of Python syntax, I am forcing
myself to *not* use linters, etc.  Once I feel that I have Python in my head
and in my fingers, then I will start using such sensible tools and will
probably reexamine type-hints.

As an aside to Bart, if you strongly feel that Python is missing a really
useful feature, then why don't y

Re: syntax difference

2018-06-25 Thread boB Stepp
From: boB Stepp 

On Sat, Jun 23, 2018 at 5:35 PM Bart  wrote:
>
> On 23/06/2018 20:52, boB Stepp wrote:

> The first programming exercise I ever did involved asking for three
> numbers, then determining whether those numbers could form the sides of
> a triangle.
>
> Then [40 years ago], the easy part was reading the three numbers. Now
> that would be the more challenging part.
>
> This is one of the basics that is missing. Getting around it is not
> hard, but it's some messing about and it's a distraction. But 40 years
> ago it was just 'readln a,b,c'; it was just taken for granted.

I don't think there are any *basics* missing.  One of the differences between
then and now is that trying to live in a simpler ASCII/extended ASCII world is
no longer possible.  The Internet and
open source movements among other things have brought in more (most?) of the
world as participants in the programming endeavor.  The many peoples of this
world and their many, varied cultures is quite rich and complex, and they have
real needs to express their thoughts as naturally as they can.  I would contend
 that the basics are there, but the complexity of the data and ideas that need
to be dealt with these days is what makes the programming journey more
challenging but also more interesting than in the days of yore.  When I first
went to college in the seventies, it was all punch cards, main frames, a few
minicomputers, time sharing IBM selectrics, etc.  I would *not* want to go back
 to that!  I find today's challenges and opportunities much more fascinating!!

> > Anyway, so far Python has not lacked for anything I have needed so
> > far.
>
> I'd be surprised if Python lacked anything; there can't be anything that
> someone has thought of that is either built-in or bolted on, if not
> always that elegantly or that efficiently.

I am not qualified to speak to issues of Python's language design, but as a
user of Python I have yet to be disappointed.  But I imagine all languages,
including yours, have accumulated cruft that in retrospect the creators would
like to remove.  But the difference, as far as I can tell, between your
languages and Python is that Python has a huge number of active users with who
knows how many LOC in production environments, but your languages do not.  So
you have the benefit, as their creator and essentially sole user, to keep
polishing and refining your ideas.  The Python devs don't have that luxury. 
But they are obviously, even to me, constantly not only adding new
functionality, but trying to minimize the cruft as best they can without
compromising people's production code.  I imagine that the transition from
version 2 to 3 was not undertaken halfheartedly, but only after much thought
and discussion since it did break backwards compatibility.  But now having used
 both Python 2 (Which I still have to code in at work.) and 3, even I with my
limited knowledge and capabilities appreciate the positive benefits of the
changes.

> However, imagine having to use a language which didn't have assignments
> as you are used to, and that you would expect to exist. Then you might
> well remark that it's missing something that you regard as a basic,
> while the proponents of that language point out that it doesn't stop you
> writing programs; it just needs a different approach.

But the beauty of things as they are today, is that if someone has thought of
it, it is probably accessible and available to use.  Not only that, but one can
 cruise through the many different programming languages and see what others
have imagined and thought to be useful and grow one's knowledge and insight
much more easily than ever before.  And if I have a need that Python or any
other language I use does not address, I can surely find one online.

> (I believe that you can write any program using just IF-GOTO statements
> and ASSIGNMENT statements, and no other flow control (given suitable
> data-types and means of I/O). But if you wanted to try out an
> interesting experiment along those lines (eg. transcribe any flowchart
> to code), a large number of languages, including Python, make it hard
> because 'goto' is missing.)

I have done the "GOTO" thing ages ago.  I would not want to go back to that bad
 place.  There are too many better alternatives now for flow control.  With
today's hardware I don't think any benefit from any theoretical optimizations
would be of any benefit in practice.  As a person who does not have much time
for studying and writing programs, I have a hard enough time understanding what
 I wrote after a break from programming.  I would not want to put any more
stumbling blocks in my code for later maintainability, not to imagine having to
 do so for other people's code.

> > All I can say is I have yet t

Re: syntax difference

2018-06-25 Thread boB Stepp
From: boB Stepp 

On Sun, Jun 24, 2018 at 5:21 AM Bart  wrote:
>
> On 24/06/2018 00:44, boB Stepp wrote:
> > On Sat, Jun 23, 2018 at 5:35 PM Bart  wrote:
>
> >> I'm not a user...
> >
> > Then I am truly puzzled, Bart.  Why do you even bother to hang out on
> > this list?  If you do not want to use Python and you do not want to
> > improve Python's design and implementation, what is your point of
> > being here?
>
> I wonder why it is just me that constantly needs to justify his
> existence in this group?

You snipped the unpleasant part of my paragraph: "... You *do* seem to generate
 a lot of ill will, I hope unintentionally..."

> Does someone need to be that much of a user of a language in order
> to discuss its design or its features or its efficiency, or how it
> compares with any other? You can do that from without as well as
> from within.

I don't dispute this.  But there are good ways to do this and there are bad
ways to do this.  You seem to fall into the latter category enough that at a
minimum you irritate people who care very deeply about Python, and, at worst,
outright enrage some.



> As for why Python, it's the dynamic language I'm most familiar
> with, and I've been following it since the 1990s.

And this gets to the crux of the matter.  If this is so, why is it that you
repeatedly demonstrate a lack of understanding of the very things you are
critiquing?  I cannot recall how many times you have been called out on this
point, but it is certainly not an uncommon event.  It is one thing to have
demonstrable technical understanding of one or more concepts, and critique
those concepts with valid, or at least, interesting points, but it is entirely
another thing to be criticizing (How you are often perceived.) something in
Python while at the same time demonstrating you don't really understand the
particular Pythonic implementation or usage you are criticizing. Don't you see
the difference?  Don't you see what it is that so riles people?  But things do
not have to be this way!  As I said later in my paragraph I have been
referencing:

"... But why not take a different, more helpful tack? You seem to have a lot of
 ideas.  If you really think they are applicable to improving the Python
language, why not take your ideas, one at a time, and have serious discussion,
perhaps better on Python-Ideas, on how Python can be meaningfully made better? 
 That would be a helpful approach which I think, if done with the intention of
helping Python to be the best language it can be (Within the constraints it has
 to operate within in practice.), then I would hope your potential
contributions would be positively received by the community..."

And:

"... And of course, you would have to know how to use Python properly in
idiomatic style.  Why not choose this positive approach?  I think it would be a
 win-win for both you and Python."

Just show you genuinely care about the language and the community. Use and
understand the language as well as you can before jumping into criticisms. 
Adopt the path of the humble learner, who does not know everything about
Python.  Is this too much to ask?



--
boB

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: syntax difference

2018-06-25 Thread boB Stepp
On Mon, Jun 25, 2018 at 2:37 AM Mark Lawrence  wrote:
>
> On 24/06/18 00:44, boB Stepp wrote:
> > I imagine that the
> > transition from version 2 to 3 was not undertaken halfheartedly, but
> > only after much thought and discussion since it did break backwards
> > compatibility.
> >
>
> So much so that a specific mailing list was set up just to discus the
> transition, archives here https://mail.python.org/pipermail/python-3000/

Thanks for the link, Mark.  I was not aware of this archive.  It will
probably answer some things I have always wondered about.


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


Re: Getting posts to sort chronologically in tree view

2018-07-04 Thread boB Stepp
On Tue, Jul 3, 2018 at 10:26 PM T Berger  wrote:

> I don't think I want to try a mail list. I had subscribed to the
> python-list a few weeks ago and then been forced to unsubscribe
> because of the flood of irrelevant posts.

I use Gmail.  It does allow various ways of filtering emails as has
been suggested.  I normally use the Gmail web interface.  This allows
for the creation of a "Forums" tab.  This is where I send all of my
technical forum posts for reading when I get time.  If you don't want
to figure out how to filter emails, an easy thing to do with this
Forums tab setup is when a Python List email arrives in your Inbox,
click and drag that email to the Forums tab.  Soon you will find that
all of these emails will go there instead of your normal Inbox tab.
If I find I don't want to read all of these emails (A true rarity!),
then I don't find it burdensome to select all of the emails I might
not want to read manually by checking all relevant check boxes and
then clicking on the trash can icon to get rid of them all.

Two things you _might_ want to do:

1) Subscribe to the Python Tutor email list.  Though the main list
people are more than happy to help out, you have noticed that this
list generates a lot of emails on many days.  The Tutor list is not so
busy usually.  Plus, if you are truly not comfortable with Python yet,
you are more likely to find those _other_ emails of some interest.
Also, many of the people like Ben, Steve, Cameron, etc. hang out in
the Tutor list, too, and provide tons of help to Python learners.

2) Some of your questions have not been directly Python-related.  You
will probably find better and quicker answers if you search out the
forums dedicated to those more specialized areas.

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


Re: Kindness

2018-07-13 Thread boB Stepp
On Fri, Jul 13, 2018 at 7:54 PM Steven D'Aprano
 wrote:

> It's not helped by do-gooders who by their own admission have no idea of
> the context sticking their nose in to tell off those who chastise Bart...

I'm not sure if I am one of the "do-gooders" or not in your
perspective, Steve.  I have been sniffing around this list for about
the past four years, so I believe I have a good understanding of the
"context" you refer to.  I just cannot help but think there must be a
better way of interacting with Bart?  But the last time I "stuck my
nose in", Bart, by his own self-admission, stated he had no intentions
of either contributing to Python or trying to properly learn Python.
He is beginning to remind me of a curmudgeonly old uncle that many
families have, that keeps unexpectedly popping in for a stay, leaving
the family exasperated and wondering what to do as the uncle
continually offers his unsolicited advice.

But leaving all issues of Bart aside, the news of Mr. van Rossum
abdicating his role of leadership leaves me wondering about the
welcoming aspect of the Python community.  If the creator himself
apparently has been burdened by sharp criticisms of his decisions,
something seems definitely awry.  But I only occasionally poke about
in the dev and ideas mail archives, and did not know about the
committers one until yesterday, so I am definitely unqualified to
comment here. However, I have been following this list for a few years
now, and my emotional perception of this list is that its "snarky
content" has been gradually rising over this time frame.  Of course
this is just my perception, unbacked by data, and I freely admit I may
be mistaken.  But I wonder ...

A few weeks ago I spent a good chunk of my weekend looking at this
list's Gmane archives from the earliest years available.  I did not
read every post, but I don't recall stumbling onto any of the
Bart-like threads.  I may have just gotten lucky and missed them, but
instead I was left with the impression of the type of community that
Mr. van Rossum has obviously worked so hard to foster.  I have read
several articles since yesterday that noted that Mr. van Rossum's
leadership skills went beyond his technical competence to somehow
creating this warm, open community of Python-loving folks.  I have
greatly benefited from this community in my on-and-off attempts to
learn Python.  For instance, Steve, I have lost count of how many
times you have helped me out on the Tutor list with long, carefully
written answers to my questions that must have taken good chunks of
your valuable time.  Many thanks to you and others who have been so
generous in sharing their expertise and time with me!  But after
delving in the archives, I cannot help but feel that the "now" is not
quite as good as the "then".  So I continue to wonder ...

Only those of you who have been there from Python's earliest years can
truly know if my emotional perceptions have any validity.  I was *not*
there.  But what I finally wonder is if this might not be the time for
the community to engage in self-reflection, and see if we can do
better on achieving the welcoming and openness that I think this
community continually strives for, and, perhaps, even make room for
those curmudgeonly, old uncles that keep popping in for unexpected
visits?



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


Re: can't install/run pip (Latest version of Python)

2018-07-15 Thread boB Stepp
On Sun, Jul 15, 2018 at 7:34 PM S Lea  wrote:
>
>  I can't seem to install the pips, DOS gives me the syntex i invalid, any
> thoughts?

You provide insufficient information for anyone to be able to help you.

1) Copy and paste the entire traceback into a plain text email, no
screen shots please.
2) Copy and paste exactly what you typed that generated the syntax error.
3) Did you do all of this in cmd.exe in what version of Windows?  Or
did you use something else?  Hopefully not in the interactive Python
interpreter or IDLE!
4) What Python version are you using?
5) Did you try searching for the exact error message and see what
answers might already be out there?

If you provide these things, or, better, search and find the answer
yourself, I'm sure someone will be happy to assist.

Good luck!
-- 
boB
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Windows file associations fix

2018-11-09 Thread boB Stepp
On Fri, Nov 9, 2018 at 10:02 AM David Raymond  wrote:

> Currently: Windows 7. Attempting to run a .py file opens up the "Open with" 
> dialog with a bunch of other programs listed. Clicking browse to manually 
> select the new python.exe doesn't add it to the list and won't let me do the 
> association.
>
> Do have administrator permissions, did do the install "for all users", did 
> include the py launcher, have tried repairing, reinstalling and rebooting.
>
> Did look at the "Python on Windows FAQ" 
> (https://docs.python.org/3/faq/windows.html#how-do-i-make-python-scripts-executable)
>  which confirms the installer should set it up to work the way I'm looking 
> for and had it previously.
>
> The rest of the installation is fine, the only issue is the file associations.

I do not know if this is relevant or not for Windows 7, but during the
past week my phone's Google news feed had an article about a recent
Windows *10* update breaking file associations.  Might a recent
Windows *7* update have done the same?

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


Re: Error in installing "pyperclip" module

2018-11-10 Thread boB Stepp
Greetings Hemant!

On Sat, Nov 10, 2018 at 10:31 AM Hemant Chauhan
 wrote:
>
> Hi team,
> I’m having trouble in installing pyperclip  module through command line.
> I just upgraded to the latest version.
> Here’s the SS of command line showing error.

Unfortunately this is a text only mailing list, which disallows
attachments.  So no one will see your screenshot.  Instead you should
copy and paste into a *plain text* email what you entered on the
command line and likewise copy and paste the resulting error messages
into the email.  Please state your operating system and version of
Python that you are using.  With that information I am sure someone
here will be able to help you.

> P.S. – I’m a beginner in Python , it’s the first programming language I 
> started with.

If you are just starting out, a better forum for a new learner to
programming and Python would be the Python Tutor mailing list.
Subscription information can be found at
https://mail.python.org/mailman/listinfo/tutor  However, people on the
this main list are quite friendly and helpful to newbies as well.  In
fact many here actively monitor and help out on the Tutor list.
-- 
boB
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Error in installing "pyperclip" module

2018-11-10 Thread boB Stepp
On Sat, Nov 10, 2018 at 11:45 AM Joel Goldstick
 wrote:
>
> On Sat, Nov 10, 2018 at 12:29 PM boB Stepp  wrote:

> > Unfortunately this is a text only mailing list, which disallows
> > attachments.
>
> One maybe small quibble.  I don't think it is unfortunate at all that
> this mailing list is text only...

Hi, Joel!  Since we are being _precise_ my "Unfortunately" was meant
to be viewed from the OP's perspective, not mine.  Sorry that I was
not clear about that.



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


Re: Installation problem

2016-04-16 Thread boB Stepp
On Sat, Apr 16, 2016 at 2:16 PM, Jurell  wrote:


> I installed the Python program version 3.5.1 32 bit and the IDE I am going
> to use is Wing IDE 101. The problem when I tried installing the python
> program was as follows: "The program can`t start because
> api-ms-win-crt-runtime-l1-1-0.dll is missing from your computer. Try
> reinstalling the program to fix this problem". What I did was uninstall
> Python and reinstall it installed ,I proceed on to install the IDE then this
> message appeared again.

These sorts of questions get asked by many people.  When I have an
error message that I cannot figure out I do an Internet search for
that error message.  But since this is a Python-related question, I
might first search the Python list archives at
https://www.mail-archive.com/[email protected]/ or the Python
Tutor list archives at https://www.mail-archive.com/[email protected]/
Doing the former (Searching just for
"api-ms-win-crt-runtime-l1-1-0.dll") led me to this:
https://www.mail-archive.com/python-list%40python.org/msg402592.html
I have not looked at this in depth, but the second item mentioned
(Since you state you have Win 7 64 bit.) seems appropriate.  Usually I
can solve my own problems much quicker this way than waiting on
someone to respond on this (or other) mailing lists!

BTW, if you are a beginner learning Python you might want to subscribe
to the Python Tutor list as it is designed for those of us who are
learning...

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


Re: Python path and append

2016-04-29 Thread boB Stepp
On Mon, Apr 25, 2016 at 8:51 PM, Steven D'Aprano  wrote:

> See here for the *start* of a more professional approach:
>
> http://code.activestate.com/recipes/579097-safely-and-atomically-write-to-a-file/

What else would I need to know/consider in order to have a *complete*
professional approach?



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


Re: Extract the middle N chars of a string

2016-05-20 Thread boB Stepp
On Wed, May 18, 2016 at 10:47 AM, Steven D'Aprano  wrote:

> Getting the middle N seems like it ought to be easy:
>
> s[N//2:-N//2]
>
> but that is wrong. It's not even the right length!
>
> py> s = 'aardvark'
> py> s[5//2:-5//2]
> 'rdv'
>
>
> So after spending a ridiculous amount of time on what seemed like it ought
> to be a trivial function, and an embarrassingly large number of off-by-one
> and off-by-I-don't-even errors, I eventually came up with this:
>
> def mid(string, n):
> """Return middle n chars of string."""
> L = len(string)
> if n <= 0:
> return ''
> elif n < L:
> Lr = L % 2
> a, ar = divmod(L-n, 2)
> b, br = divmod(L+n, 2)
> a += Lr*ar
> b += Lr*br
> string = string[a:b]
> return string

As some of you know, I usually post on the Tutor list while attempting
to learn Python as time permits.  I had to try my hand at this problem
as a learning opportunity.  I hope you don't mind if I explain how I
got to my solution and welcome your critiques, so I may improve.  I
chose to cheat my answers to the right; I did not think about the
possibility of alternating the sides to allot the extra character
(when needed) to average things out until I read everyone's answers
after getting my own.

I started considering two strings, s_even = '0123456789' and s_odd =
'123456789', with trial values of n = 4 and n = 5 for how many
characters to extract.  This gave me the following four desired
outputs to replicate:

1)  s_even with n = 5.  Desired output:  '34567' (Cheating right.)  =>
Slice s_even[3:8]
2)  s_even with n = 4.  Desired output:  '3456' (Exact.)  => Slice s_even[3:7]
3)  s_odd with n = 5.  Desired output:  '34567' (Exact.)  => Slice s_odd[2:7]
4)  s_odd with n = 4.  Desired output:  '4567' (Cheating right.)  =>
Slice s_odd[3:7]

Starting to generalize to get the desired indices for each case:

1)  (len(s_even)//2 - n//2):(len(s_even)//2 + n//2 + 1)
2)  (len(s_even)//2 - n//2):(len(s_even)//2 + n//2)
3)  (len(s_odd)//2 - n//2):(len(s_odd)//2 + n//2 + 1)
4)  (len(s_odd)//2 + 1 - n//2):(len(s_odd)//2 + n//2 + 1)

Looking at the starting index for each case, I had an extra 1 for case
(4), which, in table form:

n evenn odd
s_even0 0
s_odd 1 0

To duplicate this I came up with the expression:  (len(s)%2) * (1 - n%2)

Similarly, for the ending slice index, all cases have an extra "+ 1"
except for case (2), with the following table:

n evenn odd
s_even0 1
s_odd 1 1

And the expression:  1 - ((len(s) + 1)%2 * (n +1)%2)

All this was scribbled onto scratch paper, so I hope I did not make
any typos!  This led me to the following code:

py3: def mid(s, n):
... index0_offset = (len(s)%2) * (1 - n%2)
... index1_offset = 1 - ((len(s) + 1)%2) * ((n + 1)%2)
... index0 = len(s)//2 - n//2 + index0_offset
... index1 = len(s)//2 + n//2 + index1_offset
... return s[index0:index1]
...
py3: s = '0123456789'
py3: n = 5
py3: mid(s, n)
'34567'
py3: n = 4
py3: mid(s, n)
'3456'
py3: s = '123456789'
py3: n = 5
py3: mid(s, n)
'34567'
py3: n = 4
py3: mid(s, n)
'4567'
py3: s = 'aardvark'
py3: n = 5
py3: mid(s, n)
'rdvar'

This also returns an empty string for values of n <= 0.

As far as I can tell, my solution works (Given cheating right.).  I
ran it on all of Steve's examples, and I got what I expected given
that I am consistently cheating right.  But I am not sure my code
adequately conveys an understanding of what I am doing to the casual
reader.  Thoughts?

TIA!
boB
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: META Culture of this place [was Re: for / while else doesn't make sense]

2016-05-24 Thread boB Stepp
On Tue, May 24, 2016 at 11:43 AM, Steven D'Aprano  wrote:

[...]

> ...Python-Dev, etc, all with their own idiosyncrasies. This is ours: we have a
> bunch of people here who enjoy extended discussions on computing matters
> which are sometimes only tangentially related to Python.

I rarely post on this list, but I now diligently read it.  As a person
striving to learn both Python, general C.Sc. topics, good programming
practices, etc., I have found these diversions of great interest, and
like to think I might even have learned some valuable concepts.  If I
would have a quibble, it might be for diversionary posts to be
relabeled in the subject line a bit more diligently, so that one can
still keep track of the original subject matter easily, while still
enjoying the tangential material.  Other than that, I hope that these
sorts of discussions continue unabated!

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


Re: Beginner Question

2016-06-01 Thread boB Stepp
On Wed, Jun 1, 2016 at 7:55 PM, Marcin Rak  wrote:
> Hi to all
>
> I have a beginner question to which I have not found an answer I was able to 
> understand.  Could someone explain why the following program:
>
> def f(a, L=[]):
> L.append(a)
> return L
>
> print(f(1))
> print(f(2))
> print(f(3))
>
> gives us the following result:
>
> [1]
> [1,2]
> [1,2,3]
>
> How can this be, if we never catch the returned L when we call it, and we 
> never pass it on back to f???

This comes up rather frequently.  In fact, if you just copy your
function (Which is used in the official Python tutuorial.) and paste
it into Google you will get some relevant hits.  One such is:

https://pythonconquerstheuniverse.wordpress.com/category/python-gotchas/

As the link will explain the behavior you observe is a consequence of
two things:  When Python assigns the default argument for the empty
list and that lists are *mutable*.

Enjoy!


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


Re: value of pi and 22/7

2016-06-18 Thread boB Stepp
On Sat, Jun 18, 2016 at 12:47 AM, Tim Harig
 wrote:

>
> The main problem I have with significant figures is that measurement
> accuracy is often not constrained to a decimal system.  A scale that can
> measure in 1/5 units is more accurate than a scale that can measure only
> in whole units but it is not as accurate as a scale that can measure
> all 1/10 units.  Therefore it effectively has a fractional number of
> significant figures.

Probably in this type of discussion a more careful distinction between
"precision" and "accuracy" should be made.  A measuring instrument may
allow for many significant digits in its reported result, giving it a
high level of precision, but could, in fact, be giving an inaccurate
measurement (How close it is to the "true" value.), especially if it
is an instrument that has not been properly calibrated (Made to agree
as well as possible with known standards.).

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


Re: Need help for python on my pc.

2018-11-21 Thread boB Stepp
On Wed, Nov 21, 2018 at 12:19 PM Sourav Banik  wrote:
>
> Hello Python team,
> I'm using python 3.7(32 bit) for several months on my same laptop (x64
> processor). I worked on some django project very swiftly without any
> problem. But for a few days I am facing a serious problem. My python files
> are not showing properly by the file manager. It is just showing 'python
> source file' without any logo. When I open my cmd to work on django, it is
> not also working though virtualenv is working properly I think.

Are you on Windows 10?  There have been reports of a recent update
breaking Windows 10 file associations.  One such article reporting
this behavior:

https://www.howtogeek.com/fyi/microsoft-broke-windows-10s-file-associations-with-a-botched-update/

which refers to this Microsoft update:

https://support.microsoft.com/en-us/help/4462919/windows-10-update-kb4462919

In this, it says:


After installing this update, some users cannot set Win32 program
defaults for certain app and file type combinations using the Open
with… command or Settings > Apps > Default apps.

In some cases, Microsoft Notepad or other Win32 programs cannot be set
as the default.

In some cases, attempting to set application defaults again will succeed.

Microsoft is working on a resolution and estimates a solution will be
available in late November 2018.


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


Re: What Python books to you recommend to beginners?

2018-12-02 Thread boB Stepp
On Sun, Dec 2, 2018 at 1:51 PM songbird  wrote:
>   my goal in learning python was to use it as a way of
> picking up OOP concepts in a more concrete way (theory
> alone doesn't give me enough hands on the bits i need so
> i tend to just do other things instead).
>
>   now that i've used python for a starting project and
> have that project mostly working i want to step back and
> work on the OOP aspects.

You might want to look at "Python 3 -- Object Oriented Programming" by
Dusty Phillips.  It is copyright 2010, so it won't have the latest,
greatest Python 3 features, but the book's entire focus is teaching
OOP in a Python 3 context.

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


Re: ttk present but not found for import

2019-01-19 Thread boB Stepp
On Sat, Jan 19, 2019 at 5:02 PM Rich Shepard  wrote:
>
> I've started to learn tkinter as the GUI widget set I'll use from now on.
> While ttk-8.6 is installed here (/usr/lib/tk8.6/ttk), I cannot import it:
>
> $ python3
> Python 3.6.7 (default, Dec  8 2018, 06:22:57)
> [GCC 5.5.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import tkinter
> >>> import ttk
> Traceback (most recent call last):
>File "", line 1, in 
> ModuleNotFoundError: No module named 'ttk'
> >>>
>
> What have I done incorrectly?

import tkinter.ttk


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


Re: The slash "/" as used in the documentation

2019-02-11 Thread boB Stepp
On Mon, Feb 11, 2019 at 2:34 PM Chris Angelico  wrote:

> Calling on the D'Aprano Collection of Ancient Pythons for confirmation
> here, but I strongly suspect that positional arguments with defaults
> go back all the way to 1.x.

Has Steve's banishment ended yet?  The only postings I have recently
seen from him have been on the Tutor list.



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


Re: Remote/Pair-Programming in-the-cloud

2019-08-02 Thread boB Stepp
On Fri, Aug 2, 2019 at 4:11 AM DL Neil  wrote:
>
> Please recommend a Python-friendly, bandwidth-respectful, (but
> effective) system for pair-programming; where the 'pair' are
> geographically separate.
>
At work (not programming related) my department has just started using
GoToMeeting.  So far it has worked well.  It can transmit audio and
share one's screen.  The host can choose to share with the remote
person a particular application, his keyboard and mouse or the whole
shebang.  I don't know how bandwidth intensive it might be, but our
intranet bandwidth is often less capable than what I have at home.
Also I believe it is a paid service.

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


Re: Friday Finking: 'main-lines' are best kept short

2019-09-13 Thread boB Stepp
On Thu, Sep 12, 2019 at 10:59 PM DL Neil via Python-list
 wrote:
> Ref:
> Mastering Object-oriented Python, S Lott
> Copyright © 2014 Packt Publishing

Side note:  When I looked this up I saw on Amazon that there is a
second edition out targeting Python 3.7.  It was published June of
this year.

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


Re: Python shows error on line 15 that i cant fix

2019-09-21 Thread boB Stepp
On Sat, Sep 21, 2019 at 1:01 PM Dave Martin  wrote:
>
> On Saturday, September 21, 2019 at 1:33:12 PM UTC-4, Terry Reedy wrote:
> > On 9/21/2019 11:53 AM, Dave Martin wrote:
[...]
> > > #get the combined data and load the fits files
> > >
> > > fits_filename="Gaia_DR2/gaiadr2_100pc.fits"
> > > df=pd.DataFrame()
> > > with fits.open(fits_filename) as data:
> > > df=pd.DataFrame(data[1].data)
> >
> > A 'with' statement is a compound statement.  It must be followed by a
> > 'suite', which usually consists of an indented block of statements.
> > This is line 17 from the first non-blank line you posted.
[...]

> Can you provide an example of how to use the suite feature. Thank you.

Dave, you seem to have some expectation that you should be given the
answer.  That is not how help is given in this forum.  You are
expected to be doing the needed to work before being helped further.
You have been referred to the tutorial multiple times.  Please read
it!  Indentation is so fundamental to structuring Python code that it
is clear that you need grounding in Python fundamentals.  Otherwise
you are essentially Easter-egging through a code sample that you have
no true understanding of.

If you must continue to Easter-egg Python instead of reading the
tutorial (or something equivalent) then check the section of the
tutorial on files.  You will find examples of the use of "with" there.


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


Re: Python shows error on line 15 that i cant fix

2019-09-21 Thread boB Stepp
On Sat, Sep 21, 2019 at 9:01 PM Michael Torrie  wrote:
>
> On 9/21/19 12:51 PM, Dave Martin wrote:
> > You seem to have the expectation that you know more about coding than
> > me and that you can insult me without me retaliating. If I were you,
> > I would leave this forum and never respond to another person question
> > again, if you think that you can rudely ransack your way through what
> > is supposed to be a helpful tool.
>
> Not so. He was not rude nor was he insulting.  In fact he was downright
> patient. You've been asked several times to read the tutorial (or
> relevant parts of it) as that teaches you some things you have to know
> in order to use Python.  I'm sorry that rather than do that you chose to
> react poorly to the good advice you were given.

Thank you very much Michael and Chris!  That was very kind of you.
-- 
boB
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Friday finking: TDD and EAFP

2019-11-01 Thread boB Stepp
On Fri, Nov 1, 2019 at 12:42 AM DL Neil via Python-list
 wrote:
>
> Is the practice of TDD fundamentally, if not philosophically, somewhat
> contrary to Python's EAFP approach?
>

[...]

>
> In encouraging my mind to think about testing the code, I find myself
> searching for edge-cases, and attempting to anticipate the unusual.
> Accordingly to the gospel of TDD: so far, so good.
>
> The 'problem' is, that it puts my mind onto LBYL-rails before the
> Python-coding train (of thought) has even left the station. It then
> seems natural to start putting a bunch of if-then-else's up-front and
> before the 'main line' of code.
>
> Does TDD bend your mind in this (apparently) non-Pythonic fashion?
> Have you developed an answer?
> (other than: "@dn is 'nuts'*", which is not worthy of debate)

As the pros have yet to chime in, I will attempt to add my amateurish
thoughts.  In my on again/off again efforts to self-study Python,
sound software construction practices, etc., I have been endeavoring
to adopt a TDD approach.  I find that trying to do this forces upon me
more clarity of thought which (hopefully) results in more expressive,
simpler and understandable code.  As I often find my initial efforts
at writing tests murky and hard to understand, I (eventually) realize
that the associated code I'm trying to test, which seemed so clear
when I first wrote it, is hard to test.  So I refactor/simplify the
code, it becomes easier to write sensible test code, etc.  It may just
be me and my lack of experience, but I find this circular process
ultimately leads to more Pythonic results -- easier to understand code
that (I hope) others can easily read and understand.

Though I am sure I am stating the obvious, instead of just thinking
about edge cases, I like to have at least one test that proves that
what I normally expect to get is, in fact, gotten.  I often
embarrassingly find myself caught in some sort of simple logic error
that this type of test will catch, especially later if I am
refactoring my code in the direction I am trying to coerce it to go
for the end product.

I am probably far from thinking/coding in a proper Pythonic fashion,
but the TDD back-and-forth process seems to get me closer to being
Pythonic.

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


Re: Friday finking: TDD and EAFP

2019-11-18 Thread boB Stepp
On Mon, Nov 18, 2019 at 3:23 PM Peter J. Holzer  wrote:
>
> I don't know what "proper" TDD is (and even less "proper consideration"
> of TDD), but TDD is in my opinion very much rooted in the agile mindset.
> And that means frequent iteration and improvement. So I think the
> micro-iteration technique is closer to philosophically pure TDD (if such
> a thing exists) than your waterfally "write complete spec, then write
> all tests, then write code" technique (That doesn't mean that your
> technique is bad - it's just not what I think people are talking about
> when they say "TDD").
 Your comments brought to mind a book recommended to me, "Test-Driven
Development by Example" by Kent Beck.  On the intro page to part one,
he says:

"...My goal is for you to see the rhythm of Test-Driven Development
(TDD), which can be summed up as follows.

1.  Quickly add a test.
2.  Run all tests and see the new one fail.
3.  Make a little change.
4.  Run all tests and see them all succeed.
5.  Refactor to remove duplication.

The surprises are likely to include

-- How each test can cover a small increment of functionality
-- How small and ugly the changes can be to make the new tests run
-- How often the tests are run
-- How many teensy-weensy steps make up the refactorings"



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


Re: Python3 - How do I import a class from another file

2019-12-13 Thread boB Stepp
On Wed, Dec 11, 2019 at 6:51 PM Greg Ewing  wrote:
>
> On 12/12/19 3:50 am, R.Wieser wrote:
> > I was rather clear about what my used version of Python was-and-is.  I have
> > no idea why that was ignored. :-(
>
> I think we've all been talking at cross purposes for a while.
>
> What I meant to say originally was that you were relying on
> an implementation detail of current CPython, and your code
> might not work on other versions of Python. I was just
> trying to make you aware of something that is considered
> "best practice" when writing Python code, for your own
> future reference.

A question:  As these behaviors being discussed are CPython
implementation details, is it true that CPython itself is free to
implement these behaviors differently in its own future versions?



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


Re: A small quiz

2020-01-24 Thread boB Stepp
On Thu, Jan 23, 2020 at 2:57 AM Z  wrote:
>
> what is PLR?

Python Language Reference?
https://docs.python.org/3/reference/index.html

Or, perhaps, Python Library Reference?
https://docs.python.org/3/library/index.html

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


Re: How to uninstall Python3.7 in Windows using cmd ?

2020-03-27 Thread boB Stepp
On Fri, Mar 27, 2020 at 1:22 PM deepalee khare
 wrote:
>
> Hi,
>
> How to Uninstall Python3.7.3 using cmd ? i tried using cmd: Msiexec
> /uninstall C:\Python37\python.exe But it gives me below error: enter
> image description here
>
> how do i uninstall it ?
>
You appear to be using a version of Windows.  You can uninstall Python
like you would most other programs, using the built-in functionality
provided by Windows.  For instance in Win10 you can go to the Start
Menu, then settings and there is a section for handling Apps.  Find
Python in the list of Apps, click on it and you will get
repair/uninstall links.  Earlier versions of Windows are similarly
done.

HTH!


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


Re: about to resolve problem in installation

2020-03-31 Thread boB Stepp
On Tue, Mar 31, 2020 at 12:02 PM Kapuganti Rakesh
 wrote:

> I have already search in my pc but it is showing nothing and later i
> searched python and started that app.After some it showing
> I am getting confuse over this. pls help me

If you press your Windows key (or click on the Windows symbol on the
task bar) you will have an alphabetically arranged list of programs.
Scroll down till you reach Python 3.8.  Expand that entry by clicking
on it.  If you did a normal installation you should see "IDLE...",
"Python 3.8..." and "Python 3.8 Module Docs..."  For your purposes you
probably would want to start with IDLE.  It will take you to Python's
interactive interpreter.  You will see a prompt that looks like ">>>"
You may type in Python statements after the prompt such as ">>> 3*2"
You can do more in IDLE (Much more), but you will need to have a
beginner's Python book or tutorial to guide you in what to do next.

By the way, there is a Python Tutor list that exists to help newcomers
to Python and/or programming.  Its subscription page may be found at:

https://mail.python.org/mailman/listinfo/tutor

Hope this helps you through your first steps!

Cheers!
boB
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Helping Windows first time users

2020-04-18 Thread boB Stepp
On Wed, Apr 15, 2020 at 2:04 PM Barry Scott  wrote:
>
> I post some suggestion to improve the Python installer for Windows
> to better sign post users on the next steps.
>
> https://mail.python.org/archives/list/[email protected]/message/TKHID7PMKN5TK5QDQ2BL3G45FYAJNYJX/
>
> It also seems like we could do with drafting the text of a helpful
> reply to help the Windows first time users. This would help folks that
> reply to the Windows first time users to have a quick way to reply
> without drafting the text a reply every time.
>
> What are your thoughts on the installer changes and reply text?

I wonder if the last screen of the installer should have a checkbox,
checked by default, that launches IDLE.  IDLE would then display a
helpful text file on this first launch describing how to use IDLE, how
to find and launch it again, etc.  As well have it describe all of the
help you are advocating here as well.  It would be a minor annoyance
for experienced users to have to uncheck the box before clicking
finish, but I think it might have a good chance of getting new users
off to a reliable start.  Many other Windows program installers are
setup similarly to launch the program being installed.  This is a
little different as IDLE is not Python, but that is a minor quibble, I
think.


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


Re: What variable type is returned from Open()?

2020-04-18 Thread boB Stepp
On Wed, Apr 15, 2020 at 11:27 AM Chris Angelico  wrote:
>
> On Thu, Apr 16, 2020 at 12:01 AM  wrote:

> > config_file : file = open(config_file_s, "r")
> >
> >
> > What type of variable should config_file (above) be declared as?

> It returns a file-like object. Instead of annotating, just let the
> type hinting system figure it out - you initialized it with the result
> of an open() call, so it should be able to figure that out.
>
> Python is not C, you do not need to declare all your variable types.
>
> If you actually need a way to represent "file-like object" (maybe as a
> parameter to some other function), there are tools for that in the
> typing module, but just DON'T annotate every variable. Bad idea, will
> cause you a maintenance headache and won't help anything.

I have just started playing around with type annotations and mypy.  I
have still much to learn.  I take your point about "...cause you a
maintenance headache..."  I am guessing that part of what you are
saying is that if mypy (or whatever is actually being used) can
properly infer the type of an object then there is no point in
annotating it.  Can you give guidelines or point to a good article how
to best and most efficiently use type annotation without
over-annotating?  Bear in mind that I have yet to fully grasp all of
what mypy (What I am currently using.) can correctly infer from the
code.

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


Re: Helping Windows first time users

2020-04-19 Thread boB Stepp
On Sun, Apr 19, 2020 at 4:30 AM Barry Scott  wrote:
>
>
>
> > On 18 Apr 2020, at 21:00, boB Stepp  wrote:
> >
> > On Wed, Apr 15, 2020 at 2:04 PM Barry Scott  wrote:

> >> What are your thoughts on the installer changes and reply text?
> >
> > I wonder if the last screen of the installer should have a checkbox,
> > checked by default, that launches IDLE.  IDLE would then display a
> > helpful text file on this first launch describing how to use IDLE, how
> > to find and launch it again, etc.  As well have it describe all of the
> > help you are advocating here as well.  It would be a minor annoyance
> > for experienced users to have to uncheck the box before clicking
> > finish, but I think it might have a good chance of getting new users
> > off to a reliable start.  Many other Windows program installers are
> > setup similarly to launch the program being installed.  This is a
> > little different as IDLE is not Python, but that is a minor quibble, I
> > think.
>
> The problem with launching IDLE from the installer is that the user is not
> shown how do it without the installer.
>
> Launching a "Getting started" with the how to steps might work better
> on that checkbox.

IDLE can display text files as well as .py/.pyw files.  Are there
technical reasons why it would be difficult to have the first opening
of IDLE showing the contents of an informative text file as you
suggest?  One drawback is that there would be no clickable links if
this were done.

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


Re: Not able use installed modules

2020-05-08 Thread boB Stepp
On Fri, May 08, 2020 at 09:31:55AM -0600, Mats Wichmann wrote:
> On 5/6/20 10:15 PM, Music lover wrote:
> > Hello python team,
> >   I have installed the latest version of python from your site.
> > Then I successfully installed some modules like :- numpy , pandas,
> > matplotlib  from command prompt. But I am not able to use them while
> > programing in python Idle. It's saying " no module named 'matplotlib' ."

> As a general answer, this is *always* a problem with paths.  Your
> installation of modules went somewhere your Python doesn't know where to
> look, which is that Python's value of sys.path. It probably went into a
> version-specific location in the sys.path of a different Python as
> Souvik has suggested.
> 
> Usually if you ran "pip install something" and then can't find
> "something" that means pip does not map to the Python you're going to
> use.  As a result, it's better to use the following, with MYPYTHON being
> code for the way you expect to invoke Python - that could be "python" or
> "python3" or "py" or "py -3.8" or whatever it happens to be:
> 
> MYPYTHON -m pip install something
> 
> calling it as a module means things will be right for whatever MYPYTHON
> is, rather than picking up the first executable called pip, which might
> not be for that one.

This may be a naive question on my part, but, as far as I can tell, most
instructions that I have encountered for installing Python packages state the
installation instructions as "pip install ...", which seems to repeatedly
lead to these type of OP questions.  Has there ever been given thought to
changing these "standard" installation instructions to something less error
fraught for the newcomer/novice?

-- 
Wishing you only the best,

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


Re: Help with installation please

2020-05-17 Thread boB Stepp

On Sun, May 17, 2020 at 11:52:29PM +0100, Oscar Benjamin wrote:

I find the inconsistencies when it comes to "running Python" in a
terminal in different operating systems or environments very
frustrating. When teaching a class of 200 students who are new to
programming it is really important that you can give a simple
instruction that works. I'm yet to find that simple instruction for
the basic task of starting a Python interpreter.

I hope that one day we can get to a situation where once Python is
installed it can be run by typing "python" in whatever terminal you
want.


Amen!!!

--
Wishing you only the best,

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


Re: help

2020-07-17 Thread boB Stepp
On Fri, Jul 17, 2020 at 9:00 PM Castillo, Herbert S
 wrote:

> I downloaded python not to long ago, and today when I opened Python on 
> Windows it gave me a modify setup prompt. I have tried to click on modify , 
> repair and even uninstalled and installed it back, but when I try to open 
> Python up again, I keep on getting the same modify setup prompt. I am not 
> sure of what to do? Thank you in advance.

It sounds like you are just rerunning the python installer.  Instead,
open a command prompt or Powershell and type "py".  That will bring up
the Python interactive environment where you can type Python commands.
Or, probably better, open IDLE -- the provided Python editing
environment -- by pressing your Windows key which brings up the list
of available programs/program folders, find Python, expand that if
needed by clicking on it and then clicking on "IDLE".  That will bring
up the Python interactive prompt as well.  You can also create a new
Python file using the provided "File" menu, etc.  BTW, I am doing this
from memory.  I don't have a Windows PC handy, but hopefully it is
enough to get you over the hump.

BTW, there is a Python Tutor mailing list designed for those learning
Python.  Also, the main Python website has documentation, lists of
resources, tutorial, etc., to also help jumpstart your learning.  Have
fun!

HTH!



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


A Python installation help doc much more friendly to newcomers? [Was Re: help]

2020-07-17 Thread boB Stepp
On Fri, Jul 17, 2020 at 9:48 PM dn via Python-list
 wrote:
>
> On 18/07/20 1:53 PM, Castillo, Herbert S wrote:
> > I downloaded python not to long ago, and today when I opened Python on 
> > Windows it gave me a modify setup prompt. I have tried to click on modify , 
> > repair and even uninstalled and installed it back, but when I try to open 
> > Python up again, I keep on getting the same modify setup prompt. I am not 
> > sure of what to do? Thank you in advance.
>
>
> Regret that this mailing list does not support graphics attachments.
>
> Which part of https://docs.python.org/dev/using/windows.html failed?

Just for grins I just now glanced at the link dn provided.  Yes, this
is a very thorough, very accurate, very *technical* help resource.
But if I were a person who had never seen a shell, cmd.exe or
Powershell window, never programmed before, had no clue about how to
truly use my OS, etc., I don't think I would understand a bit of this
"help" document, and, at best, would find it very intimidating.  If
this community does wish to cater to those who are totally new to the
world of programming and learning how to really use their PC at any
depth, then I think a different approach or set of documents is
needed.  And an easier way for those playing with the idea of learning
programming and Python to connect with such documentation.

I think that we take a lot for granted that is second nature to most
of us.  Also, most of us have the mindset that even when all of this
programming stuff was new to us (If we can even truly remember that
anymore.), we would have the problem-solving chops to get over these
hurdles.  Many don't have these native inclinations.  Searching online
for technical solutions is completely foreign to many.  Even searching
for anything may be more challenging than we suspect for some.

I am just a Python hobbyist/dabbler, not a pro like most of you, but I
have taught kids through adults various subjects in the past, helped
seniors, etc., and a lot of what we take for granted is *not* easy for
many.  But I believe that almost everyone that can get to the point of
believing that they can perhaps learn programming, can do so, but may
need some encouragement to get to that point of "self-belief".

Sure, some people are just too lazy and want to be spoon-fed, but I
truly believe that is a minority.  Can we make this easier for those
who really would like to try?

Just some thoughts that I hope will be constructively received.

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


Re: Issue with Python installation for a beginner Python coder.

2020-07-31 Thread boB Stepp
On Thu, Jul 30, 2020 at 9:24 AM Sarvesh Poddar via Python-list
 wrote:

> I re-installed Python in my Windows system as the earlier one was not able to 
> import modules...

You do not provide much detail to diagnose what your problem(s)
is(are).  By the "earlier one" is it the same version as the one you
re-installed?  Were you able to run IDLE with the "earlier one"?  By
not being able to import modules do you mean modules from Python's
standard library?  Or do you mean installing third party libraries
using pip?

> ...But now I am not able to open IDLE after multiple tries.

Have you looked in your start menu in the list of installed programs
for Python?  If it is there did you expand it and see if there is an
entry for IDLE?  How have you been trying (unsuccessfully) to open
IDLE?


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


Re: Problem

2020-10-01 Thread boB Stepp

On Thu, Oct 01, 2020 at 01:34:35AM -0400, Dennis Lee Bieber wrote:


I'm pretty certain the Python.org downloads for Windows also put IDLE
on the start menu. I believe these newcomers aren't even looking at the
start menu for things -- if it isn't cluttering up the desktop they
probably don't know it exists. And the only thing they know about is the
file they downloaded.


Maybe this suggests the "incremental improvement" needed:  Have the
installer, by default, add a shortcut icon for IDLE to the user's desktop.
Perhaps this will get noticed.  If it does it would put the new user into a
program where they might actually start doing something useful.  The person who 
does
not want such a desktop shortcut can uncheck that default option.

--
Wishing you only the best,

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


Re: Best way to determine user's screensize?

2020-10-30 Thread boB Stepp

On Sat, Oct 31, 2020 at 12:56:30AM +0100, Peter J. Holzer wrote:


So, assuming the user is invoking the application for the first time,
how should an application determine how much of the screen it should
use? It has to make some choice, and any hard-coded value is almost
certainly wrong. So why should an application not use the screen size as
one factor?


I have been following this discussion with some interest (except for the
grumpy parts ~(:>)) ), and have wondered this same thing.  Is there any
good guidance on how to answer this question?  Or should it be up to the
combination of GUI toolkit and OS being used?  It seems that if the
programmer does nothing, some default size is generated.

As a user I have not been too concerned about the size presented upon first
using a program.  What gets my dander up is what happens *after* I set the
size I prefer.  Many programs do not store this preference for future runs
of the program or even during the same session when a new window is
generated of the exact same type.  A Windows-based application I use for
work constantly annoys me in this regard, especially when I am working at
home on my (not as wide as Chris') ultra-wide monitor:  I open external
beam planning window for patient #1, resize it.  Open same for next patient
-- must resize once again (...and again, and again, ...).

--
Wishing you only the best,

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


Re: Is vars() the most useless Python built-in ever?

2015-12-01 Thread boB Stepp
On Mon, Nov 30, 2015 at 7:00 PM, Steven D'Aprano  wrote:

>
> Either way, vars() doesn't solve the problem. What problem does it solve?
>

I'm way out of my depth here (I normally post on Tutor, as Steve
knows), but when I looked vars() up in Lutz's "Python Pocket
Reference, 5th ed.", he ended his description of it with:  "... Hint:
useful for referring to variables in string formatting."  This is
probably something obvious to you, but I thought I'd throw it out
there in case it's of any value, since I did not see this mentioned
elsewhere in this thread.  Just trying to learn more ...


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


Re: Issues with to run python

2016-02-06 Thread boB Stepp
On Sat, Feb 6, 2016 at 2:10 PM, Dánisa Andrea Alejo García
 wrote:

>  I am writing to you because I have downloaded Python,I have followed all the 
> instructions, but for some reason I am  unable to use it.

This is a very common question of late.  If you search the list
archives, you will probably find your answer.  I'll just add that if
you are using Win XP, you can only use <= Python 3.4.x.  Win XP won't
work with >= Python 3.5.x.

But if by searching the archives you cannot answer your question, then
you will need to provide additional information:  What is your OS?
Which Python version are you trying to install?  What exact steps did
you take?  How did you attempt to start Python?  Etc.

> I am sending to you a  screen shot, so in that way you can have an idea  of 
> what is going on. I have already  repaired and modified, but all the time I 
> am back to the same screen, that shows the same different options that can 
> appreciate on the screen shot that I am sending to you. Those options are :
>
> Modify
>
> Repair
>
> Uninstall

This is a plain text only list, so your screen shot attachment is useless here.

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


Re: Simple tkinter query about creating a tk,StringVar() failure

2016-02-06 Thread boB Stepp
On Sat, Feb 6, 2016 at 6:38 PM,   wrote:
> Why does this interactive instantiation fail when it seems to work
> when run in a script?

You have to establish your root window first:

Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:54:25) [MSC v.1900
64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter as tk
>>> root = tk.Tk()# This will open an empty window.
>>> name = tk.StringVar()
>>>


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


Re: anomaly

2015-05-11 Thread boB Stepp
I am in process learning Python and normally hang out on the Tutor
list, but monitor this one hoping to learn what I can. This thread is
of interest to me from the standpoint of trying to understand the
Python way of doing things.

On Sun, May 10, 2015 at 12:28 PM, Gary Herron  wrote:
> On 05/10/2015 09:48 AM, Rustom Mody wrote:
>>
>> On Sunday, May 10, 2015 at 10:14:36 PM UTC+5:30, Ian wrote:
>>>
>>> On Sun, May 10, 2015 at 10:34 AM, Mark Rosenblitt-Janssen wrote:

 Here's something that might be wrong in Python (tried on v2.7):

>>> class int(str): pass
>>>
>>> This defines a new class named "int" that is a subclass of str. It has
>>> no relation to the builtin class int.
>>>
>>> int(3)

 '3'
>>>
>>> This creates an instance of the above "int" class, which is basically
>>> equivalent to calling "str(3)".
>>>
>>> Were you expecting a different result?
>>
>> In C (family) languages int is a keyword
>>  From that pov this is completely bizarre
>
>
> Not really.  Expecting Python to act like C family languages *is* bizarre.

I have to admit being surprised by this, too. I am just now studying
on how to write my own classes in Python, and have come to realize
that doing this is *possible*, but the *surprise* to me is why the
language design allowed this to actually be done.

> Common Python thought::  "We're all adults here."If you want to override
> a builtin within your own namespace, who are we to stop you?

I'm surprised that this thought has not been added to the "Zen Of
Python", as I see it as more and more recurrent as I continue my
studies. What I would like to comprehend is what is the essential
mindset of Python? That is, what do I need to understand, so that I am
no longer likely to be surprised by discovering new possibilities in
Python such as what the current thread is discussing?


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


Re: anomaly

2015-05-11 Thread boB Stepp
On Mon, May 11, 2015 at 2:44 AM, Chris Angelico  wrote:
> On Mon, May 11, 2015 at 5:12 AM, boB Stepp  wrote:
>>> Common Python thought::  "We're all adults here."If you want to override
>>> a builtin within your own namespace, who are we to stop you?
>>
>> I'm surprised that this thought has not been added to the "Zen Of
>> Python", as I see it as more and more recurrent as I continue my
>> studies. What I would like to comprehend is what is the essential
>> mindset of Python? That is, what do I need to understand, so that I am
>> no longer likely to be surprised by discovering new possibilities in
>> Python such as what the current thread is discussing?
>
> The Zen of Python is a static document, a historical artifact of a
> sort. But in terms of understanding the philosophy of Python, "we're
> all adults here" is a big part of it. Once you grok the notion that
> nothing can be prevented, you're freed from such considerations as:
>
> * Obfuscating, encrypting, or otherwise hiding your source code
> * Private members with restricted access
> * Strict type checking, to prevent someone passing in a wrong piece of data
> * Prevention of monkey-patching
>
> etc, etc, etc. In actual fact, anyone can bypass any restriction, in
> any language; and Python is just more open/honest about it than
> languages like C++; for instance, instead of having true private
> members where the compiler stops you from looking at or changing them,
> Python gives you single-underscore-named attributes, where nobody
> stops you from doing anything, but there's a general understanding
> that they're not governed by the usual compatibility rules, so
> upgrading a library might break your code. Happy with that? Go ahead
> then, use the internals.

Thanks, Chris, that helps a lot. It seems that beyond being a
programming language, Python has a well-established culture that
suggests how the language should be used. I am gathering that
understanding the language and embracing the existing culture are
needed to use Python in the way it is meant to be used, though the
language design allows *other* ways, too.

> Hakuna matata, what a wonderful phrase.

Indeed! And a good way to start my Monday morning.


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


Re: anomaly

2015-05-11 Thread boB Stepp
On Mon, May 11, 2015 at 2:40 AM, Mark Lawrence  wrote:
> On 10/05/2015 20:12, boB Stepp wrote:

>> I'm surprised that this thought has not been added to the "Zen Of
>> Python", as I see it as more and more recurrent as I continue my
>> studies. What I would like to comprehend is what is the essential
>> mindset of Python? That is, what do I need to understand, so that I am
>> no longer likely to be surprised by discovering new possibilities in
>> Python such as what the current thread is discussing?
>>
>>
>
> You need to understand that Python is so powerful that after 14 years I
> still can't wrap my mind around all of the possibilities that it offers.

That's quite a statement! I see I have a loooggg journey ahead!!



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


Re: installer user interface glitch ?

2015-11-01 Thread boB Stepp
On Sun, Nov 1, 2015 at 3:48 PM, Laura Creighton  wrote:
> Actually, adding the XP - do not look here --
> message for several webpages has been on the pydotorg
> todo list for more than a week now.
>
> Not sure why it hasn't happened.
>
> Thank you for the reminder.

I have to confess I do not understand all of the hullabaloo generated
in this thread, but I think it would be helpful if there were an
obviously placed minimum requirements note for the download page.
Something like "Requires Windows Vista or greater ...", etc.  I
imagine many people are like myself, just trying to learn Python and
want the latest version, etc.  Many software products include a
minimum requirements statement on their download page, so--at least to
me--it does not seem unreasonable for the Python folks to do the same.
If nothing else it might reduce the number of recent XP users from
asking the same questions over, and, ..., and over.  Of course if such
people would only type in their issue into their favorite search
engine...  But that is a different issue--heavy sigh!

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


Re: failing to run python on my pc

2015-11-19 Thread boB Stepp
On Thu, Nov 19, 2015 at 2:22 PM, Daniel Kasuza  wrote:
> Dear Sir/Madam
> I am student with University of the people and a beginner in programming.
> My problem is that l have down loaded python 2.7 but l am failing to muse
> it. If l try to to use it, I am getting an option which say run. If l press
> run, it just run and come back to the same option. I want to use it for
> some practice but i am failing.

Your question is rather vague and difficult to understand.  Are you
having difficulty in installing Python 2.7?  If yes, what operating
system are you using?  Did your course or course text book give you
instructions on what to do?  If so, what steps did you accomplish
successfully, and at what step did things stop working?

Or do you have Python installed and then tried to run a program?  What
program and how did you try to run it?  What were the precise results?

You might want to redirect your question to Python Tutor with a much
fuller description of what you tried and what happened:
https://mail.python.org/mailman/listinfo/tutor

This mailing list is targeted towards beginners in Python.  They have
been extremely helpful to me!  But you will have to give much more
detailed information before anyone will be able to assist you.  Also,
the main Python website has many resources, including tutorials as
well as the full docs.  Poke around at www.python.org .  And don't
forget to search the 'Net!  Your exact problem has probably been
encountered many times before ...


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


Re: int vs. float

2017-02-10 Thread boB Stepp
On Sat, Feb 11, 2017 at 1:00 AM, Amit Yaron  wrote:
> On 10/02/17 21:15, Peter Pearson wrote:
>>
>> On Fri, 10 Feb 2017 13:59:45 +0200, Amit Yaron 
>> wrote:
>>>
>>> On 10/02/17 04:33, [email protected] wrote:

 My computer programming professor challenged me to figure out a way
 to manipulate my program to display one error message if the user
 input is a zero or a negative number, and a separate error message if
 the user input is a decimal number.  My program starts out:

[snip]

>> What should happen if the user types "1.0"?
>>
>> To be flexible about this possibility, you could accept the number
>> as a float, and then complain if int(num) != num.
>>
> Another option:
> Use 'float' instead of 'int'. and check using the method  'is_integer' of
> floating point numbers:
>
 3.5.is_integer()
> False
 4.0.is_integer()
> True

According to the OP's professor's challenge, the OP needs to recognize
an input of "4.0" as a float and "4" as an integer, and to respond
with an error message in the float case, or "decimal number" case as
the OP phrased it.  Apparently only positive integers are acceptable
input; all other inputs should generate an appropriate error message
by input type.


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


Re: Doubt with files

2017-02-14 Thread boB Stepp
On Tue, Feb 14, 2017 at 11:13 AM, José Manuel Suárez Sierra
 wrote:
> hello,
> im trying to read a rtf or txt file with this python script:
>
> with open(dirFichero,'r') as reader:
> for line in reader:
> print line
>
> the problem is that shown is :
>
> {\rtf1\ansi\ansicpg1252\cocoartf1504\cocoasubrtf810
>
> {\fonttbl\f0\fswiss\fcharset0 Helvetica;}
>
> {\colortbl;\red255\green255\blue255;}
>
> {\*\expandedcolortbl;;}
>
> \paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
>
> \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
>
>
>
> \f0\fs24 \cf0 1l2m,1svo,1lme}
>
>
> INSTEAD of:
> 1l2m,1svo,1lme
>
> How could I fix it?

Your program seems to be faithfully printing out the contents of your
rtf file as a txt file, showing all of the rtf formatting code.  If
you want a different result, I suggest you search online for something
like:  python read write rtf


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


Re: Doubt with files

2017-02-14 Thread boB Stepp
On Tue, Feb 14, 2017 at 11:31 AM, Joaquin Alzola
 wrote:
>
>>with open(dirFichero,'r') as reader:
>  >   for line in reader:
>  >   print line
>>
>>the problem is that shown is :
>>{\rtf1\ansi\ansicpg1252\cocoartf1504\cocoasubrtf810
>>{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
>>{\colortbl;\red255\green255\blue255;}
>>{\*\expandedcolortbl;;}
>>\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
>>\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
>>
>>\f0\fs24 \cf0 1l2m,1svo,1lme}
>>
>>INSTEAD of:
>>1l2m,1svo,1lme
>>
>>How could I fix it?
>
> I do not know exactly what encoding rtf or the txt file has but you can use:
>
> with open(dirFichero,'r',encoding='utf-8') as reader:

This won't work.  It will still display the rtf format coding, which
the OP apparently does not want.


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


Re: print odd numbers of lines from tekst WITHOUT space between lines

2017-02-18 Thread boB Stepp
On Sat, Feb 18, 2017 at 11:38 AM, TTaglo  wrote:
> i = 1
> f = open ('rosalind_ini5(1).txt')
> for line in f.readlines():
> if i % 2 == 0:
> print line
> i += 1
>
>
> How do i get output without breaks between the lines?

If you use "print line," (Note the trailing comma.), this should
suppress the line break that the print statement normally inserts.

Another suggestion might be to use enumerate() instead of using a
manual counter in your for loop.

HTH!



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


Re: read in a list in a file to list

2017-04-08 Thread boB Stepp
On Sat, Apr 8, 2017 at 3:21 PM,   wrote:
> On Saturday, April 8, 2017 at 7:32:52 PM UTC+1, john polo wrote:
>> Hi,
>>
>> I am using Python 3.6 on Windows 7.
>>
>> I have a file called apefile.txt. apefile.txt's contents are:
>>
>> apes =  "Home sapiens", "Pan troglodytes", "Gorilla gorilla"
>>
>> I have a script:
>>
>> apefile =  open("apefile.txt")
>> apelist =  apefile.read()

I think you misunderstand what the read() method is doing here.  It
does not return a list.  Instead, it returns the entire file as a
single string.

>> for ape in apelist:

So here despite the variable name you chose, you are acutally
iterating over the entire file contents character by character.  See
Mark's answer/hint below on how to iterate over the file contents by
line.  You might want to look up the docs on how to use these file
objects and their methods.

>> print("one of the apes is " + ape)
>> apefile.close()
>>
>> The output from the script does not print the ape names, instead it
>> prints each letter in the file. For example:
>>
>> one of the apes is a
>> one of the apes is p
>> one of the apes is e
>>
>> What should I do instead to get something like
>>
>> one of the apes is Home sapiens
>> one of the apes is Pan troglodytes
>> one of the apes is Gorilla gorilla
>>
>> John
>
> I'll start you off.
>
> with open("apefile.txt") as apefile:
> for line in apefile:
> doSomething(line)
>
> String methods and/or the csv module might be used here in doSomething(line), 
> but I'll leave that to you so that you can learn.  If you get stuck please 
> ask again, we don't bite :)


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


Re: Syntax error for simple script

2017-06-27 Thread boB Stepp
On Tue, Jun 27, 2017 at 9:05 AM, Steve D'Aprano
 wrote:
> On Tue, 27 Jun 2017 08:34 am, Erik wrote about the print function error 
> message:
>
> py> print x
>   File "", line 1
> print x
>   ^
> SyntaxError: Missing parentheses in call to 'print'

[snip]

>> I think the suggestion above is a bit wordy, but even if it was
>> something like "Missing parentheses in call to the 'print' function"
>
> I think this is a good example of "the curse of knowledge". Its hard for 
> experts
> to think like a non-expert.
>
> It seems obvious to us that adding the word "function" will make it clear to 
> the
> user what's going on. We understand that print is now a function, and function
> calls always need parentheses, but that print used to be a statement like
> while, for, if, etc. that doesn't need parentheses.
>
> To a moderately experienced programmer, the word "function" doesn't actually 
> add
> anything, but it isn't harmful: the error is just a reminder of what they
> probably already know.
>
> But to the beginner, adding "function" at the error might as well be
>
> Missing parentheses in call to the 'print' wharrgarbl.
>
>
> It's just jargon. They can either diagnose the problem from the first part of
> the sentence telling them that there are missing parentheses, or they can't. 
> If
> they can't, I doubt that adding the word "function" (or any other jargon term
> like subroutine, procedure or callable) will help.
>
> Anyway, that's my opinion. If any newbies, like the OP, would like to venture 
> an
> opinion, that would be good. That's why I asked Ben if there was something we
> could do to make the sentence clearer.

Perhaps add a simple usage example?

SyntaxError:  Missing parentheses in call to 'print'.  Correct example:
print('Prints this string')

Surely a little more verbiage won't be too harmful?

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


Re: python in chromebook

2017-07-26 Thread boB Stepp
On Wed, Jul 26, 2017 at 8:03 PM, Byung-Hee HWANG (황병희, 黃炳熙)
 wrote:
> my computer is chromebook. how can i install python in chromebook?
> barely i did meet develop mode of chromebook. also i'm new to
> python.
>
> INDEED, i want to make python code on my chromebook.
>

Googling for "python on chromebook" tends to bring up Python 2-slanted
info; searching for "python 3 on chromebook" for Python 3-slanted
results should give you useful info.  A quick scan suggests there are
two approaches:  (1) Going into developer mode on your Chromebook and
installing Python normally, or (2) going to the app store and
installing a Python shell that runs in your browser.  Myself, I would
prefer (1), but I have never had a Chromebook, so that may not fit in
with what you wish to do.

HTH!

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


Re: first code attempt

2017-08-02 Thread boB Stepp
On Wed, Aug 2, 2017 at 4:36 PM,   wrote:
> Hello,
> I am using the workbook Computer Coding by Jon Woodcock, published by DK
> WORKBOOKS, to try to learn computer coding. I only get to pages 10 and 11
> in Robot Programs when round robots appear in squares to manipulate them.
> Where in the world do I find robots and squares?

I happened to find preview pages for pages 10-11 on the publisher's website:
https://www.dk.com/us/9781465426857-dk-workbooks-computer-coding/

I suggest you reread page 10 very carefully.  This is a paper and
pencil set of exercises; nothing is typed into the computer.  You have
a "programming language" for your paper and pencil robot with just
three instructions:
(1) "F":  This instruction moves your robot forward one square.
(2) "R":  Rotate your robot in place 90 degrees (a quarter-turn)
to the right.
(3) "L":  Rotate your robot in place 90 degrees (a quarter-turn)
to the left.

The author wants you to figure out what sequence of these three
instructions ("F", "R", and "L") are needed to navigate the paper
robot through the printed mazes provided in the book.  In each problem
the robot starts out on the green circle of each printed diagram and
your task is to get the robot to the square with the checkered flag.
The actual problems are on page 11.  The instructions say that the
robot cannot go through pink walls, so you will have to write down the
correct instructions to get around such obstacles.  Look closely at
the example on page 10.  This shows how to write down the instructions
to get through that simple maze.

Again, this is a paper and pencil exercise with a very simple 3
instruction programming language.  The author is trying to get you to
understand how detailed and simple the steps need to be to program a
computer.  You have to be very specific!  And programming languages
have a very limited vocabulary compared to a natural human language.
Programming language "words" mean very specific things, normally one
such "thing" per word.  English words, for instance, may mean a
variety of things depending on the context where they are being used.

I hope this helps!  Later in the book they will get to how to do
things in the Python programming language (Or so the book description
says.).

You might want to consider joining the Python Tutor list
(https://mail.python.org/mailman/listinfo/tutor).  This is meant for
newcomers to Python who have a lot of basic questions.  This list is
more oriented towards already competent Python programmers who tend to
go off on interesting technical tangents.  ~(:>))

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