RE: What this error want to say? Can't we use return without function?

2020-09-08 Thread Schachner, Joseph
I see. You didn't declare a function, it's just a python script. So you don't 
need a return in that situation, the script just ends when there are no more 
lines.

By the way: you certainly don't want to return or quit BEFORE you print(nice).  
 But the fix here is simply to delete "return coun".  Then your script will run.

--- Joseph S.

-Original Message-
From: Shivlal Sharma  
Sent: Monday, September 7, 2020 3:09 AM
To: python-list@python.org
Subject: What this error want to say? Can't we use return without function?

N = int(input("enter a positive integer:")) coun = 1 while (N > 0):
coun = coun * N
N = N - 1
return coun
nice = ntime(N)
print(nice)


error: return outside of the function

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


newbie

2020-09-08 Thread Don Edwards
Purchased the book python-basics-2020-05-18.pdf a few days ago.
To direct my learning I have a project in mind as per below;

Just started learning python 3.8. At 76 I will be a bit slow but
fortunately decades ago l learnt pascal. I am not asking programming help
just guidance toward package(s) I may need. My aim is to write a program
that simulates croquet - 2 balls colliding with the strikers (cue) ball
going into the hoop (pocket), not the target ball. I want to be able to
move the balls around and draw trajectory lines to evaluate different
positions. Is there a package for this or maybe one to draw and one to
move? Any help much appreciated.

-- 
Regards, Don Edwards
I aim to live forever - or die in the attempt. So far so good!
Perth Western Australia
-- 
https://mail.python.org/mailman/listinfo/python-list


Fwd: PYTHON BUG. deleting elements of list.

2020-09-08 Thread Driuma Nikita
    
    
    Пересылаемое сообщение 
   08.09.2020, 01:43, "python-list-ow...@python.org"
   :
    

   Hello! I see you want to post a message to the Python List. We would
   be happy to help, but you must subscribe first:

     [1]https://mail.python.org/mailman/listinfo/python-list

   After you have subscribed, please send your message to
   [2]python-list@python.org again. Please do not include images as this is
   a text-only forum -- instead, copy/paste or transcribe the information
   from the image that you want us to know.

   Alternatively, this list is mirrored both ways with the
   comp.lang.python newsgroup (news:comp.lang.python).

   Some people find it easier to follow this and other lists via gmane
   ([3]http://news.gmane.org/gmane.comp.python.general), a service which
   offers a newsgroup interface to many online mailing lists.

   *NB all posts to the mailing list are publicly archived at:*

     [4]https://mail.python.org/pipermail/python-list

    

    
    Конец пересылаемого сообщения 
    
    
   With Regards.
   Python is best.
    

References

   Visible links
   1. https://mail.python.org/mailman/listinfo/python-list
   2. mailto:python-list@python.org
   3. http://news.gmane.org/gmane.comp.python.general
   4. https://mail.python.org/pipermail/python-list
--- Begin Message ---
   Hello, python creators and bug fixers.
   I have same strange Basic-type problem time after time.
   Deleting elements of lists - is Basic of basics thing. And i can't count
   on it. It doesn't work in some cases.
   I found a simple example, and example of my problem - to modify the string
   data that i got from parsing internet, web-data - this is the case i got
   the problem.
    
   Simple Example 1.
   I expect to delete all/any elements by index from list by using del,
   .remove(), pop() - it must work as usually. But that doesn't happens.

 _list = list(range(50))
 for i, el in enumerate(_list):
     del _list[i]
 print(_list)

   result:

 # [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35,
 37, 39, 41, 43, 45, 47, 49]

   Same for pop(i) and remove(el).
    
   Works only filter(), creating new _list2 with .append()
   , with SAME IF-statements - as for delete.(thats for Example 2 and problem
   i met with)
    
   Example 2.
   I got a string from parsing something from internet. This is a body of one
   message from my Gmail this time.
   And there is no any way to delete empty elements in existing list to
   pretty the final output-data.
   Sometimes it deletes random elements, but not all. Sometimes deletes
   nothing.
   Another diagnose - tried to take len() of of each element, and it says 0
   to non zero elements.
   The only solution is to create a new list and append needed items instead
   of delete non-needed in first-list.
    
   There are many EMPTY elements. I do .split("'r\n") and trying to run a
   FOR-cycle.
   The list example:
   ['Вы вошли в аккаунт Google с нового Xiaomi HM Note 2', '', '', '', 'Для
   завершения настройки установите официальные приложения от Google.', '',
   '', 'Google Sheets', '', 'Google Sheets', '', 'Создавайте таблицы и
   работайте над ними вместе', '', '4.5/5 Stars', '', '', '', '', '',
   'СКАЧАТЬ', '', '', '', '', '', '', '', 'Google Calendar', '', 'Google
   Calendar', '', 'Все ваши календари, мероприятия и встречи в одном
   приложении', '', '', '', '', '', '', '', 'СКАЧАТЬ', '', '', '', '', '',
   '', '', 'Google Duo', '', 'Google Duo', '', 'Проводите видеовстречи с
   высоким качеством изображения', '', '4.5/5 Stars', '', '', '', '', '',
   'СКАЧАТЬ', '', '', '', '', '', '', '', 'Не отвечайте на это письмо. Вы
   получили это сообщение, так как недавно  ', 'активировали свой аккаунт
   Google на Xiaomi HM Note 2.', '', '', '', '© 2018 Google LLC 1600
   Amphitheatre Parkway, Mountain View, CA 94043, USA', '', '', '', '',
   '—', '', '', '', '']
   With Regards.
--- End Message ---
-- 
https://mail.python.org/mailman/listinfo/python-list


Opening python

2020-09-08 Thread Rnyx_ Scarl01
Hello I've downloaded the newest python but I can't find the python
compiler app eventhough I've already downloaded tge necessary files. What
shoukd I do?
-- 
https://mail.python.org/mailman/listinfo/python-list


[RELEASE] Python 3.8.6rc1 is now ready for testing

2020-09-08 Thread Łukasz Langa
Python 3.8.6rc1 is the release candidate of the sixth maintenance release of 
Python 3.8. Go get it here:

https://www.python.org/downloads/release/python-386rc1/ 


Assuming no critical problems are found prior to 2020-09-21, the scheduled 
release date for 3.8.6, no code changes are planned between this release 
candidate and the final release.

That being said, please keep in mind that this is a pre-release and as such its 
main purpose is testing.

Maintenance releases for the 3.8 series will continue at regular bi-monthly 
intervals, with 3.8.7 planned for mid-November 2020.

What’s new?

The Python 3.8 series is the newest feature release of the Python language, and 
it contains many new features and optimizations. See the “What’s New in Python 
3.8 ” document for more 
information about features included in the 3.8 series.

Python 3.8 is becoming more stable. Our bugfix releases are becoming smaller as 
we progress. This one contains 80 changes, not even a half of what we got in 
3.8.4 (the following release was a hotfix). Detailed information about all 
changes made in version 3.8.6 specifically can be found in its change log 
.

We hope you enjoy Python 3.8!

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.

Your friendly release team,
Ned Deily @nad 
Steve Dower @steve.dower 
Łukasz Langa @ambv 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Opening python

2020-09-08 Thread Mats Wichmann
On 9/7/20 11:33 PM, Rnyx_ Scarl01 wrote:
> Hello I've downloaded the newest python but I can't find the python
> compiler app eventhough I've already downloaded tge necessary files. What
> shoukd I do?


What have you tried?

And what platform are you on?  This is mildly more involved on Windows.


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


Re: Fwd: PYTHON BUG. deleting elements of list.

2020-09-08 Thread Mats Wichmann
On 9/7/20 5:01 PM, Driuma Nikita wrote:


 _list = list(range(50))
 for i, el in enumerate(_list):
 del _list[i]
 print(_list)


Don't change the the list while you are iterating over it, it messes up
the iteration. It's not "randomly deleting", it's when next is called to
fetch the next item, the list has changed.

One workaround is to iterate over a copy. For example here's using
slicing to create a new list to iterate over:

for i, el in enumerate(_list[:]):
 del _list[i]

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


Re: Fwd: PYTHON BUG. deleting elements of list.

2020-09-08 Thread Richard Damon
On 9/8/20 7:06 PM, Mats Wichmann wrote:
> On 9/7/20 5:01 PM, Driuma Nikita wrote:
>
>
>  _list = list(range(50))
>  for i, el in enumerate(_list):
>  del _list[i]
>  print(_list)
>
>
> Don't change the the list while you are iterating over it, it messes up
> the iteration. It's not "randomly deleting", it's when next is called to
> fetch the next item, the list has changed.
>
> One workaround is to iterate over a copy. For example here's using
> slicing to create a new list to iterate over:
>
> for i, el in enumerate(_list[:]):
>  del _list[i]
>
The issue isn't so much that he is modifying the list that he is
iterating over, but also when he deletes _list[0], all the other
elements move down, so the next time when he does a del _list[1], that
will delete what started as _list[2], and with your code, when he gets
half way done he will hit an index error as he tries to delete _list[26]
from a list with only 25 elements.

-- 
Richard Damon

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


Re: Opening python

2020-09-08 Thread Cameron Simpson
On 08Sep2020 12:33, Rnyx_ Scarl01  wrote:
>Hello I've downloaded the newest python but I can't find the python
>compiler app eventhough I've already downloaded tge necessary files. What
>shoukd I do?

After a download it is normally necessary to run the installer.

Python is an interpreted language; the compiler phase runs as an 
automatic component of interpreting a Python script.

If there isn't an obvious installer, or you've run the installer but 
still cannot invoke Python, we need more detail:

- what did you download, and from where?

- what operating system are you using?

- what have you done with the download so far?

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


Re: newbie

2020-09-08 Thread Cameron Simpson
On 08Sep2020 10:22, Don Edwards  wrote:
>Purchased the book python-basics-2020-05-18.pdf a few days ago.
>To direct my learning I have a project in mind as per below;

A project is an excellent way to learn something; personally I find it 
hard to learn something without something to which to apply it.

>Just started learning python 3.8. At 76 I will be a bit slow but
>fortunately decades ago l learnt pascal.

Aye; I find Python has a very similar "heft" to Pascal - nicely English 
language like "prose" syntax.

>I am not asking programming help
>just guidance toward package(s) I may need. My aim is to write a program
>that simulates croquet - 2 balls colliding with the strikers (cue) ball
>going into the hoop (pocket), not the target ball. I want to be able to
>move the balls around and draw trajectory lines to evaluate different
>positions. Is there a package for this or maybe one to draw and one to
>move? Any help much appreciated.

Python ships with a "tkinter" module which lets you define a GUI 
interface. You probably want some kind of "canvas" or "image" widget 
from within that to render your playing field diagrams/visualisations.

Someone else will have to speak to a nice geometry package for simple 3d 
renders and lines/angles etc.

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


Re: newbie

2020-09-08 Thread Grant Edwards
On 2020-09-08, Don Edwards  wrote:

> I may need. My aim is to write a program
> that simulates croquet - 2 balls colliding with the strikers (cue) ball
> going into the hoop (pocket), not the target ball. I want to be able to
> move the balls around and draw trajectory lines to evaluate different
> positions. Is there a package for this or maybe one to draw and one to
> move? Any help much appreciated.

Is pygame still a thing?

--
Grant


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


Module exists and cannot be found

2020-09-08 Thread James Moe via Python-list
python 3.6.10
opensuse tumbleweed
linux 5.8.4

An old program based on Python (BackInTime) has recently been having
difficulties functioning. See below.

Module PyQt5 is most definitely installed. Apparently there is more to getting
modules loaded than there used to be.

(Also, I am not familiar with Python.)

[ error message (verbose option) ]
Traceback (most recent call last):
  File "/home/jmoe/diy/backintime-master/qt/app.py", line 35, in 
import qttools
  File "", line 971, in _find_and_load
  File "", line 955, in _find_and_load_unlocked
  File "", line 665, in _load_unlocked
  File "", line 678, in exec_module
  File "", line 219, in _call_with_frames_removed
  File "/home/jmoe/diy/backintime-master/qt/qttools.py", line 21, in 
from PyQt5.QtGui import (QFont, QColor, QKeySequence)
  File "", line 971, in _find_and_load
  File "", line 941, in _find_and_load_unlocked
  File "", line 219, in _call_with_frames_removed
  File "", line 971, in _find_and_load
  File "", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'PyQt5'
[ end ]

[ the 1st code lines causing the above ]
qttools.py:
  import os
  import sys
  import gettext
  from PyQt5.QtGui import (QFont, QColor, QKeySequence) <<<-- line 21
  ...

app.py:
  import os
  import sys

  if not os.getenv('DISPLAY', ''):
os.putenv('DISPLAY', ':0.0')

  import datetime
  import gettext
  import re
  import subprocess
  import shutil
  import signal
  from contextlib import contextmanager
  from tempfile import TemporaryDirectory

  import qttools<<<--- line 35
  qttools.registerBackintimePath('common')
  ...
[ end ]

-- 
James Moe
jmm-list at sohnen-moe dot com
Think.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: newbie

2020-09-08 Thread Cameron Simpson
On 09Sep2020 01:24, Grant Edwards  wrote:
>On 2020-09-08, Don Edwards  wrote:
>> I may need. My aim is to write a program
>> that simulates croquet - 2 balls colliding with the strikers (cue) ball
>> going into the hoop (pocket), not the target ball. I want to be able to
>> move the balls around and draw trajectory lines to evaluate different
>> positions. Is there a package for this or maybe one to draw and one to
>> move? Any help much appreciated.
>
>Is pygame still a thing?

Looks like:

https://pypi.org/project/pygame/
https://pypi.org/project/pygame-geometry/

Don, there's a "Getting Started" page for Pygame here:

https://www.pygame.org/wiki/GettingStarted

including some platform specific notes.

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


Re: Fwd: PYTHON BUG. deleting elements of list.

2020-09-08 Thread Peter Otten
Mats Wichmann wrote:

> On 9/7/20 5:01 PM, Driuma Nikita wrote:
> 
> 
>  _list = list(range(50))
>  for i, el in enumerate(_list):
>  del _list[i]
>  print(_list)
> 
> 
> Don't change the the list while you are iterating over it, it messes up
> the iteration. It's not "randomly deleting", it's when next is called to
> fetch the next item, the list has changed.
> 
> One workaround is to iterate over a copy. For example here's using
> slicing to create a new list to iterate over:
> 
> for i, el in enumerate(_list[:]):
>  del _list[i]

As Richard says, this won't work. 
Usually the best approach is to copy the items you want to keep:

_list = [item for item in _list if keep(item)]

If the list is huge you can also delete in reverse order:

for i in reversed(len(_list)):
if discard(_list[i]):
del _list[i]

(If you want to delete /all/ items use _list.clear() or del _list[:])


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