git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pycharm Won't Do Long Underscore


Hi Tony

Absolutely. The ?long underscore? is just a display thing. Underneath it is always two underscores. The only difference is what your editor is showing (or how the underscore is drawn in the display font - as some fonts make the underscore the full width or slightly over the edge of where the character will be displayed so that many underscores look all joined up like a line)

These links may provide you with some useful reading around this and what underscores signal in Python. 

https://dbader.org/blog/meaning-of-underscores-in-python

https://dbader.org/blog/python-dunder-methods

Happy to have helped and good luck with your Python journey. 

Regards
Alexander

Alexander Neilson
Neilson Productions Limited
021 329 681
alexander at neilson.net.nz

> On 24/06/2020, at 08:49, Tony Kaloki <tkaloki at live.co.uk> wrote:
> 
> ?
> 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?
>    In any case, thanks again for your quick and easy to follow - even for me - reply.
> Tony
> 
> Get Outlook for Android
> 
> From: Alexander Neilson <alexander at neilson.net.nz>
> Sent: Tuesday, June 23, 2020 9:28:37 PM
> To: Tony Kaloki <tkaloki at live.co.uk>
> Cc: python-list at python.org <python-list at python.org>
> Subject: Re: Pycharm Won't Do Long Underscore
>  
> Hi Tony
> 
> The ?long underscore? (often called Dunder as ?double underscore?) is actually two underscores as you are seeing shown in PyCharm. 
> 
> However the display of it as one long underscore is a ligature (special font display to communicate clearer) and to enable these in PyCharm go to the settings dialog (depending on windows or Mac this could be in different locations) and select Editor > Font
> 
> In that screen select ?enable font ligatures? and if your font supports it (like the default JetBrains Mono does) that will start to display the double underscores as a single long underscore. 
> 
> Regards
> Alexander
> 
> Alexander Neilson
> Neilson Productions Limited
> 021 329 681
> alexander at neilson.net.nz
> 
> > On 24/06/2020, at 07:57, Tony Kaloki <tkaloki at live.co.uk> wrote:
> > 
> > ?
> > 
> > Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
> > 
> > From: Tony Kaloki<mailto:Tkaloki at live.co.uk>
> > Sent: 23 June 2020 19:45
> > To: python-list at python.org<mailto:python-list at python.org>
> > Subject: Pycharm Won't Do Long Underscore
> > 
> > 
> > Hi Guys,
> >               I?ve just begun to learn basic computer programming by downloading Python and Pycharm and following Youtube tutorials. But I?ve come across a problem that?s stopped me in my tracks.
> >     When I try to do a long underscore __  for classes in Pycharm, it only gives me two separate single underscores _ _. This is only in Pycharm, no problems anywhere else. Could you tell me how to fix this, because I can?t find any answers on the web and I?m not sure if I can go any further in my learning without being able to get long underscores.
> >    Sorry if I?m just being really dense, but like I said I?m an absolute beginner. Thanks for your time,
> > Tony
> > Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
> > 
> > 
> > -- 
> > https://mail.python.org/mailman/listinfo/python-list