Re: version

2018-05-31 Thread Ralf Schoenian
Hi Mike, you can check for the major version with import sys sys.version_info.major On 01.06.2018 04:44, Mike McClain wrote: OK so I installed python 3.2, which is the latest available as a package in Debian Wheezy, because I've seen so many folks say it's a waste of time to play with Py

Re: Python library to break text into words

2018-05-31 Thread Abdur-Rahmaan Janhangeer
Dietmar's answer is the best, piggybacking on search engines' algorithms and probably instead of a dictionary of english words, we'd need a dictionary of titles, making search much more efficient regards, Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ No need to re-invent the wheel:

Re: Attachments? Re: Indented multi-line strings (was: "Data blocks" syntax specification draft)

2018-05-31 Thread Paul
I gave it a different subject line. On Fri, Jun 1, 2018 at 2:45 AM, Abdur-Rahmaan Janhangeer < arj.pyt...@gmail.com> wrote: > as this sig file is a common occurance, attaching the topic to the data > blocks thread is not really necessary > > Abdur-Rahmaan Janhangeer > https://github.com/Abdur-rah

Re: Python library to break text into words

2018-05-31 Thread Abdur-Rahmaan Janhangeer
1-> search in dict, identify all words example : meaningsofoffers .. identified words : me an mean in meaning meanings so of of offer offers 2-> next filter duplicates, i.e. of above in a new list as the original list serves as chronological reference 3-> next chose the words whose lengths mak

Re: version

2018-05-31 Thread Jorge Gimeno
Look at the six module On Thu, May 31, 2018, 7:57 PM Mike McClain wrote: > OK so I installed python 3.2, which is the latest available as a > package in Debian Wheezy, because I've seen so many folks say it's a > waste of time to play with Py2.7. > Immediately my python playground 'my.py

Re: ... (ellipsis)

2018-05-31 Thread Terry Reedy
On 5/31/2018 10:26 PM, Mike McClain wrote: I'm having understanding the use if the ellipsis. I keep reading that it is used in slices By numpy for numpy multidimensional arrays, which have their own __getitem__, which recognizes and gives meaning to ... -- Terry Jan Reedy -- https://ma

version

2018-05-31 Thread Mike McClain
OK so I installed python 3.2, which is the latest available as a package in Debian Wheezy, because I've seen so many folks say it's a waste of time to play with Py2.7. Immediately my python playground 'my.python.py' failed as soon as I changes the '#!' line to python3.2. Most of the err

Re: Attachments? Re: Indented multi-line strings (was: "Data blocks" syntax specification draft)

2018-05-31 Thread Abdur-Rahmaan Janhangeer
as this sig file is a common occurance, attaching the topic to the data blocks thread is not really necessary Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ On Fri, 1 Jun 2018, 01:49 Paul, wrote: > I have heard that attachments to messages are not allowed on this list, > which makes

... (ellipsis)

2018-05-31 Thread Mike McClain
I'm having understanding the use if the ellipsis. I keep reading that it is used in slices but every time I use it I get 'Syntax error' in 2.7 if 'Type error' in 3.2. In python2.7: l=range(15) l[...:11] Syntax error l[3:...] Syntax error l[3:...:11] Syntax error In python3.2 it becomes 'Type

Re: How do I list only the methods I define in a class?

2018-05-31 Thread bob gailer
On 5/31/2018 3:49 PM, bruceg113...@gmail.com wrote: > How do I list only the methods I define in a class? Here's a class with some method, defined in various ways: >>> class x(): ... a=3 ... def f():pass ... g = lambda: None ... >>> l=[v for v in x.__dict__.items()]; print(l) [('a',

Re: Override built in types... possible? or proposal.

2018-05-31 Thread Steven D'Aprano
On Thu, 31 May 2018 09:51:30 -0700, Rob Gaddi wrote: > On 05/31/2018 07:49 AM, Dan Strohl wrote: >> Is it possible to override the assignment of built in types to the >> shorthand representations? And if not, is it a reasonable thought to >> consider adding? [...] > My problem with this idea is

Re: Python library to break text into words

2018-05-31 Thread beliavsky--- via Python-list
On Thursday, May 31, 2018 at 5:31:48 PM UTC-4, Dietmar Schwertberger wrote: > On 5/31/2018 10:26 PM, beliavsky--- via Python-list wrote: > > Is there a Python library that uses intelligent guesses to break sequences > > of characters into words? The general strategy would be to break strings > >

Attachments? Re: Indented multi-line strings (was: "Data blocks" syntax specification draft)

2018-05-31 Thread Paul
I have heard that attachments to messages are not allowed on this list, which makes sense. However I notice that messages from Peter do have an attachment, i.e., a signature.asc file. I'm just curious; why and how do those particular attachments get through? And should they get through, I guess? E

Re: Python library to break text into words

2018-05-31 Thread Chris Angelico
On Fri, Jun 1, 2018 at 7:09 AM, Dietmar Schwertberger wrote: > On 5/31/2018 10:26 PM, beliavsky--- via Python-list wrote: >> >> Is there a Python library that uses intelligent guesses to break sequences >> of characters into words? The general strategy would be to break strings >> into the longest

Re: Indented multi-line strings (was: "Data blocks" syntax specification draft)

2018-05-31 Thread Chris Angelico
On Fri, Jun 1, 2018 at 7:05 AM, Peter J. Holzer wrote: > [Strange: I didn't get this mail through the list, only directly] > > On 2018-05-31 14:39:17 +, Dan Strohl wrote: >> The outdent method could look like: >> >> string.outdent(size=None) >> """ >> :param size : The number of spaces

Re: Sorting and spaces.

2018-05-31 Thread Chris Angelico
On Fri, Jun 1, 2018 at 6:51 AM, Paul wrote: > In the US, at least, spaces should sort before letters. > > MRAB brought up an important point. It depends on your purpose, of course, > but having all the capitalized-beginning items appear separately from all > of the lower-cased-beginning items can

Re: Python library to break text into words

2018-05-31 Thread Dietmar Schwertberger
On 5/31/2018 10:26 PM, beliavsky--- via Python-list wrote: Is there a Python library that uses intelligent guesses to break sequences of characters into words? The general strategy would be to break strings into the longest words possible. The library would need to "know" a sizable subset of wo

Re: Indented multi-line strings (was: "Data blocks" syntax specification draft)

2018-05-31 Thread Peter J. Holzer
On 2018-05-31 23:05:35 +0200, Peter J. Holzer wrote: > [Strange: I didn't get this mail through the list, only directly] Found it. For some reason "Avoid duplicate copies of messages" was enabled. I normally always disable this when I subscribe to a mailinglist and I'm surprised that I haven't not

Re: Indented multi-line strings

2018-05-31 Thread Peter J. Holzer
On 2018-05-31 16:44:10 +0100, MRAB wrote: > I was also thinking that it could take the indentation from the first line, > but that if you wanted the first line to have a larger indent than the > remaining lines, you could replace the first space that you want to keep > with a non-whitespace charact

Re: Indented multi-line strings (was: "Data blocks" syntax specification draft)

2018-05-31 Thread Peter J. Holzer
[Strange: I didn't get this mail through the list, only directly] On 2018-05-31 14:39:17 +, Dan Strohl wrote: > > This is of course not a problem if the *trailing* quote determines the > > indentation: > > > > a_multi_line_string = i''' > >Py- > > thon > > ''

Re: Sorting and spaces.

2018-05-31 Thread Paul
In the US, at least, spaces should sort before letters. MRAB brought up an important point. It depends on your purpose, of course, but having all the capitalized-beginning items appear separately from all of the lower-cased-beginning items can be very annoying to a user. -- https://mail.python.or

Re: Python library to break text into words

2018-05-31 Thread Chris Angelico
On Fri, Jun 1, 2018 at 6:26 AM, beliavsky--- via Python-list wrote: > I bought some e-books in a Humble Bundle. The file names are shown below. I > would like to hyphenate words within the file names, so that the first three > titles are > > a_devils_chaplain.pdf > atomic_accidents.pdf > chaos_m

Python library to break text into words

2018-05-31 Thread beliavsky--- via Python-list
I bought some e-books in a Humble Bundle. The file names are shown below. I would like to hyphenate words within the file names, so that the first three titles are a_devils_chaplain.pdf atomic_accidents.pdf chaos_making_a_new_science.pdf Is there a Python library that uses intelligent guesses t

How do I list only the methods I define in a class?

2018-05-31 Thread bruceg113355
How do I list only the methods I define in a class? For example: class Produce(): def __init__ (self): print (dir (Produce)) def apples(self): pass def peaches(self): pass def pumpkin (self): pass The print (dir(Produce)) statement d

Re: Override built in types... possible? or proposal.

2018-05-31 Thread Terry Reedy
On 5/31/2018 10:49 AM, Dan Strohl via Python-list wrote: Is it possible to override the assignment of built in types to the shorthand representations? By which I presume you mean literals and overt (non-comprehension) displays. So you wish that Python should be even more dynamic. (Some wis

Re: Indented multi-line strings (was: "Data blocks" syntax specification draft)

2018-05-31 Thread Chris Angelico
On Fri, Jun 1, 2018 at 12:39 AM, Dan Strohl via Python-list wrote: >> This is of course not a problem if the *trailing* quote determines the >> indentation: >> >> a_multi_line_string = i''' >>Py- >> thon >> ''' > > I get the point, but it feels like it would be a

Re: Why exception from os.path.exists()?

2018-05-31 Thread Grant Edwards
On 2018-05-31, Paul Moore wrote: > On 31 May 2018 at 15:01, Chris Angelico wrote: >> Can someone on Windows see if there are other path names that raise >> ValueError there? Windows has a whole lot more invalid characters, and >> invalid names as well. > > On Windows: > os.path.exists('\0')

Re: Problem with OrderedDict - progress report

2018-05-31 Thread Chris Angelico
On Fri, Jun 1, 2018 at 12:37 AM, Frank Millman wrote: > "Steven D'Aprano" wrote in message news:peorib$1f4$2...@blaine.gmane.org... >> >> >> On Thu, 31 May 2018 10:05:43 +0200, Frank Millman wrote: >> >> > From the interpreter session below, you will see that adding a key while >> > processing th

Re: Why exception from os.path.exists()?

2018-05-31 Thread Chris Angelico
On Fri, Jun 1, 2018 at 12:51 AM, MRAB wrote: > On 2018-05-31 14:38, Marko Rauhamaa wrote: >> >> Chris Angelico : >>> >>> Do you have an actual use-case where it is correct for an invalid path >>> to be treated as not existing? >> >> >> Note that os.path.exists() returns False for other types of er

RE: Override built in types... possible? or proposal.

2018-05-31 Thread Dan Strohl via Python-list
> > > > I am envisioning something in the header like an import statement > > where I could do; > > > > override str=my_string > > override list=my_list > > > > This would only be scoped to the current module and would not be > imported when that module was imported. > > > > Thoughts? > > > > Dan S

Re: Why exception from os.path.exists()?

2018-05-31 Thread Marko Rauhamaa
Terry Reedy : > On 5/31/2018 8:03 AM, Marko Rauhamaa wrote: >> Is the behavior a bug? Shouldn't it be: >> >> >>> os.path.exists("\0") >> False > > Please open an issue on the tracker if there is not one for this > already. issue 33721 created Marko -- https://mail.python.org/mailman/li

Re: Indented multi-line strings

2018-05-31 Thread Terry Reedy
On 5/31/2018 10:39 AM, Dan Strohl via Python-list wrote: This is of course not a problem if the *trailing* quote determines the indentation: a_multi_line_string = i''' Py- thon ''' I get the point, but it feels like it would be a pain to use, and it "Feels"

Re: Why exception from os.path.exists()?

2018-05-31 Thread Terry Reedy
On 5/31/2018 8:03 AM, Marko Rauhamaa wrote: This surprising exception can even be a security issue: >>> os.path.exists("\0") Traceback (most recent call last): File "", line 1, in File "/usr/lib64/python3.6/genericpath.py", line 19, in exists os.stat(path) Value

Re: Override built in types... possible? or proposal.

2018-05-31 Thread Rob Gaddi
On 05/31/2018 07:49 AM, Dan Strohl wrote: Is it possible to override the assignment of built in types to the shorthand representations? And if not, is it a reasonable thought to consider adding? For example, right now, if I do: test = "this is a string", I get back str("this is a string").

Re: Sorting and spaces.

2018-05-31 Thread Peter Otten
Tobiah wrote: > I had a case today where I needed to sort two string: > > ['Awards', 'Award Winners'] > > I consulted a few sources to get a suggestion as to > what would be correct. My first idea was to throw them > through a Linux command line sort: > > Awards > Award Winners > > Then I did

Re: Re: Re: The PIL show() method looks for the default viewer. How do I change this to a different viewer (of my choice)?

2018-05-31 Thread Paul St George
That's what I wanted! But, I didn't know the question because I didn't know the answer. On 30/05/2018 23:09, Karsten Hilbert wrote: On Wed, May 30, 2018 at 11:01:17PM +0200, Peter J. Holzer wrote: On 2018-05-30 22:08:45 +0200, Paul St George wrote: Ha! No, my question was clumsy. If I know

Re: Indented multi-line strings

2018-05-31 Thread MRAB
On 2018-05-31 15:39, Dan Strohl via Python-list wrote: This is of course not a problem if the *trailing* quote determines the indentation: a_multi_line_string = i''' Py- thon ''' I get the point, but it feels like it would be a pain to use, and it "Feels" diff

Re: Sorting and spaces.

2018-05-31 Thread MRAB
On 2018-05-31 15:18, Tobiah wrote: I had a case today where I needed to sort two string: ['Awards', 'Award Winners'] I consulted a few sources to get a suggestion as to what would be correct. My first idea was to throw them through a Linux command line sort: Awards Awa

Re: Why exception from os.path.exists()?

2018-05-31 Thread Paul Moore
On 31 May 2018 at 16:11, Steven D'Aprano wrote: > On Thu, 31 May 2018 22:46:35 +1000, Chris Angelico wrote: > [...] >>> Most other analogous reasons *don't* generate an exception, nor is that >>> possibility mentioned in the specification: >>> >>>https://docs.python.org/3/library/os.path.html?

Re: Why exception from os.path.exists()?

2018-05-31 Thread Steven D'Aprano
On Thu, 31 May 2018 22:46:35 +1000, Chris Angelico wrote: [...] >> Most other analogous reasons *don't* generate an exception, nor is that >> possibility mentioned in the specification: >> >>https://docs.python.org/3/library/os.path.html?#os.path.exists >> >> Is the behavior a bug? Shouldn't it

Override built in types... possible? or proposal.

2018-05-31 Thread Dan Strohl via Python-list
Is it possible to override the assignment of built in types to the shorthand representations? And if not, is it a reasonable thought to consider adding? For example, right now, if I do: test = "this is a string", I get back str("this is a string"). What if I want to return this as my_string

Re: Why exception from os.path.exists()?

2018-05-31 Thread Paul Moore
On 31 May 2018 at 15:01, Chris Angelico wrote: > Can someone on Windows see if there are other path names that raise > ValueError there? Windows has a whole lot more invalid characters, and > invalid names as well. On Windows: >>> os.path.exists('\0') ValueError: stat: embedded null character in

Re: Why exception from os.path.exists()?

2018-05-31 Thread MRAB
On 2018-05-31 14:38, Marko Rauhamaa wrote: Chris Angelico : Do you have an actual use-case where it is correct for an invalid path to be treated as not existing? Note that os.path.exists() returns False for other types of errors including: * File might exist but you have no access rights

RE: Indented multi-line strings (was: "Data blocks" syntax specification draft)

2018-05-31 Thread Dan Strohl via Python-list
> This is of course not a problem if the *trailing* quote determines the > indentation: > > a_multi_line_string = i''' >Py- > thon > ''' I get the point, but it feels like it would be a pain to use, and it "Feels" different from the other python indenting, which

Re: Problem with OrderedDict - progress report

2018-05-31 Thread Frank Millman
"Steven D'Aprano" wrote in message news:peorib$1f4$2...@blaine.gmane.org... On Thu, 31 May 2018 10:05:43 +0200, Frank Millman wrote: > From the interpreter session below, you will see that adding a key while > processing the *last* key in an OrderedDict does not give rise to an > exception. I

Sorting and spaces.

2018-05-31 Thread Tobiah
I had a case today where I needed to sort two string: ['Awards', 'Award Winners'] I consulted a few sources to get a suggestion as to what would be correct. My first idea was to throw them through a Linux command line sort: Awards Award Winners Then I did some Googling

Re: Why exception from os.path.exists()?

2018-05-31 Thread Gregory Ewing
Chris Angelico wrote: A Unix path name cannot contain a null byte, so what you have is a fundamentally invalid name. ValueError is perfectly acceptable. It would also make sense for it could simply return False, since a file with such a name can't exist. This is analogous to the way comparing

Re: Why exception from os.path.exists()?

2018-05-31 Thread Chris Angelico
On Thu, May 31, 2018 at 11:38 PM, Marko Rauhamaa wrote: > Chris Angelico : >> Do you have an actual use-case where it is correct for an invalid path >> to be treated as not existing? > > Note that os.path.exists() returns False for other types of errors > including: > > * File might exist but you

Re: Why exception from os.path.exists()?

2018-05-31 Thread Marko Rauhamaa
Chris Angelico : > Do you have an actual use-case where it is correct for an invalid path > to be treated as not existing? Note that os.path.exists() returns False for other types of errors including: * File might exist but you have no access rights * The pathname is too long for the file syst

Re: Why exception from os.path.exists()?

2018-05-31 Thread Chris Angelico
On Thu, May 31, 2018 at 11:03 PM, Marko Rauhamaa wrote: > Chris Angelico : > >> On Thu, May 31, 2018 at 10:03 PM, Marko Rauhamaa wrote: >>> >>> This surprising exception can even be a security issue: >>> >>>>>> os.path.exists("\0") >>>Traceback (most recent call last): >>> File "", l

Re: Why exception from os.path.exists()?

2018-05-31 Thread Marko Rauhamaa
Chris Angelico : > On Thu, May 31, 2018 at 10:03 PM, Marko Rauhamaa wrote: >> >> This surprising exception can even be a security issue: >> >>>>> os.path.exists("\0") >>Traceback (most recent call last): >> File "", line 1, in >> File "/usr/lib64/python3.6/genericpath.py", line

Re: Problem with OrderedDict - progress report

2018-05-31 Thread Steven D'Aprano
On Thu, 31 May 2018 10:05:43 +0200, Frank Millman wrote: > "Frank Millman" wrote in message news:pemchs$r12$1...@blaine.gmane.org... >> >> So working backwards, I have solved the first problem. I am no nearer >> to > figuring out why it fails intermittently in my live program. The message > from

Re: Why exception from os.path.exists()?

2018-05-31 Thread Chris Angelico
On Thu, May 31, 2018 at 10:03 PM, Marko Rauhamaa wrote: > > This surprising exception can even be a security issue: > >>>> os.path.exists("\0") >Traceback (most recent call last): > File "", line 1, in > File "/usr/lib64/python3.6/genericpath.py", line 19, in exists >os.

Why exception from os.path.exists()?

2018-05-31 Thread Marko Rauhamaa
This surprising exception can even be a security issue: >>> os.path.exists("\0") Traceback (most recent call last): File "", line 1, in File "/usr/lib64/python3.6/genericpath.py", line 19, in exists os.stat(path) ValueError: embedded null byte Most other analogous rea

EuroPython 2018: First list of accepted sessions available

2018-05-31 Thread Alexander C. S. Hendorf
We have received an amazing collection of 376 proposals. Thank you all for your contributions! Given the overwhelming quality of the proposals, we had some very difficult decisions to make. Nonetheless we are happy to announce we have published the first 120+ sessions. https://ep2018.europython.eu

Re: Pink Floyd: is there anybody in here?

2018-05-31 Thread Peter J. Holzer
On 2018-05-31 00:06:37 +, Steven D'Aprano wrote: > On Wed, 30 May 2018 21:53:05 +0100, Ben Bacarisse wrote: > > Rob Gaddi writes: > >> On 05/30/2018 09:34 AM, Paul Rubin wrote: > >>> I think Usenet posts are no longer getting forwarded to the mailing > >>> list, but now I wonder if this is get

Re: Problem with OrderedDict - progress report

2018-05-31 Thread Frank Millman
"Frank Millman" wrote in message news:pemchs$r12$1...@blaine.gmane.org... So working backwards, I have solved the first problem. I am no nearer to figuring out why it fails intermittently in my live program. The message from INADA Naoki suggests that it could be inherent in CPython, but I am n