Re: Definition of "property"

2021-05-30 Thread Eryk Sun
On 5/30/21, Ethan Furman  wrote:
>
>  > Properties are a special kind of attribute. Basically, when Python
> encounters the following code:
>  >
>  > spam = SomeObject()
>  > print(spam.eggs)
>  >
>  > it looks up eggs in spam, and then examines eggs to see if it has a
> __get__, __set__, or __delete__
>  > method — if it does, it's a property.

The above is not quite right. Having a __get__ method is not
sufficient. In the quoted example, the `eggs` attribute of the
SomeObject type has to be a data descriptor type, which means it
defines a __set__ and/or __delete__ method. A computed attribute
that's implemented by a data descriptor type cannot be overridden by
an instance attribute of the same name. In contrast, a non-data
descriptor type only defines a __get__ method  (e.g. the `function`
type is a non-data descriptor). A computed attribute that's
implemented by a non-data descriptor type will be overridden by an
instance attribute of the same name. The two common data descriptor
types are `property` and `member_descriptor` (from __slots__), but
creating custom data descriptor types is easy to implement.

See "customizing attribute access" in the data model documentation,
and in particular "implementing descriptors" and "invoking
descriptors":

https://docs.python.org/3/reference/datamodel.html#customizing-attribute-access
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: Definition of "property"

2021-05-30 Thread Avi Gross via Python-list
You guys are all very knowledgeable but he is asking what to say to an
EDITOR who clearly may know little or nothing about computers and thinks
python is a snake and not a language and may need to be spoken to in his own
language which understands other forms of abstraction better.

So, just for humor, give him the communist version of property. Property is
owned by the state and is a reflection of such a state. It is hidden and can
only be accessed through apparatchiks working for the state. You tell them
what you want and they go invisibly and do whatever they want which may even
include manipulating what lies underneath the capitalist concept of a
property. This is called a Setter as in you set it up and they knock it
down.

Now when you ask for some kind of report of what the property is now like,
that is a getter as you get what they feel like giving. And, yes, if you ask
them to delete it, if it indeed still exists (or ever existed) they may tell
you it was deleted and then take it for themselves!

So, a property is something abstract that you are not allowed to see or in
any way interact with except through layers that hide things and take it on
faith that it is being done in a way that is good for you, OR ELSE.

Now would your editor understand that?

Disclaimer: I repeat, humor. Others have provided decent answers. But, they
were not necessarily born in a communist country which your parents luckily
took you out of in time!


-Original Message-
From: Python-list  On
Behalf Of Alan Gauld via Python-list
Sent: Sunday, May 30, 2021 4:20 PM
To: python-list@python.org
Subject: Re: Definition of "property"

On 30/05/2021 17:57, Irv Kalb wrote:
> I am doing some writing (for an upcoming book on OOP), and I'm a little
stuck.  

Oh dear, that's one of myt hot buttons I'm afraid!
I hope it really is about OOP and not about classes. Classes are such a
minor part of OOP that it is depressing how many books and articles focus on
them to the exclusion of all else that make up the OOP paradigm! Anyway,
rant over...

> I understand what a "property" is, how it is used and the benefits,

Do you? What is that based on? Is it how properties are used in OOP?
Or how they are used in Python? Is your book truly about OOP or how Python
does OOP (very different things!) How do python properties compare to
properties in other languages like Object Pascal(aka Delphi) and Eiffel for
example?
Which of these 3 options most closely models the pure OOP concept of a
property?

> definition of property.  

In OOP or in Python? Or both?

> 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 a very Pythonic description.

> (I would like to avoid going through the whole derivation with the 
> property function, as that would distract from the points that I am 
> trying to make.)

Which are?
Hopefully, about abstraction of data and function/methods therby encouraging
polymorphic representations of program structures, which is the essence of
OOP.

--
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

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


Re: Definition of "property"

2021-05-30 Thread Dan Stromberg
On Sun, May 30, 2021 at 9:57 AM Irv Kalb  wrote:

> I am doing some writing (for an upcoming book on OOP), and I'm a little
> stuck.
>
> 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.
>
> But I'm hoping that someone here can give me a more concise (one or two
> sentence) definition of the word "property".
>
> (I would like to avoid going through the whole derivation with the
> property function, as that would distract from the points that I am trying
> to make.)
>
> Thanks in advance,
>

I tend to think of properties as dynamic attributes.

And I'm not their biggest fan.  I don't like having a look where a class
and its parent classes are defined to tell if something that looks like an
attribute, really is an attribute.

I understand that exposing an attribute as part of a public API is faster,
and the ability to make them dynamic later keeps you from painting yourself
in a corner, but I'd rather just slow down computation a little than end up
with a little greater maintenance burden.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Definition of "property"

2021-05-30 Thread Mike Dewhirst

On 31/05/2021 2:57 am, Irv Kalb wrote:

I am doing some writing (for an upcoming book on OOP), and I'm a little stuck.

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.

But I'm hoping that someone here can give me a more concise (one or two sentence) 
definition of the word "property".


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



(I would like to avoid going through the whole derivation with the property 
function, as that would distract from the points that I am trying to make.)

Thanks in advance,

Irv



--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.



OpenPGP_signature
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2021-05-30 Thread Cameron Simpson
On 31May2021 07:46, Chris Angelico  wrote:
>On Mon, May 31, 2021 at 7:03 AM Alan Gauld via Python-list
> wrote:
>> You are not alone. debugging curses is one of the biggest obstacles 
>> to its use. [...]
>
>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)
[...]

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.

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


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

2021-05-30 Thread Chris Angelico
On Mon, May 31, 2021 at 7:03 AM Alan Gauld via Python-list
 wrote:
>
> On 30/05/2021 18:26, pjfarl...@earthlink.net wrote:
> > I tried winpdb-reborn some time last year on my Win10 system (python 3.8.3
> > at that time), but could not figure out how to use it to debug a python
> > script that uses the curses module.
>
> You are not alone. debugging curses is one of the biggest obstacles to
> its use.
>
> My approach is to define a status line at the bottom of my program and
> write print statements into that window. Something like:
>
> def main(stdwin):
> appwin = curses.newwin(...) # LINES-1 high
> status = curses.newwin(...) # 1 line high positioned on bottom
> # more code here
> status.addstr(0,0, "Value of foo = %s" % foo)
>
> curses.wrapper(main)
>
> After debugging the status window can either be retained as an
> application status bar or removed and the main window
> enlarged by one line...
>
> If anyone else has found a better way to debug curses code I'm
> also keen to hear!
>

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.

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


Re: Definition of "property"

2021-05-30 Thread dn via Python-list
On 31/05/2021 04.57, Irv Kalb wrote:
> I am doing some writing (for an upcoming book on OOP), and I'm a little 
> stuck.  
> 
> 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. 
> 
> But I'm hoping that someone here can give me a more concise (one or two 
> sentence) definition of the word "property".   
> 
> (I would like to avoid going through the whole derivation with the property 
> function, as that would distract from the points that I am trying to make.) 

+1

Everything in Python is an object. Objects can perform an
almost-unlimited range of services, fulfilling a wide variety of
purposes. A property constrains the object to more focussed functionality
...
eg an integer which may not hold a negative value, a string which may
not be empty...
-- 
Regards,
=dn
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2021-05-30 Thread Alan Gauld via Python-list
On 30/05/2021 18:26, pjfarl...@earthlink.net wrote:
> I tried winpdb-reborn some time last year on my Win10 system (python 3.8.3
> at that time), but could not figure out how to use it to debug a python
> script that uses the curses module.

You are not alone. debugging curses is one of the biggest obstacles to
its use.

My approach is to define a status line at the bottom of my program and
write print statements into that window. Something like:

def main(stdwin):
appwin = curses.newwin(...) # LINES-1 high
status = curses.newwin(...) # 1 line high positioned on bottom
# more code here
status.addstr(0,0, "Value of foo = %s" % foo)

curses.wrapper(main)

After debugging the status window can either be retained as an
application status bar or removed and the main window
enlarged by one line...

If anyone else has found a better way to debug curses code I'm
also keen to hear!

HTH
-- 
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


Re: Definition of "property"

2021-05-30 Thread Alan Gauld via Python-list
On 30/05/2021 17:57, Irv Kalb wrote:
> I am doing some writing (for an upcoming book on OOP), and I'm a little 
> stuck.  

Oh dear, that's one of myt hot buttons I'm afraid!
I hope it really is about OOP and not about classes. Classes
are such a minor part of OOP that it is depressing how many
books and articles focus on them to the exclusion of all
else that make up the OOP paradigm! Anyway, rant over...

> I understand what a "property" is, how it is used and the benefits, 

Do you? What is that based on? Is it how properties are used in OOP?
Or how they are used in Python? Is your book truly about OOP or
how Python does OOP (very different things!) How do python
properties compare to properties in other languages like
Object Pascal(aka Delphi) and Eiffel for example?
Which of these 3 options most closely models the pure OOP
concept of a property?

> definition of property.  

In OOP or in Python? Or both?

> 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 a very Pythonic description.

> (I would like to avoid going through the whole derivation 
> with the property function, as that would distract from 
> the points that I am trying to make.) 

Which are?
Hopefully, about abstraction of data and function/methods
therby encouraging polymorphic representations of program structures,
which is the essence of OOP.

-- 
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


Re: Python doesn't work

2021-05-30 Thread Alan Gauld via Python-list
On 30/05/2021 12:23, Mr.Incognito wrote:
>Hello
> 
>I downloaded the latest versioon of Python and tried to open several .py
>files, but it doesn't open. It opens for a sec, then closes itself. I
>tried uninstalling and reinstalling, but it doesn't work.

Most likely it is working but faster than you can see.
Python is a program interpreter so if you simply execute
a .py file, the interpreter will execute it and terminate.
Any output will be displayed in a terminal window which
will close when the interpreter finishes.

The way round that is to launch the programs from inside
an existing command shell. assuming you are on Windows hit
Windows-R and type cmd to get a Windows> prompt. Then type

C:\WINDOWS> py \path\to\python\file.py

And you should see the program output.

-- 
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


Re: Definition of "property"

2021-05-30 Thread Terry Reedy

On 5/30/2021 12:57 PM, Irv Kalb wrote:

I am doing some writing (for an upcoming book on OOP), and I'm a little stuck.

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.

But I'm hoping that someone here can give me a more concise (one or two sentence) 
definition of the word "property".

(I would like to avoid going through the whole derivation with the property 
function, as that would distract from the points that I am trying to make.)


From a user viewpoint, which is likely close to that of the editor, a 
property is a possibly dynamic class attribute managed by up to 3 hidden 
functions.


A user only needs to know that an attribute is a property when it has 
otherwise surprising dynamic behavior.  For instance, if 'time.now != 
time.now', or if 'time.now = something; print(time.now)' does not print 
'something'.


Note: at least one person says a property *pretends* to be an attribute. 
 I think a more useful view is that it *is* an attribute with a 
particular behind-the-scene implementation.  When a normal attribute is 
converted to a 'property', it effectively still is an attribute.  The 
syntax manipulating the attribute remains the same.  If one can set, 
get, and delete something dotted notation, it is an attribute.


--
Terry Jan Reedy

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


Re: Python doesn't work

2021-05-30 Thread Michael F. Stemper

On 30/05/2021 06.23, Mr.Incognito wrote:

Hello

I downloaded the latest versioon of Python and tried to open several .py
files, but it doesn't open. 


It doesn't open, is that correct?


  It opens for a sec, then closes itself.


No, I guess that it does open.


My guess would be that the following happens:
1. You click on the file in some GUI.
2. The program contained in that file executes; taking a second or so.
3. Having done what you asked it to, it goes away.


--
Michael F. Stemper
87.3% of all statistics are made up by the person giving them.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python doesn't work

2021-05-30 Thread Igor Korot
Hi,

On Sun, May 30, 2021 at 2:00 PM Mr.Incognito  wrote:
>
>Hello
>
>I downloaded the latest versioon of Python and tried to open several .py
>files, but it doesn't open. It opens for a sec, then closes itself. I
>tried uninstalling and reinstalling, but it doesn't work.

Did you try with right clicking the file in the Explorer and click "Open"?
You should either open the Terminal, navigate to the place where those py
files are and type "python  or try with IDLE.

Thank you.

>
>
>
>I hope you can help me!
>
>
>
>
>
>Saadetud Windows 10 rakendusest [1]Meil
>
>
>
> References
>
>Visible links
>1. https://go.microsoft.com/fwlink/?LinkId=550986
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: learning python ...

2021-05-30 Thread 황병희
hw  writes:

> Hi,
>
> I'm starting to learn python and have made a little example program
> following a tutorial[1] I'm attaching.
>
> Running it, I'm getting:
>
>
> Traceback (most recent call last):
>   File "[...]/hworld.py", line 18, in 
> print(isinstance(int, float))
> TypeError: isinstance() arg 2 must be a type or tuple of types
>
>
> I would understand to get an error message in line 5 but not in 18.
> Is this a bug or a feature?
>
>
> [1]: https://www.learnpython.org/en/Variables_and_Types
>

OK man i saw your code other messages. That is simple.
You wrote 'Python's default keywords' so that occurs conflict.

Bomb.

To avoid conflict, i append some prefix like as "_" or "__" when i
write down var/func names sometimes...

Sincerely, Gnus fan Byung-Hee

-- 
^고맙습니다 _救濟蒼生_ 감사합니다_^))//
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Definition of "property"

2021-05-30 Thread Jon Ribbens via Python-list
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.
-- 
https://mail.python.org/mailman/listinfo/python-list


Python doesn't work

2021-05-30 Thread Mr . Incognito
   Hello

   I downloaded the latest versioon of Python and tried to open several .py
   files, but it doesn't open. It opens for a sec, then closes itself. I
   tried uninstalling and reinstalling, but it doesn't work.



   I hope you can help me!





   Saadetud Windows 10 rakendusest [1]Meil



References

   Visible links
   1. https://go.microsoft.com/fwlink/?LinkId=550986
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Applying winpdb_reborn

2021-05-30 Thread Alan Gauld via Python-list
On 30/05/2021 00:03, Cameron Simpson wrote:

> I'd imagine debugging is much like it is in C. Wait for the breakpoint 
> to trip, then inspect the programme variables.

That's a pretty crude form of debugging (although much better than just
single stepping from the beginning!).

Adding conditional breakpoints that stop only when variables are at
certain values, tracepoints that print out a set of values every time a
line is executed and watchpoints that keep a running display of a set of
variables all allow much faster location of errors.

I don't recall how many of those pdb supports but I'm pretty
sure watch points and conditional breaks are there.

-- 
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


Re: Definition of "property"

2021-05-30 Thread Ethan Furman

On 5/30/21 9:57 AM, 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.


My answer from Stackoverflow [1]:

> Properties are a special kind of attribute. Basically, when Python encounters 
the following code:
>
> spam = SomeObject()
> print(spam.eggs)
>
> it looks up eggs in spam, and then examines eggs to see if it has a __get__, 
__set__, or __delete__
> method — if it does, it's a property. If it is a property, instead of just 
returning the eggs object
> (as it would for any other attribute) it will call the __get__ method (since 
we were doing lookup)
> and return whatever that method returns.

Feel free to use that however you like.  :)

--
~Ethan~


[1] https://stackoverflow.com/a/7377013/208880
--
https://mail.python.org/mailman/listinfo/python-list


Re: Definition of "property"

2021-05-30 Thread Barry Scott



> On 30 May 2021, at 17:57, Irv Kalb  wrote:
> 
> I am doing some writing (for an upcoming book on OOP), and I'm a little 
> stuck.  
> 
> 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. 
> 
> But I'm hoping that someone here can give me a more concise (one or two 
> sentence) definition of the word "property".   
> 
> (I would like to avoid going through the whole derivation with the property 
> function, as that would distract from the points that I am trying to make.) 

How does this sound?

An object is the combination of behaviour and state.

Classes define the object.
Methods allow the control of behaviour.
Properties hold the state.

The use of getter functions allows a property's value to be calculated.
The use of setting functions allows a property change to update the state an 
object.

The python property mechanism allows the getting and setter to be hidden from
the API as that the user of the object can see the propery as a simple 
attribute of
an object.

Barry



> 
> Thanks in advance,
> 
> Irv
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 

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


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

2021-05-30 Thread pjfarley3
I tried winpdb-reborn some time last year on my Win10 system (python 3.8.3
at that time), but could not figure out how to use it to debug a python
script that uses the curses module.

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.

I've been forced to use a logger to trace critical values and program flow
for errors in such a script.  It works, but it is annoyingly slow to debug
that way.

TIA for any advice or RTFM you can provide.

Peter
--

-- 
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: Definition of "property"

2021-05-30 Thread Chris Angelico
On Mon, May 31, 2021 at 2:58 AM Irv Kalb  wrote:
>
> I am doing some writing (for an upcoming book on OOP), and I'm a little stuck.
>
> 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.
>
> But I'm hoping that someone here can give me a more concise (one or two 
> sentence) definition of the word "property".
>

A property is an attribute with customized get/set behaviour.

It lets you change what normally happens when you say
"print(thing.attribute)" or "thing.attribute = spam".

Personally, I wouldn't bother mentioning deletion in the opening
definition, for brevity's sake, but it'll be there when you go into
detail.

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


Definition of "property"

2021-05-30 Thread Irv Kalb
I am doing some writing (for an upcoming book on OOP), and I'm a little stuck.  

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. 

But I'm hoping that someone here can give me a more concise (one or two 
sentence) definition of the word "property".   

(I would like to avoid going through the whole derivation with the property 
function, as that would distract from the points that I am trying to make.) 

Thanks in advance,

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


Re: Applying winpdb_reborn

2021-05-30 Thread Peter Otten

On 29/05/2021 01:12, Cameron Simpson wrote:

On 28May2021 14:49, Rich Shepard  wrote:

On Fri, 28 May 2021, Dennis Lee Bieber wrote:

It's apparently looking for some environment variable based upon the
code at
https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwjfpYmk3-zwAhULI6wKHSPjAFIQFnoECAUQAA&url=http%3A%2F%2Fphault.rhul.ac.uk%2Fpy%2F_spe%2Fplugins%2Fwinpdb%2Frpdb2.py&usg=AOvVaw12BuzlEMVXrEuOFLoQLpFX


Thanks, Dennis. It looked like an environment variable but I hadn't seen
that with the python2 winpdb.


I'm concerned by the NameError, not in keeping with the fact that there
does seem to be a global (module level) variable of the right name.


I'll add that to ~/.bash_profile and see what happens.


The NameError suggests that this won't work. Maybe you're module install
is an old version? 


This seems to be the problem. There was a bugfix in November 2020:

https://github.com/bluebird75/winpdb/commit/215712d75cf89b0678d563237746be647d5f25e7

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