ANN: distlib 0.3.2 released on PyPI

2021-05-31 Thread Vinay Sajip via Python-list
I've recently released version 0.3.2 of distlib on PyPI [1]. For newcomers,
distlib is a library of packaging functionality which is intended to be
usable as the basis for third-party packaging tools.

The main changes in this release are as follows:

* Fixed #139: improved handling of errors related to the test PyPI server.

* Fixed #140: allowed "Obsoletes" in more scenarios, to better handle faulty
  metadata already on PyPI.

* Fixed #141: removed unused regular expression.

* Fixed #143: removed normcase() to avoid some problems on Windows.

* Fixed #146: added entry for SourcelessFileLoader to the finder registry.

* Fixed #147: permission bits are now preserved on POSIX when installing from a 
wheel.

* Made the generation of scripts more configurable.

* Added support for manylinux wheel tags.

A more detailed change log is available at [2].

Please try it out, and if you find any problems or have any suggestions for 
improvements,
please give some feedback using the issue tracker! [3]

Regards,

Vinay Sajip

[1] https://pypi.org/project/distlib/0.3.2/
[2] https://distlib.readthedocs.io/en/0.3.2/
[3] https://bitbucket.org/pypa/distlib/issues/new
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Definition of "property"

2021-05-31 Thread Jon Ribbens via Python-list
On 2021-05-30, Terry Reedy  wrote:
> Note: at least one person says a property *pretends* to be an attribute. 

No, I said it pretends to be a *data* attribute. It is effectively
several methods in a trenchcoat pretending to be a variable.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Definition of "property"

2021-05-31 Thread Alan Gauld via Python-list
On 30/05/2021 23:57, Mike Dewhirst wrote:

> 
> A property is an object method masquerading as a cachable object attribute

Or a group of methods perhaps?

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


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


python 3.9.5

2021-05-31 Thread said ganoune
Hi
Just installed python 3.9.5 in my HP laptop, cant open it.
Laptop hp I3 running with windows 10.

Thank you


Sent from Mail for Windows 10

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


Re: Definition of "property"

2021-05-31 Thread Greg Ewing

On 31/05/21 8:20 am, Alan Gauld wrote:


That's a very Pythonic description.


If it's a book about Python, it needs to be. The word "property"
has a very specialised meaning in Python.

In some other languages it's used the way we use "attribute" in
Python. So a Python-specific definition is necessarily going
to be very different from a generic one.

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


Re: Definition of "property"

2021-05-31 Thread Greg Ewing

On 31/05/21 4:57 am, Irv Kalb wrote:

Perhaps the best I've found so far is from the Python documentation:

A property object has getter, setter, and deleter methods usable as decorators 
that create a copy of the property with the corresponding accessor function set 
to the decorated function.


That's not a definition of a property -- it's talking about a
mechanism that provides one way of creating a property, using
decorators. DON'T quote that as a definition!

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


Re: Definition of "property"

2021-05-31 Thread Greg Ewing

On 31/05/21 9:13 am, Jon Ribbens wrote:

No, I said it pretends to be a *data* attribute.


I don't think it's pretending to be anything. From the outside,
it's just an attribute.

Data attributes are more common than non-data attributes, so
we tend to assume that an attribute is a data attribute until
told otherwise. But that's just our psychological bias, not
because of any pretence on the part of properties.

Also, there's a sense in which *all* attributes are properties.
At the lowest level, all attribute accesses end up calling
a method. It's just that in most cases the method is implemented
in C and it looks up a value in the object's dict.

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


EuroPython 2021: Session List Available

2021-05-31 Thread Marc-Andre Lemburg
Our program work group (WG) has been working hard over the last week to
select sessions for EuroPython 2021, based on your talk voting and our
diversity criteria.

We’re now happy to announce the initial list with more than 100
sessions, brought to you by more than 100 speakers.

   * EuroPython 2021 Session List *

 https://ep2021.europython.eu/events/sessions/


More than 130 sessions
--

In the coming weeks, we will complete the session list, adding keynotes,
sponsored talks and training sessions. Once finalized, we expect to have
more than 130 sessions waiting for, including three lightning talk
slots, six keynotes, a recruiting session and several free sponsored
training sessions.

The program work group will start working on the schedule, which should
be ready in about two weeks.

Conference Tickets
--

Conference tickets are available on our registration page. We have
several ticket types available to make the conference affordable for
everyone and we're also offering financial aid to increase our reach
even more.

https://ep2021.europython.eu/registration/buy-tickets/
https://ep2021.europython.eu/registration/financial-aid/

As always, all proceeds from the conference will go into our grants
budget, which we use to fund financial aid for the next EuroPython
edition, special workshops and other European conferences and projects:

  * EuroPython Society Grants Program *

 https://www.europython-society.org/grants


We hope to see lots of you at the conference in July. Rest assured that
we’ll make this a great event again — even within the limitations of
running the conference online.


Quick Summary
-
EuroPython 2021 will be run online from July 26 - August 1:

- Two workshop/training days (July 26 - 27)
- Three conference days (July 28 - 30)
- Two sprint days (July 31 - August 1)

The sessions will be scheduled to ensure they are also accessible for
those in the Asian and Americas time zones.


Help spread the word


Please help us spread this message by sharing it on your social
networks as widely as possible. Thank you !

Link to the blog post:

https://blog.europython.eu/europython-2020-initial-session-list-available/

Tweet:

https://twitter.com/europython/status/1399357596117708812

Enjoy,
--
EuroPython 2021 Team
https://ep2021.europython.eu/
https://www.europython-society.org/

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


Functions as Enum member values

2021-05-31 Thread Colin McPhail via Python-list
Hi,

According to the enum module's documentation an Enum-based enumeration's 
members can have values of any type:

"Member values can be anything: int, str, etc.."

I defined one with functions as member values. This seemed to work as long as 
the functions were defined ahead of the enumeration's definition. However I 
then noticed that my enumeration class was a bit weird: even although I could 
reference the enumeration's members individually by name I couldn't iterate 
through the members in the normal fashion - it seemed to have no members. Also, 
calling type() on a member gave the result  instead of the 
expected .

I am using Python 3.9.5 from python.org on macOS 11.4. Below is a small test 
script and its output. Are my expectations wrong or is there a problem with 
Enum?

Regards,
Colin

---
from enum import Enum

def connect_impl():
print("message from connect_impl()")

def help_impl():
print("message from help_impl()")

class Command1(Enum):
CONNECT = 1
HELP = 2

class Command2(Enum):
CONNECT = connect_impl
HELP = help_impl

if __name__ == "__main__":

def print_enum(cls, mbr):
print(f"{cls.__name__}\n  type(): {type(Command1)}")
print(f"  type of enum member: {type(mbr)}")
print(f"  number of members: {len(cls)}")
print("  enum members:")
if len(cls) > 0:
for c in cls:
print(f"{c}")
else:
print("")
print(f"  dir(): {dir(cls)}")

member_1 = Command1.HELP
print_enum(Command1, member_1)
print()

member_2 = Command2.HELP
print_enum(Command2, member_2)
print()
print("call Command2 member: ", end="")
member_2()
print()

---
(qt6) % python3 try_enum.py
Command1
  type(): 
  type of enum member: 
  number of members: 2
  enum members:
Command1.CONNECT
Command1.HELP
  dir(): ['CONNECT', 'HELP', '__class__', '__doc__', '__members__', 
'__module__']

Command2
  type(): 
  type of enum member: 
  number of members: 0
  enum members:

  dir(): ['__class__', '__doc__', '__members__', '__module__']

call Command2 member: message from help_impl()

(qt6) % 
---

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


Re: Functions as Enum member values

2021-05-31 Thread Peter Otten

On 31/05/2021 17:57, Colin McPhail via Python-list wrote:

Hi,

According to the enum module's documentation an Enum-based enumeration's 
members can have values of any type:

"Member values can be anything: int, str, etc.."


You didn't read the fineprint ;)

"""
The rules for what is allowed are as follows: names that start and end 
with a single underscore are reserved by enum and cannot be used; all 
other attributes defined within an enumeration will become members of 
this enumeration, with the exception of special methods (__str__(), 
__add__(), etc.), descriptors (methods are also descriptors), and 
variable names listed in _ignore_



Functions written in Python are descriptors and therefore cannot be 
used. Builtin functions aren't, leading to the following somewhat 
surprising difference:


>>> def foo(self): print("foo")

>>> class A(Enum):
x = foo  # foo.__get__ exists -> foo is a descriptor
 # the enum library assumes you are adding a
 # method to your
 # class, not an enumeration value.

y = sum  # no sum.__get__ attribute -> function
 # treated as an enumeration value.

>>> list(A)
[>]
>>> A.x

>>> A.y
>
>>> A.y.x()
foo


I defined one with functions as member values. This seemed to work as long as the functions 
were defined ahead of the enumeration's definition. However I then noticed that my 
enumeration class was a bit weird: even although I could reference the enumeration's 
members individually by name I couldn't iterate through the members in the normal fashion - 
it seemed to have no members. Also, calling type() on a member gave the result  instead of the expected .

I am using Python 3.9.5 from python.org on macOS 11.4. Below is a small test 
script and its output. Are my expectations wrong or is there a problem with 
Enum?

Regards,
Colin

---
from enum import Enum

def connect_impl():
 print("message from connect_impl()")

def help_impl():
 print("message from help_impl()")

class Command1(Enum):
 CONNECT = 1
 HELP = 2

class Command2(Enum):
 CONNECT = connect_impl
 HELP = help_impl

if __name__ == "__main__":

 def print_enum(cls, mbr):
 print(f"{cls.__name__}\n  type(): {type(Command1)}")
 print(f"  type of enum member: {type(mbr)}")
 print(f"  number of members: {len(cls)}")
 print("  enum members:")
 if len(cls) > 0:
 for c in cls:
 print(f"{c}")
 else:
 print("")
 print(f"  dir(): {dir(cls)}")

 member_1 = Command1.HELP
 print_enum(Command1, member_1)
 print()

 member_2 = Command2.HELP
 print_enum(Command2, member_2)
 print()
 print("call Command2 member: ", end="")
 member_2()
 print()

---
(qt6) % python3 try_enum.py
Command1
   type(): 
   type of enum member: 
   number of members: 2
   enum members:
 Command1.CONNECT
 Command1.HELP
   dir(): ['CONNECT', 'HELP', '__class__', '__doc__', '__members__', 
'__module__']

Command2
   type(): 
   type of enum member: 
   number of members: 0
   enum members:
 
   dir(): ['__class__', '__doc__', '__members__', '__module__']

call Command2 member: message from help_impl()

(qt6) %
---




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


Re: Functions as Enum member values

2021-05-31 Thread Colin McPhail via Python-list



> On 31 May 2021, at 18:24, Peter Otten <__pete...@web.de> wrote:
> 
> On 31/05/2021 17:57, Colin McPhail via Python-list wrote:
>> Hi,
>> According to the enum module's documentation an Enum-based enumeration's 
>> members can have values of any type:
>>  "Member values can be anything: int, str, etc.."
> 
> You didn't read the fineprint ;)
> 
Ah, neither I did.

> """
> The rules for what is allowed are as follows: names that start and end with a 
> single underscore are reserved by enum and cannot be used; all other 
> attributes defined within an enumeration will become members of this 
> enumeration, with the exception of special methods (__str__(), __add__(), 
> etc.), descriptors (methods are also descriptors), and variable names listed 
> in _ignore_
> 
> 
> Functions written in Python are descriptors and therefore cannot be used. 
> Builtin functions aren't, leading to the following somewhat surprising 
> difference:
> 
> >>> def foo(self): print("foo")
> 
> >>> class A(Enum):
>   x = foo  # foo.__get__ exists -> foo is a descriptor
> # the enum library assumes you are adding a
> # method to your
> # class, not an enumeration value.
> 
>   y = sum  # no sum.__get__ attribute -> function
> # treated as an enumeration value.
> 
> >>> list(A)
> [>]
> >>> A.x
> 
> >>> A.y
> >
> >>> A.y.x()
> foo
> 
Thank you for explaining it.

Regards,
Colin

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


Farewell, for now :)

2021-05-31 Thread Kyle Stanley
Hi all,

Last week, I started a new thread on discuss.python.org
 about my
intention to take a further extended break from open source to continue my
mental health healing process. Just wanted to announce it in the other
channels as well since I know that not everyone has the bandwidth to keep
up with more than just the MLs.

In the thread, I discussed my intention to pursue the path of becoming a
Buddhist monk for some time, and recently detailed my adventures at a local
Thai temple. Check it out if you are interested. :)

With Loving Regards,
-- 
--Kyle R. Stanley, Python Core Developer (what is a core dev?
)
*Pronouns: they/them **(why is my pronoun here?*

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


Re: Definition of "property"

2021-05-31 Thread Irv Kalb



> On May 30, 2021, at 10:15 AM, Jon Ribbens via Python-list 
>  wrote:
> 
> On 2021-05-30, Irv Kalb  wrote:
>> I understand what a "property" is, how it is used and the benefits,
>> but apparently my explanation hasn't made the light bulb go on for my
>> editor.  The editor is asking for a definition of property.  I've
>> looked at many articles on line and a number of books, and I haven't
>> found an appropriate one yet.
>> 
>> I have written some good examples of how it works, but I agree that a
>> definition up front would be helpful.  I have tried a number of times,
>> but my attempts to define it have not been clear.  Perhaps the best
>> I've found so far is from the Python documentation:  
>> 
>> A property object has getter, setter, and deleter methods usable as
>> decorators that create a copy of the property with the corresponding
>> accessor function set to the decorated function. 
> 
> A property is an attribute of a class that pretends to be a data
> attribute but in fact causes methods to be called when it is
> accessed.

Thank you to everyone who made suggestions of a definition of a property.  I 
will go with a definition based on this one from Jon R, with the clarification 
from Terry R.

Yes, the upcoming book is on object-oriented programing using Python, and goes 
into detail about the concepts behind OOP.  The unique approach is that I use 
pygame and explain how to build a number of user interface "widgets" (like 
buttons, text input and output boxes, draggers, etc.) to show the fundamentals 
of OOP in a highly visible way.  I use these widgets to implement a number of 
small games that also incorporate some additional classes like timers, 
animation, etc.

Irv

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


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

2021-05-31 Thread Cameron Simpson
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.

Is it still unworkable if they've a POSIXish layer to hand, eg Cygwin?

Cheers,
Cameron Simpson 
-- 
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-05-31 Thread pjfarley3
> -Original Message-
> From: Chris Angelico 
> Sent: Sunday, May 30, 2021 5:47 PM
> To: Python 
> Subject: Re: How to debug python + curses? [was: RE: Applying winpdb_reborn]
> 
 
> Never had this problem with curses per se (partly because I've used it very 
> little),
> but a more general technique for debugging things that don't have a "normal"
> console is to create one via a pipe or file. The easiest way is something 
> like:
> 
> log = open("logfile.txt", "w")
> print(f"At this point, {foo=}", file=log, flush=True)
> 
> Then, in a separate window - or even on a completely different machine, via 
> SSH
> or equivalent - "tail -F logfile.txt" will be your console.

Thank Chris.  Your method will certainly work, I just used the python logging 
facilities to do effectively the same thing, but it is a slower debugging 
process than having the ability to examine the program environment dynamically 
while it is actually executing but stopped at a chosen breakpoint.

Using tail on a Windows system requires non-native facilities (though 
gnuwin32's tail does a creditable job).

I'm used to having the facilities of an interactive debugger available in my 
day job (not on *ix or Windows systems though), I just thought that interactive 
debugging would be more the rule than the exception here too.

Peter
--


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


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

2021-05-31 Thread pjfarley3
> -Original Message-
> From: Dennis Lee Bieber 
> Sent: Sunday, May 30, 2021 4:32 PM
> To: python-list@python.org
> Subject: Re: How to debug python + curses? [was: RE: Applying
winpdb_reborn]
> 
> On Sun, 30 May 2021 13:26:40 -0400,  declaimed
the
> following:
> 
>   Follow-up to my prior response (which doesn't seem to have
> propagated out and back in to gmane yet).
> 
> >Does anyone here know if winpdb-reborn or any other debugger can
> >support 2-window debugging for a python script that uses the curses
> >module?  It seems to me that a 2-window debugging session is necessary
> >for a python script that uses the curses module because using curses
> >takes over the screen from which the script is started, so debugging
> >output and script output need to be in separate windows.
> >
> 
>   The winpdb executable itself (with a .py as argument) was doing
> NOTHING on my system. Running the winpdb.py file (again with a .py as
> argument) instead did open a graphical user interface, AND it opened a new
> console window... But that is as far as it went. The winpdb GUI status
reported
> that it could not find the script (even if I specified a full path to it).
> 
>   The File/Launch behaved the same way -- opened a console for the
> selected .py, but did not run it...
 

Thank you Dennis. I think I remember having the same issue.  From
examination of the session_manager.py code at the winpdb_reborn github repo
it would appear that the RPDBTERM environment variable needs to be defined
on a Windows system at a global level with the value "nt" to get the correct
osSpawn dictionary entry to start a new Windows console window.  And there
may be more that needs to be done to ensure that starting a new CMD.EXE
console window gets you into the correct directory.  There may need to be
additional CMD.EXE options passed into the osSpawn value to get to that
working directory where you are actually debugging.  Although I do also see
code in that same module that *looks" like it should do that job, but it may
or may not be working right for a Windows system.

I may try winpdb_reborn again using RPDBTERM=nt.  Thanks for the several
replies, appreciated.

Peter

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


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

2021-05-31 Thread pjfarley3
> -Original Message-
> From: Cameron Simpson 
> Sent: Sunday, May 30, 2021 6:07 PM
> To: Python 
> Subject: Re: How to debug python + curses? [was: RE: Applying
winpdb_reborn]
> 
> On 31May2021 07:46, Chris Angelico  wrote:
 
> Also untried, but should work:
> 
> Open another terminal, note its terminal device with the "tty" command.
> Start your programme like this:
> 
> python .. 2>/dev/tty-of-the-other-termina
> 
> Send debug statements to sys.stderr. They should show in the other window.
> 
> I'd also think one could do some kind of shuffle setting up curses to
attach its
> display to another terminal, letting you use an interactive debugging in
the
> invoking terminal. Haven't tried this yet.

Thanks Cameron, but that could only work from an *ix console.  Not so easy
from a Windows console.

Peter
--

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