Re: on = style

2017-10-10 Thread sjmsoft
Being an old-timer, I was brought up on languages like COBOL, where programmers 
love to line up MOVE, COMPUTE and some other statements.  I still do that when 
I write COBOL, as it is expected by other programmers and somehow just seems 
right.

But I resist the urge in Python and never do it.  Previous posters have given 
good reasons for this.  My main reason is to keep diffs as small as possible.

Small diffs would apply to COBOL too, of course.  Even programmers are not 
always completely rational.  Tradition and common practice have their say, too. 
 (And COBOL is so verbose that perhaps it's a lost cause!)

Cheers,
  Steve J. Martin
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Issue with python365.chm on window 7

2018-04-24 Thread sjmsoft
On Monday, April 23, 2018 at 7:38:04 PM UTC-3, Terry Reedy wrote:

> I installed python.org 64-bit 3.6.5 on Win 10 with the .exe installer.
> I run it by clicking on Python 3.6 => Python 3.6 Manuals in the Win10 
> version of what was Start Menu.  The icon is a notebook page with 
> question mark.  Window like it has for over a decade, with sidebar on left.
> 
> If anyone else has 3.6.5 (the latest 3.6) on Win 7, what to you see?

I did the same, and see the same, as Terry.  I'm using Windows 7 Enterprise.

HTH,
  Steve J. Martin


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


Re: What is your experience porting Python 2.7.x scripts to Python 3.x?

2019-01-27 Thread sjmsoft
After chickening out a couple of times over the past few years, about eight 
months ago we migrated our small code base from 2.7.14 to 3.6.5.  Some notes:

On 2.7 we spent a couple of years coding with 3.x in mind, using import from 
__future__ and coding to Python 3 standards wherever possible.  This greatly 
reduced the number of changes put into production during cutover and got us 
used to Python 3.

We used 2to3.py and found that it handled easy cases (print) well and provided 
a good check on my work when I hand-converted.

The string versus bytes issue was the most difficult.  We receive many files 
from other financial institutions, who receive some of the data from yet other 
FIs.  Most of them seem to have little understanding of, or interest in, 
encodings, and claim to send the files in 'ASCII'.  Python 3 is intolerant of 
dirty data, whereas previous Pythons let anything go.  I because very familiar 
with encoding= and errors= on open().  And network protocols want bytes.

I also suggest paying special attention to division (/).  We used the 
__future__ import to handle this early.

We had some problems installing Python 3.6.5 on Windows Server 2012 that 
already had 2.7, particularly Registry settings that wound up being wrong.  The 
problems seemed to occur erratically, so YMMV.  After some trial and error, we 
chose to leave Python 2.7 installed and install Python launcher for Windows 
(PyLauncher), to allow for easy fallback (which we never had to do) and because 
this provided the smoothest install.

We have found Python 3.6.5 to be very reliable on Windows Server 2012.

My next project is to upgrade to Windows Server 2016 and Python 3.7 on a new 
machine.  We will not be installing Python 2.7 on this machine.

HTH,
  Steve J. Martin


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


Re: Books for Python 3.7

2019-07-12 Thread sjmsoft
On Friday, July 12, 2019 at 11:37:08 AM UTC-3, mok...@gmail.com wrote:
> Can anyone help me.
> New to Python.
> Installed version 3.7
> I purchased the "Python for Dummies" book But this book was written for an 
> older version of Python.
> All the examples and samples don't work with version 3.7
> Can anyone direct me to which is the latest book to buy to properly learn 
> Python.
> Thanks

You don't say what Python release your book covers, but the first thing to know 
is that Python 3 has many incompatibilities with Python 2.  I don't think any 
book that covers Python 2 is useful for a new Python programmer using Python 3.

You also don't say whether you're a beginning programmer or a veteran wanting 
to learn a new language.  This might affect your book choice, as some are 
directed more toward beginning programmers.

One good choice is Dive Into Python, available for free on-line (google "dive 
into python 3").  I'm sure other folks could suggest additional suitable Python 
3 books.

HTH,
  Steve J. Martin
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Book

2005-11-14 Thread sjmsoft
David Rasmussen wrote:
> What is the best book for Python newbies (seasoned programmer in other
> languages)?
>
> /David

A couple of years ago I was in the same boat you're in now.  I learned
from _Python in a Nutshell_ by Alex Martelli and still use it as my
main reference.  (It only covers up to version 2.2 so a new edition
would be most welcome.)  I also use the on-line Python docs and I
second Larry Bates' comments re. the cookbook and the Windows book,
both of which I also use occasionally.

-- Steve

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


Re: Want to learn a language - is Python right?

2005-06-21 Thread sjmsoft
Aziz McTang wrote:
> What I'm looking for is more to learn one good, comprehensive
> programming language well than several approximately on an ad hoc
> basis. What I also failed to mention is the desire to develop my
> presently limited computer skills a lot further.

I've programmed in perhaps 20 languages ranging from the famous to the
obscure, from 1950s to 1990s design.  Python is my favorite.  It's a
great language for beginners but advanced programmers do not outgrow
it.  It has powerful features but simple, sensible syntax, so you spend
little time fighting the language itself and more time fighting the
problem you're trying to solve.  It's open source so cost of entry is
zero, it runs on many platforms, and it has a active, helpful user
community.  And coding in Python is fun!

Python is a great first lanuguage but keep an open mind to _someday_
learning more languages.  As someone else mentioned in this thread, no
language is right for all jobs.  And knowing languages built on
different paradigms (e.g., Prolog, Lisp, assembly languages) provides
new insights into the art of programming.

Cheers,
  Steve

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


Re: Stop writing Python 4 incompatible code

2016-01-13 Thread sjmsoft
This strikes me as very good advice.  Thanks for being so far-sighted. And 
let's hope that Python 4 has fewer incompatibilities (none would good) than 
Python 3!

Cheers,
  Steve J. Martin

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


Re: os.rename on Windows

2016-03-23 Thread sjmsoft
Python 2.7.11 on Windows 7 Enterprise (64-bit machine, 32-bit Python) and two 
Windows Server 2012 R2 (64-bit machines, both 32-bit and 64-bit Pythons):

183
17
WindowsError(183, 'Cannot create a file when that file already exists')

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


Re: [OFF-TOPIC] It is true that is impossible write in binary code, the lowest level of programming that you can write is in hex code?

2014-11-04 Thread sjmsoft
Grant's statements are correct and his advice is sound.

I would not waste my time writing machine code, even as a hobby (and not even 
if your other hobbies include juggling chain saws).  It's too time-consuming, 
tedious, bug-prone, and eyeglass-prescription-enhancing.

Programming in assembly language will show you how the machine really works, 
and is challenging enough for almost anyone.  And it will help you truly 
appreciate a powerful high-level language like Python.  I've written much 
assembly language, on two different architectures, over the past 35 years, and 
I'm glad I did.  But these days I work in assembly language only when necessary 
(legacy code).  Give me Python any day!

Cheers,
  Steve J. Martin
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Most gratuitous comments

2014-12-04 Thread sjmsoft
Many years ago I, too, had a couple of CS profs who forced us to include too 
many (usually innocuous) comments in our Fortran and PL/1 code.  Perhaps they 
were trying to counter the natural programmer tendency of not commenting at all?

Forty years of programming later (yikes!), I try to use comments to tell WHY 
I'm doing what I'm doing, especially when it's not obvious to someone else (or 
to me in about two weeks).  I never use comments to teach the reader what the 
Python language or libraries do.

Cheers,
  Steve J. Martin
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Idiomatic backtracking in Python

2015-01-27 Thread sjmsoft
On Sunday, January 25, 2015 at 4:15:58 PM UTC-4, Johannes Bauer wrote:
> Hi folks,
> 
> I have a problem at hand that needs code for backtracking as a solution.
> And I have no problem coding it, but I can't get rid of the feeling that
> I'm always solving backtracking problems in a non-Pythonic
> (non-idiomatic) way. So, I would like to ask if you have a Pythonic
> approach to backtracking problems? If so, I'd love to hear your solutions!

When I think of backtracking, I think of Prolog (to which backtracking is 
central).  You could use PySWIP to run SWI-Prolog from your Python program.  
Not idiomatic Python backtracking, of course, but it would get the job done, 
and Prolog's backtracking is reliable and well-described.  It would help if you 
already know a bit of Prolog or are keen to learn.

Cheers,
  Steve J. Martin


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


Re: Printing to printer, windows 7

2015-02-17 Thread sjmsoft
On Monday, February 16, 2015 at 10:08:33 PM UTC-4, ken.h...@gmail.com wrote:
> Would seem to be a simple problem.  I just want to print to my printer 
> instead of the console using Python 2.7, Windows 7.  Hours of looking through 
> FAQ's and Google haven't yielded a solution.  Any suggestions appreciated --

There is a good discussion on Tim Golden's site:

http://timgolden.me.uk/python/win32_how_do_i/print.html

As he notes, alas, there is a "disparity between the number and complexity of 
solutions and the simplicity of the requirement."

HTH,
  Steve J. Martin
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python under the sea and in space

2014-05-07 Thread sjmsoft
I don't suppose "eight miles high" in the figurative sense counts?

Cheers,
  Steve J. Martin
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python under the sea and in space

2014-05-08 Thread sjmsoft
On Wednesday, May 7, 2014 9:34:14 PM UTC-3, Steven D'Aprano wrote:
> I'm afraid I don't know what "eight miles high" in the figurative sense 
> means.

  I was referring to the Byrd's song "Eight Miles High"--purportedly a drug 
song.

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


Re: Is there no end to Python?

2006-03-17 Thread sjmsoft
John Salerno wrote:
> But isn't Python sort of known for the opposite, i.e. 'one simple way',
> or something to that effect?

The Python language is clear and concise and so I don't think takes
long to learn.  But there's so many libraries and packages available
that I'll probably never use more than a fraction of them.  This is
good thing because I can ignore what I don't need.

-- Steve J. Martin

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


Re: SimpleHTTPServer and CgiHTTPServer in practice

2017-03-16 Thread sjmsoft
For a couple of years we've used SimpleHTTPServer to serve pages to internal 
users at low volumes, and we find it to be reliable and trivial to set up.  We 
have not subjected it to a rigorous security assessment.

HTH,
  Steve J. Martin
-- 
https://mail.python.org/mailman/listinfo/python-list