Re: Asynchronous generators

2020-06-24 Thread Dieter Maurer
Jonathan Gossage wrote at 2020-6-23 14:04 -0400:
>--
>I am attempting to learn how to use asyncio and I have been unable to find
>any documentation or Internet posts that give information on the principles
>underlying asyncio ...

I am almost sure to have read an asyncio tutorial found via
"python.org".
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Pycharm Won't Do Long Underscore

2020-06-24 Thread Chris Angelico
On Thu, Jun 25, 2020 at 3:51 AM Dennis Lee Bieber  wrote:
>
> On Tue, 23 Jun 2020 20:49:36 +, Tony Kaloki 
> declaimed the following:
>
> >Alexander,
> >   Thank you so much! It worked! Thank you. One question: in 
> > your reply, are you saying that Python would have treated the two separate 
> > underscores the same way as a long  underscore i.e. it's a stylistic choice 
> > rather than a functional necessity?
>
> There is no "long underscore" in the character set. If there were,
> Python would not know what to do with it as it was created back when ASCII
> and ISO-Latin-1 were the common character sets. (Interesting: Windows
> Character Map utility calls the underscore character "low line").

That's what Unicode calls it - charmap is probably using that name.

> Many word processors are configured to change sequences of hyphens:
> - -- --- into - – — (hyphen, en-dash, em-dash)... But in this case, those
> are each single characters in the character map (using Windows-Western,
> similar to ISO-Latin-1): hyphen is x2D, en-dash is x96, em-dash is x97
> (note that en-/em-dash are >127, hence would not be in pure ASCII)

Hyphen is U+002D, en dash is U+2013, em dash is 2014. :)

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


Re: Pycharm Won't Do Long Underscore

2020-06-24 Thread MRAB

On 2020-06-24 18:59, Chris Angelico wrote:

On Thu, Jun 25, 2020 at 3:51 AM Dennis Lee Bieber  wrote:


On Tue, 23 Jun 2020 20:49:36 +, Tony Kaloki 
declaimed the following:

>Alexander,
>   Thank you so much! It worked! Thank you. One question: in 
your reply, are you saying that Python would have treated the two separate 
underscores the same way as a long  underscore i.e. it's a stylistic choice rather 
than a functional necessity?

There is no "long underscore" in the character set. If there were,
Python would not know what to do with it as it was created back when ASCII
and ISO-Latin-1 were the common character sets. (Interesting: Windows
Character Map utility calls the underscore character "low line").


That's what Unicode calls it - charmap is probably using that name.


Many word processors are configured to change sequences of hyphens:
- -- --- into - – — (hyphen, en-dash, em-dash)... But in this case, those
are each single characters in the character map (using Windows-Western,
similar to ISO-Latin-1): hyphen is x2D, en-dash is x96, em-dash is x97
(note that en-/em-dash are >127, hence would not be in pure ASCII)


Hyphen is U+002D, en dash is U+2013, em dash is 2014. :)


Not quite. :-)

Hyphen is U+2010.

U+002D is hyphen-minus; it's does double-duty, for historical reasons.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Pycharm Won't Do Long Underscore

2020-06-24 Thread Tony Kaloki
Thanks for all your explanations, everyone. Hopefully, I'll know better next 
time I come across a similar case. Now, to try and understand the rest of 
Python...

Get Outlook for Android


From: Python-list  on behalf 
of MRAB 
Sent: Wednesday, June 24, 2020 7:28:52 PM
To: [email protected] 
Subject: Re: Pycharm Won't Do Long Underscore

On 2020-06-24 18:59, Chris Angelico wrote:
> On Thu, Jun 25, 2020 at 3:51 AM Dennis Lee Bieber  
> wrote:
>>
>> On Tue, 23 Jun 2020 20:49:36 +, Tony Kaloki 
>> declaimed the following:
>>
>> >Alexander,
>> >   Thank you so much! It worked! Thank you. One question: 
>> > in your reply, are you saying that Python would have treated the two 
>> > separate underscores the same way as a long  underscore i.e. it's a 
>> > stylistic choice rather than a functional necessity?
>>
>> There is no "long underscore" in the character set. If there were,
>> Python would not know what to do with it as it was created back when ASCII
>> and ISO-Latin-1 were the common character sets. (Interesting: Windows
>> Character Map utility calls the underscore character "low line").
>
> That's what Unicode calls it - charmap is probably using that name.
>
>> Many word processors are configured to change sequences of hyphens:
>> - -- --- into - – — (hyphen, en-dash, em-dash)... But in this case, those
>> are each single characters in the character map (using Windows-Western,
>> similar to ISO-Latin-1): hyphen is x2D, en-dash is x96, em-dash is x97
>> (note that en-/em-dash are >127, hence would not be in pure ASCII)
>
> Hyphen is U+002D, en dash is U+2013, em dash is 2014. :)
>
Not quite. :-)

Hyphen is U+2010.

U+002D is hyphen-minus; it's does double-duty, for historical reasons.
--
https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Pycharm Won't Do Long Underscore

2020-06-24 Thread Chris Angelico
On Thu, Jun 25, 2020 at 4:40 AM MRAB  wrote:
>
> On 2020-06-24 18:59, Chris Angelico wrote:
> > On Thu, Jun 25, 2020 at 3:51 AM Dennis Lee Bieber  
> > wrote:
> >>
> >> On Tue, 23 Jun 2020 20:49:36 +, Tony Kaloki 
> >> declaimed the following:
> >>
> >> >Alexander,
> >> >   Thank you so much! It worked! Thank you. One question: 
> >> > in your reply, are you saying that Python would have treated the two 
> >> > separate underscores the same way as a long  underscore i.e. it's a 
> >> > stylistic choice rather than a functional necessity?
> >>
> >> There is no "long underscore" in the character set. If there were,
> >> Python would not know what to do with it as it was created back when ASCII
> >> and ISO-Latin-1 were the common character sets. (Interesting: Windows
> >> Character Map utility calls the underscore character "low line").
> >
> > That's what Unicode calls it - charmap is probably using that name.
> >
> >> Many word processors are configured to change sequences of hyphens:
> >> - -- --- into - – — (hyphen, en-dash, em-dash)... But in this case, those
> >> are each single characters in the character map (using Windows-Western,
> >> similar to ISO-Latin-1): hyphen is x2D, en-dash is x96, em-dash is x97
> >> (note that en-/em-dash are >127, hence would not be in pure ASCII)
> >
> > Hyphen is U+002D, en dash is U+2013, em dash is 2014. :)
> >
> Not quite. :-)
>
> Hyphen is U+2010.
>
> U+002D is hyphen-minus; it's does double-duty, for historical reasons.

True true, I should have corrected that name. But the point is,
"Windows-Western" is not a good way to describe characters (I think
that probably means "code page 1252"?). Use the Unicode codepoints for
reliability :)

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


Re: Pycharm Won't Do Long Underscore

2020-06-24 Thread Peter J. Holzer
On 2020-06-24 13:48:18 -0400, Dennis Lee Bieber wrote:
> On Tue, 23 Jun 2020 20:49:36 +, Tony Kaloki 
> declaimed the following:
> > Alexander,
> > Thank you so much! It worked! Thank you. One question: in your
> > reply, are you saying that Python would have treated the two
> > separate underscores the same way as a long  underscore i.e. it's a
> > stylistic choice rather than a functional necessity?
> 
>   There is no "long underscore" in the character set.

There is U+FF3F Fullwidth Low Line.

> If there were, Python would not know what to do with it

You can use it in variable names, but not at the beginning, and it isn't
equivalent to two underscores, of course:

Python 3.9.0b3 (default, Jun 13 2020, 10:49:29)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> _ = 12
  File "", line 1
_ = 12
^
SyntaxError: invalid character '_' (U+FF3F)
>>> a_ = 12
>>> a_
12
>>> a__
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'a__' is not defined
>>>

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | [email protected] |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: FW: Pycharm Won't Do Long Underscore

2020-06-24 Thread Joe Pfeiffer
One other note -- while you may want various good-looking fonts with
ligatures in other domains, for writing code a monospace font with no
ligatures lets you see exactly what's there and saves a host of
problems.  My personal favorite for these purposes is called "Terminus
Regular", but which specific one you pick is much less important than
that you use one.
-- 
https://mail.python.org/mailman/listinfo/python-list


Pycharm offers only implementation of an abstract getter but not an abstract setter

2020-06-24 Thread zljubisic
I would like to have an abstract class in which I will have an abstract 
property. So I used Pycharm in order to create an abstract (base) class:

import abc


class BaseSomeAbstract(abc.ABC):
_abs_prop = None

@property
@abc.abstractmethod
def abs_prop(self):
return self._abs_prop

@abs_prop.setter
@abc.abstractmethod
def abs_prop(self, value):
self._abs_prop = value

Now I have created a new file and a new class:

from subclassing.abstract.BaseSomeAbstract import BaseSomeAbstract


class ChildSomeAbstract(BaseSomeAbstract):



Now I pressed alt+enter, implement abstract methods. I got only a single choice 
abs_prop(self: BaseSomeAbstract).
If I choose this option, my subclass looks like this:

from subclassing.abstract.BaseSomeAbstract import BaseSomeAbstract


class ChildSomeAbstract(BaseSomeAbstract):

@property
def abs_prop(self):
pass

Why Pycharm didn't offer a setter as well as getter?


What is the propper way to define an abstract property, and how to force 
subclass to define setter and getter for the abstract property?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Pycharm offers only implementation of an abstract getter but not an abstract setter

2020-06-24 Thread zljubisic
If my subclass is as this:

from subclassing.abstract.BaseSomeAbstract import BaseSomeAbstract


class ChildSomeAbstract(BaseSomeAbstract):

@property
def abs_prop(self):
return self._abs_prop

I can create an instance of it with no errors. So
x = ChildSomeAbstract()
works with no problem.
It looks like setter @abstractmethod decorator is not respected.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Pycharm Won't Do Long Underscore

2020-06-24 Thread o1bigtenor
On Wed, Jun 24, 2020 at 1:54 PM Tony Kaloki  wrote:
>
> Thanks for all your explanations, everyone. Hopefully, I'll know better next 
> time I come across a similar case. Now, to try and understand the rest of 
> Python...
>

Your last sentence - - - - I'm right there with you! (Reading it made
me chuckle!)
I've been a tool maker in so many areas and never really wanted to
fall into the rabbit hole called computer programming (wry grin!).
Here I am working on Python, R, SQL and that's just for starters!
Oh well - - - helps keep life interesting!!

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


Re: Pycharm Won't Do Long Underscore

2020-06-24 Thread Grant Edwards
On 2020-06-24, Peter J. Holzer  wrote:

> There is U+FF3F Fullwidth Low Line.
>
>> If there were, Python would not know what to do with it
>
> You can use it in variable names, but not at the beginning, and it isn't
> equivalent to two underscores, of course:

Ouch.  Anybody caught using that should be fed to a large snake.

--
Grant

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


Re: Pycharm offers only implementation of an abstract getter but not an abstract setter

2020-06-24 Thread zljubisic
This also works with no errors:

from abc import ABC, abstractmethod

class C(ABC):

@property
@abstractmethod
def my_abstract_property(self):
pass

@my_abstract_property.setter
@abstractmethod
def my_abstract_property(self, val):
pass

class D(C):
my_abstract_property = 1

if __name__ == '__main__':
x = D()
print(x.my_abstract_property)
x.my_abstract_property = 5
print(x.my_abstract_property)


Output:
1
5

I expected to get an error that setter is not implemented.
If I try to instante C class directly as: x = C(), I will get an error:
TypeError: Can't instantiate abstract class C with abstract methods 
my_abstract_property

Can someone please explain to me how it works i python?
-- 
https://mail.python.org/mailman/listinfo/python-list