Re: Python 3.7 Bug

2019-03-25 Thread Bassam Abdul-Baki
Greetings,

In the following code, there's a bug on certain parameters.

--

def per(n, steps = 0):
 digits = [int(i) for i in str(n)]
 result = 1
 for j in digits:
  result *= j
 steps += 1
 print(steps, result, sep=" - ")
 if result == 0:
  print(result, str(result), len(str(result)), sep=" - ")
 if len(str(result)) == 1:
  print(" --- DONE ---")
  return "DONE"
 else:
  per(result, steps)

--

What the program does:
If I run per(X) and X is a multiple of 10, I should end up with 0 in a
finite amount of steps.

The problem:
If I run per(54), I do not get 'DONE' printed through the return
statement.  WRONG!

If I run per(20), I do get 'DONE' printed through the return statement.
CORRECT!

20, 30, etc. are correct.  25, 45, etc. are not.

Is this a bug?

Thanks,
Bassam
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.7 Bug

2019-03-25 Thread Chris Angelico
On Tue, Mar 26, 2019 at 5:08 AM Bassam Abdul-Baki  wrote:
>
> def per(n, steps = 0):
>  if len(str(result)) == 1:
>   print(" --- DONE ---")
>   return "DONE"
>  else:
>   per(result, steps)
>
> --
>
> What the program does:
> If I run per(X) and X is a multiple of 10, I should end up with 0 in a
> finite amount of steps.
>
> The problem:
> If I run per(54), I do not get 'DONE' printed through the return
> statement.  WRONG!
>
> If I run per(20), I do get 'DONE' printed through the return statement.
> CORRECT!
>
> 20, 30, etc. are correct.  25, 45, etc. are not.
>
> Is this a bug?

Yes, it is - not a bug in Python, but a bug in the above code :)

I would recommend exploring the part of the code that I quoted above,
and researching how recursion works, and specifically what 'return'
does. That should put you on the right path to figuring this out.

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


Re: Python 3.7 Bug

2019-03-25 Thread Peter Otten
Bassam Abdul-Baki wrote:

> Greetings,
> 
> In the following code, there's a bug on certain parameters.
> 
> --
> 
> def per(n, steps = 0):
>  digits = [int(i) for i in str(n)]
>  result = 1
>  for j in digits:
>   result *= j
>  steps += 1
>  print(steps, result, sep=" - ")
>  if result == 0:
>   print(result, str(result), len(str(result)), sep=" - ")
>  if len(str(result)) == 1:
>   print(" --- DONE ---")
>   return "DONE"
>  else:
>   per(result, steps)

An indent of four spaces per level would make this much easier to read.

> What the program does:
> If I run per(X) and X is a multiple of 10, I should end up with 0 in a
> finite amount of steps.
> 
> The problem:
> If I run per(54), I do not get 'DONE' printed through the return
> statement.  WRONG!
> 
> If I run per(20), I do get 'DONE' printed through the return statement.
> CORRECT!
> 
> 20, 30, etc. are correct.  25, 45, etc. are not.
> 
> Is this a bug?

If you write a function that does not do what you want it to do -- then, yes 
that is a bug ;)

If I were to guess: You expect that line to return "DONE":

>   per(result, steps)

However, in Python you need to be explicit:

return per(result, steps)

will return the result of the recursive call.

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


Re: Python 3.7 Bug

2019-03-25 Thread DL Neil

Bassam,
Greetings.


On 26/03/19 1:14 AM, Bassam Abdul-Baki wrote:

Greetings,

In the following code, there's a bug on certain parameters.

--

def per(n, steps = 0):
  digits = [int(i) for i in str(n)]
  result = 1
  for j in digits:
   result *= j
  steps += 1
  print(steps, result, sep=" - ")
  if result == 0:
   print(result, str(result), len(str(result)), sep=" - ")
  if len(str(result)) == 1:
   print(" --- DONE ---")
   return "DONE"
  else:
   per(result, steps)

--

What the program does:
If I run per(X) and X is a multiple of 10, I should end up with 0 in a
finite amount of steps.

The problem:
If I run per(54), I do not get 'DONE' printed through the return
statement.  WRONG!

If I run per(20), I do get 'DONE' printed through the return statement.
CORRECT!

20, 30, etc. are correct.  25, 45, etc. are not.

Is this a bug?



No - the Python 3.7 does exactly what you've asked it to do!

0
What is the objective of this piece of code? Other than "CORRECT!" and 
"WRONG!" there are few hints, especially the function name: "per". What 
does "per" mean - not everyone is a mathematician.


1
Had we been shown two entire output reports, eg one for 20 (correct) and 
another for 25 (incorrect), the answer would have been immediately apparent.


2
Is it a good idea/best practice to sometimes code the two values as 
"results" followed by "steps", and sometimes "steps" followed by 
"results"; or does this invite confusion?


3
Please express "len(str(result)) == 1" in English (or your preferred 
spoken-language). Is there an easier way to find numbers expressed in 
multiple digits? (and that's another overly-complicated way to say the 
same thing!)


4
If a 'debug print' is added at the beginning of the function, is the 
function being "called" more times than expected? Should/could more 
debug-print statements be added to check other sub-calculations along 
the way?


(PS 'debug-print' added to your code for debugging/testing and then 
removed for 'production-use' is a quick-and-dirty tactic. Please add a 
note to your Python ToDo list: "learn to use logging library instead of 
debug-print", otherwise wiser heads will criticise this advice, which 
works well when learning but perhaps not at the professional level)


5
Humility: that it might be a bug in your code rather than in Python 3.7.
Respect: It would be polite to mention if this is a student/homework 
assignment - or the text that you are following for self-improvement.
Charity begins at home: That people here will volunteer to help you, and 
can be more helpful if you help us - particularly by providing 
information which will save our (valuable) time.



Here's hoping you are now equipped to find the source of the problem...

--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.7 Bug

2019-03-25 Thread Terry Reedy

On 3/25/2019 8:14 AM, Bassam Abdul-Baki wrote:

Greetings,

In the following code, there's a bug on certain parameters.

--

def per(n, steps = 0):
  digits = [int(i) for i in str(n)]
  result = 1
  for j in digits:
   result *= j
  steps += 1
  print(steps, result, sep=" - ")
  if result == 0:
   print(result, str(result), len(str(result)), sep=" - ")


If result is  0, then this just prints useless 0 - 0 - 1


  if len(str(result)) == 1:
   print(" --- DONE ---")
   return "DONE"
  else:
   per(result, steps)


This function, properly written, was recently the subject of a youtube 
math video.  The largest known # of steps is 11.  Did you get it from 
there?




What the program does:
If I run per(X) and X is a multiple of 10, I should end up with 0 in a
finite amount of steps.

The problem:
If I run per(54), I do not get 'DONE' printed through the return
statement.  WRONG!

If I run per(20), I do get 'DONE' printed through the return statement.
CORRECT!

20, 30, etc. are correct.  25, 45, etc. are not.

Is this a bug?

Thanks,
Bassam




--
Terry Jan Reedy

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


What does "TypeError: unsupported operand type(s) for +: 'function' and 'int'" mean?

2019-03-25 Thread CrazyVideoGamez
I have no idea what "TypeError: unsupported operand type(s) for +: 'function' 
and 'int'" means and I don't know how to fix it. Help!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What does "TypeError: unsupported operand type(s) for +: 'function' and 'int'" mean?

2019-03-25 Thread CrazyVideoGamez
On Monday, March 25, 2019, at 3:31:09 PM UTC-4, CrazyVideoGamez wrote:
> I have no idea what "TypeError: unsupported operand type(s) for +: 'function' 
> and 'int'" means and I don't know how to fix it. Help!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.7 Bug

2019-03-25 Thread CrazyVideoGamez
On Monday, March 25, 2019 at 2:07:11 PM UTC-4, Bassam Abdul-Baki wrote:
> Greetings,
> 
> In the following code, there's a bug on certain parameters.
> 
> --
> 
> def per(n, steps = 0):
>  digits = [int(i) for i in str(n)]
>  result = 1
>  for j in digits:
>   result *= j
>  steps += 1
>  print(steps, result, sep=" - ")
>  if result == 0:
>   print(result, str(result), len(str(result)), sep=" - ")
>  if len(str(result)) == 1:
>   print(" --- DONE ---")
>   return "DONE"
>  else:
>   per(result, steps)
> 
> --
> 
> What the program does:
> If I run per(X) and X is a multiple of 10, I should end up with 0 in a
> finite amount of steps.
> 
> The problem:
> If I run per(54), I do not get 'DONE' printed through the return
> statement.  WRONG!
> 
> If I run per(20), I do get 'DONE' printed through the return statement.
> CORRECT!
> 
> 20, 30, etc. are correct.  25, 45, etc. are not.
> 
> Is this a bug?
> 
> Thanks,
> Bassam

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


Re: What does "TypeError: unsupported operand type(s) for +: 'function' and 'int'" mean?

2019-03-25 Thread Rob Gaddi

On 3/25/19 12:30 PM, CrazyVideoGamez wrote:

I have no idea what "TypeError: unsupported operand type(s) for +: 'function' and 
'int'" means and I don't know how to fix it. Help!



It means you can't add (i.e. apply the + operator) a function to an int. 
 Which is only a problem because somewhere in your code, you're asking 
it to do that.  In all likelihood, if you follow the line number 
provided in the traceback, you'll see that somewhere that you planned to 
use the result of calling a function you left out the parentheses and 
are instead using the function itself.


--
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Might be doing this wrong? (Turtle graphics)

2019-03-25 Thread CrazyVideoGamez
On Wednesday, March 20, 2019 at 8:29:42 PM UTC-4, MRAB wrote:
> On 2019-03-21 00:12, DL Neil wrote:
> > Jason,
> > 
> > On 21/03/19 12:34 PM, jasonanyil...@gmail.com wrote:
> >> So, I typed in code:
> >> from turtle import *
> >> forward(100)
> >> right(120)
> >> clear()
> >> It didn't work! It kept on saying that there was an indent and the first 
> >> line was wrong. Help!
> > 
> > 
> > It would be most helpful if you gave us the exact error msg, in the same
> > way that you copy-pasted the source-code.
> > 
> > "Turtle" is not part of the Python 'core'. It has to be added from the
> > Python Standard Library (PSL).
> > 
> > My !GUESS! is that the Turtle library is not (yet) available on your
> > system. Did you first "pip" or otherwise download the library?
> > 
> > (I have, and the code works happily)
> > 
> > WebRefs: (modify to suit the version of Python in-use)
> > https://docs.python.org/3/installing/index.html?highlight=pip
> > https://docs.python.org/3/library/turtle.html
> > 
> It worked for me as written above (Python 3.7, Windows 10).

that's weird
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Might be doing this wrong? (Turtle graphics)

2019-03-25 Thread CrazyVideoGamez
On Wednesday, March 20, 2019, at 7:34:53 PM UTC-4, CrazyVideoGamez wrote:
> So, I typed in code:
> from turtle import *
> forward(100)
> right(120)
> clear()
> It didn't work! It kept on saying that there was an indent and the first line 
> was wrong. Help!

wait no nevermind im such an idiot
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What does "TypeError: unsupported operand type(s) for +: 'function' and 'int'" mean?

2019-03-25 Thread Dan Sommers

On 3/25/19 2:30 PM, CrazyVideoGamez wrote:

I have no idea what "TypeError: unsupported operand type(s) for +: 'function' and 
'int'" means


It means that you're trying to add an int to a function.

> ... and I don't know how to fix it. Help!

Don't do that?

It's possible that with the correct context (copied and
pasted, not just retyped from memory), someone can help
you appropriately.

What version of Python are you using?  What program are
you running?  Is this homework?
--
https://mail.python.org/mailman/listinfo/python-list


Re: Might be doing this wrong? (Turtle graphics)

2019-03-25 Thread Larry Martell
On Mon, Mar 25, 2019 at 3:45 PM CrazyVideoGamez  wrote:
> wait no nevermind im such an idiot

Every programmer I have ever known has said that.
-- 
https://mail.python.org/mailman/listinfo/python-list


Your IDE's?

2019-03-25 Thread John Doe


What is your favorite Python IDE?

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


Re: Your IDE's?

2019-03-25 Thread oliver
Been using IDEs for 30 years (turbopascal anyone?): by far, PyCharm (used
for 5 years so far). Then VS Code (one year). I still use both. Vs Code is
faster to load, uses less mem and has a simplicity about it that is
appealing.

BUT vscode has similar speed to pycharm once started (actually might even
be slower), and although very capable, is not anything as capable as
pycharm when it comes to refactoring, inspections, configurability,
debugging, find/replace, integration with Git (way better than the 2
leading Git plugins for vs code), and various other capabilities you take
for granted in pycharm like finding unused imports, deep integration with
pytest, and many more.

On Mon., Mar. 25, 2019, 17:41 John Doe,  wrote:

>
> What is your favorite Python IDE?
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Your IDE's?

2019-03-25 Thread DL Neil

On 26/03/19 10:38 AM, John Doe wrote:


What is your favorite Python IDE?



In case you are tempted to reply, neither of "John"'s supposed domains 
resolves (to a web site)/has been registered.


--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Might be doing this wrong? (Turtle graphics)

2019-03-25 Thread Grant Edwards
On 2019-03-25, Larry Martell  wrote:
> On Mon, Mar 25, 2019 at 3:45 PM CrazyVideoGamez  
> wrote:
>> wait no nevermind im such an idiot
>
> Every programmer I have ever known has said that.

And never saying that is a 100% reliable indicator that you really are
one...

-- 
Grant Edwards   grant.b.edwardsYow! Boy, am I glad it's
  at   only 1971...
  gmail.com

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


[RELEASE] Python 3.7.3 is now available

2019-03-25 Thread Ned Deily
https://blog.python.org/2019/03/python-373-is-now-available.html

Python 3.7.3 is now available. Python 3.7.3 is the next
maintenance release of Python 3.7, the latest feature release of Python.
You can find Python 3.7.3 here:
   https://www.python.org/downloads/release/python-373/

See the What’s New In Python 3.7 document for more information about the
many new features and optimizations included in the 3.7 series. Detailed
information about the changes made in 3.7.3 can be found in its change log.

Thanks to all of the many volunteers who help make Python Development and
these releases possible! Please consider supporting our efforts by
volunteering yourself or through organization contributions to the Python
Software Foundation.

https://docs.python.org/3.7/whatsnew/3.7.html
https://docs.python.org/3.7/whatsnew/changelog.html#python-3-7-3-final
https://www.python.org/psf/

--
  Ned Deily
  n...@python.org -- []

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


Re: Your IDE's?

2019-03-25 Thread Gene Heskett
On Monday 25 March 2019 18:20:29 DL Neil wrote:

> On 26/03/19 10:38 AM, John Doe wrote:
> > What is your favorite Python IDE?
>
> In case you are tempted to reply, neither of "John"'s supposed domains
> resolves (to a web site)/has been registered.
>
> --
> Regards =dn
your email agent is inventing links? There were none in the single msg I 
got from a john doe. Unless they were buried in the headers that kmail 
doesn't show me..


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

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


Re: Your IDE's?

2019-03-25 Thread Ben Finney
John Doe  writes:

> What is your favorite Python IDE?

The same as my favourite JavaScript IDE, Haskell IDE, and any other
language I need:

Emacs and a shell multiplexer (today, that's GNU Screen, but others
swear that I should try TMux).

An IDE, like all of the tools that we rely on for getting our work done,
should be free software and owned by its community to ensure it's always
meeting its community's needs.

An IDE in particular should handle my programming tasks well regardless
of whether it was designed with that programming language in mind. So a
mature, flexible, extensible, language-agnostic IDE is a must.

Of those available, I know of Vim and GNU Emacs to be the strongest
contenders.

Maybe the Atom editor will get there some day, though for now I hear
many complaints that with many plug-ins active it's just too slow when
doing the kind of complex tasks we expect of a programmer's editor like
Vim or GNU Emacs.

-- 
 \“The reason we come up with new versions is not to fix bugs. |
  `\ It's absolutely not.” —Bill Gates, 1995-10-23 |
_o__)  |
Ben Finney

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


configparser - which one?

2019-03-25 Thread Dave
I use Python3 3, and expected learning how to use configparser would be 
no big deal.  Well!  Seems there is configparser, stdconfigparser, and 
safeconfigparser, and multiple ways to set the section and entries to 
the section.  A little confusing.  I want to future-proof may code, so 
what should I be using?


As for setting the sections and entries, the following both work.

from configparser import ConfigParser   # Python 3 syntax
parser = ConfigParser()

parser['DEFAULT'] = {'Language': 'English',
 'Units': 'English',
 'UseDefaults': 'True',
 'NumberRidesDisplay': '30',
 'Pi': '3.14'}


parser.add_section('Default')
parser.set('default', 'language', 'english')
parser.set('default', 'units_measure', 'english')
parser.set('default', 'background_color', 'white')
parser.set('default', 'useDefaults', 'true')
parser.set('default', 'numToDisp', '12')
parser.set('default', 'pi', '3.14')

The advantage of the former is that it will handle 'DEFAULT', while the 
last one won't.  I like the former, but not sure if it is the future.


Thanks,
Dave
--
https://mail.python.org/mailman/listinfo/python-list


Re: [Python-Dev] [RELEASE] Python 3.7.3 is now available

2019-03-25 Thread Hasan Diwan
Congrats to all for a timely release! -- H

On Mon, 25 Mar 2019 at 17:19, Ned Deily  wrote:

> https://blog.python.org/2019/03/python-373-is-now-available.html
>
> Python 3.7.3 is now available. Python 3.7.3 is the next
> maintenance release of Python 3.7, the latest feature release of Python.
> You can find Python 3.7.3 here:
>https://www.python.org/downloads/release/python-373/
>
> See the What’s New In Python 3.7 document for more information about the
> many new features and optimizations included in the 3.7 series. Detailed
> information about the changes made in 3.7.3 can be found in its change log.
>
> Thanks to all of the many volunteers who help make Python Development and
> these releases possible! Please consider supporting our efforts by
> volunteering yourself or through organization contributions to the Python
> Software Foundation.
>
> https://docs.python.org/3.7/whatsnew/3.7.html
> https://docs.python.org/3.7/whatsnew/changelog.html#python-3-7-3-final
> https://www.python.org/psf/
>
> --
>   Ned Deily
>   n...@python.org -- []
>
> ___
> Python-Dev mailing list
> python-...@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/hasan.diwan%40gmail.com
>


-- 
OpenPGP:
https://sks-keyservers.net/pks/lookup?op=get&search=0xFEBAD7FFD041BBA1
If you wish to request my time, please do so using
*bit.ly/hd1AppointmentRequest
*.
Si vous voudrais faire connnaisance, allez a *bit.ly/hd1AppointmentRequest
*.

Sent
from my mobile device
Envoye de mon portable
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Might be doing this wrong? (Turtle graphics)

2019-03-25 Thread MRAB

On 2019-03-25 22:38, Grant Edwards wrote:

On 2019-03-25, Larry Martell  wrote:

On Mon, Mar 25, 2019 at 3:45 PM CrazyVideoGamez  wrote:

wait no nevermind im such an idiot


Every programmer I have ever known has said that.


And never saying that is a 100% reliable indicator that you really are
one...


Or you haven't been programming for long.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Your IDE's?

2019-03-25 Thread DL Neil

On 26/03/19 12:55 PM, Gene Heskett wrote:

On Monday 25 March 2019 18:20:29 DL Neil wrote:


On 26/03/19 10:38 AM, John Doe wrote:

What is your favorite Python IDE?


In case you are tempted to reply, neither of "John"'s supposed domains
resolves (to a web site)/has been registered.

--
Regards =dn

your email agent is inventing links? There were none in the single msg I
got from a john doe. Unless they were buried in the headers that kmail
doesn't show me..


The invention is not mine: aside from his name, have a look at the OP's 
purported email address, and his requested ReplyTo: address. Then check 
the veracity of those domainNMs...


--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Your IDE's?

2019-03-25 Thread Spencer Graves



On 2019-03-25 18:55, Gene Heskett wrote:

On Monday 25 March 2019 18:20:29 DL Neil wrote:


On 26/03/19 10:38 AM, John Doe wrote:

What is your favorite Python IDE?

In case you are tempted to reply, neither of "John"'s supposed domains
resolves (to a web site)/has been registered.

--
Regards =dn

your email agent is inventing links? There were none in the single msg I
got from a john doe. Unless they were buried in the headers that kmail
doesn't show me..



  The original email was "From John Doe ", with a 
"Reply to John Doe ".  "Doe.com" is a URL being 
advertised for sale for $150,000.  "ping something.com" returns, "cannot 
resolve something.com:  Unknown host".



  Clearly the original poster is playing games with us.


      Spencer


Cheers, Gene Heskett


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


Re: configparser - which one?

2019-03-25 Thread DL Neil

Dave,


On 26/03/19 1:10 PM, Dave wrote:
I use Python3 3, and expected learning how to use configparser would be 
no big deal.  Well!  Seems there is configparser, stdconfigparser, and 
safeconfigparser, and multiple ways to set the section and entries to 
the section.  A little confusing.  I want to future-proof may code, so 
what should I be using?



(with apologies for not answering the question directly)

After striking this problem, I was encouraged to take a look at JSON, 
and thence YAML. Once there, as they say, didn't look back!

- multi-dimensional possibilities, cf .ini
- similarity/correspondence with Python data structures
- convenient PSL
- easily adopted by (power-)users, cf Python code


WebRefs:

- similar Q: 
https://stackoverflow.com/questions/5055042/whats-the-best-practice-using-a-settings-file-in-python


- article: https://martin-thoma.com/configuration-files-in-python/

- similar discussion: 
https://stackoverflow.com/questions/3085029/pros-and-cons-for-different-configuration-formats


--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: configparser - which one?

2019-03-25 Thread Dave

On 3/25/19 10:58 PM, DL Neil wrote:

Dave,


On 26/03/19 1:10 PM, Dave wrote:
I use Python3 3, and expected learning how to use configparser would 
be no big deal.  Well!  Seems there is configparser, stdconfigparser, 
and safeconfigparser, and multiple ways to set the section and entries 
to the section.  A little confusing.  I want to future-proof may code, 
so what should I be using?



(with apologies for not answering the question directly)

After striking this problem, I was encouraged to take a look at JSON, 
and thence YAML. Once there, as they say, didn't look back!

- multi-dimensional possibilities, cf .ini
- similarity/correspondence with Python data structures
- convenient PSL
- easily adopted by (power-)users, cf Python code


WebRefs:

- similar Q: 
https://stackoverflow.com/questions/5055042/whats-the-best-practice-using-a-settings-file-in-python 



- article: https://martin-thoma.com/configuration-files-in-python/

- similar discussion: 
https://stackoverflow.com/questions/3085029/pros-and-cons-for-different-configuration-formats 



Wish I could do that.  Customer wants .ini.  I would need to sell them 
on an alternative.  The issue is human readable - .ini is easier for 
people to understand.


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


Re: configparser - which one?

2019-03-25 Thread Cameron Simpson

On 25Mar2019 23:24, Dave  wrote:

On 3/25/19 10:58 PM, DL Neil wrote:

On 26/03/19 1:10 PM, Dave wrote:
I use Python3 3, and expected learning how to use configparser 
would be no big deal.  Well!  Seems there is configparser, 
stdconfigparser, and safeconfigparser, and multiple ways to set 
the section and entries to the section.  A little confusing.  I 
want to future-proof may code, so what should I be using?



(with apologies for not answering the question directly)

After striking this problem, I was encouraged to take a look at 
JSON, and thence YAML. Once there, as they say, didn't look back!

- multi-dimensional possibilities, cf .ini
- similarity/correspondence with Python data structures
- convenient PSL
- easily adopted by (power-)users, cf Python code

[...]


Wish I could do that.  Customer wants .ini.  I would need to sell them 
on an alternative.  The issue is human readable - .ini is easier for 
people to understand.


And I agree with the customer, absent more info. Unless you need deeply 
nested stuff, .ini is much easier for humans to read. Not everything is 
a match for it (unless you start playing games with 
"[clause.subclause.subsubclause]" stuff, which I'd argue is a smell 
indicating a format change might be good).


But for stuff which does fit nicely into .ini, it is FAR FAR easier on 
the reader. Like JSON, YAML etc are far far easier than XML for the 
reader.


Lots of stuff, particularly simple configs, go well in .ini.

All that opinion aside: just use the configparser.ConfigParser class. It 
is what _used_ to be "SafeConfigParser" in Python 2.


Here endith the lesson.

Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


The Mailing List Digest Project

2019-03-25 Thread Abdur-Rahmaan Janhangeer
As proposed on python-ideas, i setup a repo to turn mail threads into
articles.

here is the repo

https://github.com/Abdur-rahmaanJ/py-mailing-list-summary

i included a script to build .md to .html (with syntax highlighting) here
is the index

https://abdur-rahmaanj.github.io/py-mailing-list-summary/

included 3 articles as a start

if you want to contribute an article, just follow existing .md format and
put it in the .md folder

planning to go across ideas, list and dev

i can tell you, it's a really enjoyable experience.

psst. we can enhance some html later

-- 
Abdur-Rahmaan Janhangeer
Mauritius
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Your IDE's?

2019-03-25 Thread Gene Heskett
On Monday 25 March 2019 22:14:48 Spencer Graves wrote:

> On 2019-03-25 18:55, Gene Heskett wrote:
> > On Monday 25 March 2019 18:20:29 DL Neil wrote:
> >> On 26/03/19 10:38 AM, John Doe wrote:
> >>> What is your favorite Python IDE?
> >>
> >> In case you are tempted to reply, neither of "John"'s supposed
> >> domains resolves (to a web site)/has been registered.
> >>
> >> --
> >> Regards =dn
> >
> > your email agent is inventing links? There were none in the single
> > msg I got from a john doe. Unless they were buried in the headers
> > that kmail doesn't show me..
>
>    The original email was "From John Doe ", with a
> "Reply to John Doe ".  "Doe.com" is a URL being
> advertised for sale for $150,000.  "ping something.com" returns,
> "cannot resolve something.com:  Unknown host".
>
>
>    Clearly the original poster is playing games with us.
>
>
And that, like excrement, happens. Sooner if you eat regularly. :-)

>        Spencer
>
> > Cheers, Gene Heskett


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

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


Re: Your IDE's?

2019-03-25 Thread Gene Heskett
On Monday 25 March 2019 22:24:14 DL Neil wrote:

> On 26/03/19 12:55 PM, Gene Heskett wrote:
> > On Monday 25 March 2019 18:20:29 DL Neil wrote:
> >> On 26/03/19 10:38 AM, John Doe wrote:
> >>> What is your favorite Python IDE?
> >>
> >> In case you are tempted to reply, neither of "John"'s supposed
> >> domains resolves (to a web site)/has been registered.
> >>
> >> --
> >> Regards =dn
> >
> > your email agent is inventing links? There were none in the single
> > msg I got from a john doe. Unless they were buried in the headers
> > that kmail doesn't show me..
>
> The invention is not mine: aside from his name, have a look at the
> OP's purported email address, and his requested ReplyTo: address. Then
> check the veracity of those domainNMs...
>
I only rarely do so as I can usually detect such from the pull on my 
leg. :)

> --
> Regards =dn


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

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