OT Re: Your IDE's?

2019-03-26 Thread DL Neil

Those of delicate disposition should look away now...



The invention is not mine: aside from his name, have a look at the
OP's purported email address, and his requested ReplyTo: address. Then
check the veracity of those domainNMs...


I only rarely do so as I can usually detect such from the pull on my
leg. :)
Cheers, Gene Heskett



Would that be a pull on your jeans' leg?

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


Re: configparser - which one?

2019-03-26 Thread Terry Reedy

On 3/25/2019 8:10 PM, Dave wrote:
I use Python3 3, and expected learning how to use configparser would be 
no big deal.  Well!  Seems there is configparser, stdconfigparser, and 


configparser is what IDLE uses.  I would read the extra or deleted 
features of the others and see if they apply to your client's project.


safeconfigparser, and multiple ways to set the section and entries to 
the section.  A little confusing.  I want to future-proof may code, so 
what should I be using?


As for setting the sections and entries, the following both work.

from configparser import ConfigParser    # Python 3 syntax
parser = ConfigParser()

parser['DEFAULT'] = {'Language': 'English',
  'Units': 'English',
  'UseDefaults': 'True',
  'NumberRidesDisplay': '30',
  'Pi': '3.14'}


The dict interface is newer but I doubt that the older one will go away. 
 (IDLE uses it because it predates the dict interface.  Since this code 
is pretty static, I do not currently see a payoff for conversion.)



parser.add_section('Default')
parser.set('default', 'language', 'english')
parser.set('default', 'units_measure', 'english')
parser.set('default', 'background_color', 'white')
parser.set('default', 'useDefaults', 'true')
parser.set('default', 'numToDisp', '12')
parser.set('default', 'pi', '3.14')

The advantage of the former is that it will handle 'DEFAULT', while the 
last one won't.  I like the former, but not sure if it is the future.


We do not remove things and break backwards compatibility lightly.

--
Terry Jan Reedy


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


[RELEASE] Python 3.8.0a3 is now available for testing

2019-03-26 Thread Łukasz Langa
It's time for the third alpha of Python 3.8.0. Go get it here:
https://www.python.org/downloads/release/python-380a3/

Python 3.8.0a3 is the third of four planned alpha releases of Python 3.8,
the next feature release of Python.  During the alpha phase, Python 3.8
remains under heavy development: additional features will be added
and existing features may be modified or deleted.  Please keep in mind
that this is a preview release and its use is not recommended for
production environments.  The last alpha release, 3.8.0a4, is planned
for 2019-04-29.

I am happy to say that this time all buildbots were properly green. Thank you 
to everybody who worked on that.

- Ł


signature.asc
Description: Message signed with OpenPGP
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Your IDE's?

2019-03-26 Thread Tim Chase
On 2019-03-25 21:38, John Doe wrote:
> What is your favorite Python IDE?

Unix.

https://sanctum.geek.nz/arabesque/series/unix-as-ide/

Namely $EDITOR (for some value of ed/vi/vim), a shell (usually
bash, ksh, or /bin/sh), a VCS (usually git, subversion, rcs, or
fossil, though sometimes CVS or Mercurial), and a whole suite of
other battle-tested tools that work together.

-tkc


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


Text Similarity/Comparison Question

2019-03-26 Thread David Lynch via Python-list
Hello.  I am working on a project where one system (System A) contains seven 
text fields (unstructured data for comments).
I have concatenated all of the fields into a single field.

There is a second system (System B) containing two unstructured fields that 
capture text comments.  I have concatenated these fields into a single field
just as I did for the first system.  This system contains highly sensitive and 
prohibitive data.

The issue that I'm trying to solve is that there should not be any text data 
from System B (sensitive narratives, investigative IDs, etc.)
In essence, I am trying to find the following three items:
1) Find direct references to investigations ("Investigation number ABC123")
2) Language that talks about references (i.e. "Jane Doe is under investigation")
3) Actual cut-and-paste segments where they copied something verbatim from 
System B to System A in the commentary fields.

It seems as though I may have to use different text similarity (comparison 
between System A and System B text) or search techniques for one or more of the 
three items.
I was thinking that Cosine Similarity Computation (CSC) would perhaps be 
useful, but I thought I would solicit some advice as I'm a recent text analyst 
using Python.

Thank you in advance.


Kenneth R Adams
Compliance Technology and Analytics
TAS -Text Analytics as a Service
Wells Fargo & Co. |  401 South Tryon Street, Twenty-sixth Floor | Charlotte, NC 
28202
MAC: D1050-262
Cell: 704-408.5157

kenneth.r.ad...@wellsfargo.com


[WellsFargoLogo_w_SC]

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


How to store scores of a race's players

2019-03-26 Thread ^Bart

Hello!

I need to store scores of three players for more than a race, after 
every race the user will read "Is the competition finished?", if the 
competition if finished the user will see the winner who got higest score:


p1 = int (input ("Insert score of the first player: "))
p2 = int (input ("Insert score of the second player: "))
p3 = int (input ("Insert score of the third player: "))

race = str (input ("Is the competition finished?"))

totalp1 = 0
totalp2 = 0
totalp3 = 0

winner = 0

if p1 > p2 and p1 > p3:
winner = c1
elif p2 > p1 and p2 > p3:
winner = p2
else:
winner = p3

if "yes" in race:
print("The winner is:",winner)
else:
p1 = int (input ("Insert score of the first player: "))
p2 = int (input ("Insert score of the second player: "))
p3 = int (input ("Insert score of the third player: "))

race = str (input ("Is the competition finished?"))

You read above just my toughts, is there someone who could help me to 
understand how to solve it?


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


Re: configparser - which one?

2019-03-26 Thread Dave

On 3/26/19 4:29 AM, Terry Reedy wrote:

On 3/25/2019 8:10 PM, Dave wrote:
I use Python3 3, and expected learning how to use configparser would 
be no big deal.  Well!  Seems there is configparser, stdconfigparser, and 


configparser is what IDLE uses.  I would read the extra or deleted 
features of the others and see if they apply to your client's project.


safeconfigparser, and multiple ways to set the section and entries to 
the section.  A little confusing.  I want to future-proof may code, so 
what should I be using?


As for setting the sections and entries, the following both work.

from configparser import ConfigParser    # Python 3 syntax
parser = ConfigParser()

parser['DEFAULT'] = {'Language': 'English',
  'Units': 'English',
  'UseDefaults': 'True',
  'NumberRidesDisplay': '30',
  'Pi': '3.14'}


The dict interface is newer but I doubt that the older one will go away. 
  (IDLE uses it because it predates the dict interface.  Since this code 
is pretty static, I do not currently see a payoff for conversion.)



parser.add_section('Default')
parser.set('default', 'language', 'english')
parser.set('default', 'units_measure', 'english')
parser.set('default', 'background_color', 'white')
parser.set('default', 'useDefaults', 'true')
parser.set('default', 'numToDisp', '12')
parser.set('default', 'pi', '3.14')

The advantage of the former is that it will handle 'DEFAULT', while 
the last one won't.  I like the former, but not sure if it is the future.


We do not remove things and break backwards compatibility lightly.

Thanks everyone.  So, I'll use configparser, but I do like the 
dictionary API as it makes the code a little easier as I can pass as 
arguments a section name and a dictionary with the contents to a 
function to write the complete section.


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


Re: How to store scores of a race's players

2019-03-26 Thread Bob Gailer
On Mar 26, 2019 6:55 AM, "^Bart"  wrote:
>
> Hello!
>
> I need to store scores of three players for more than a race, after every
race the user will read "Is the competition finished?", if the competition
if finished the user will see the winner who got higest score:
>
Thank you for reaching out to us for help as You Learn Python. A good
mailing list to use instead of the main python list is tu...@python.org.
I'm including that list in the reply addresses; please use that address in
the future and always reply all so a copy goes to that list.

This looks like a homework assignment. Be advised we won't write code for
you but we will help you when you get stuck and provide some guidance. I'm
personally curious as to who wrote that specification, since it is not well
written. One of the questions that fails to address is what if two or more
players have the same high score?

It's also a little hard to guide you since we don't know what you've
already learned. One of the fundamental concepts in computer programming is
that of a loop. Since the requirements indicate there will be more than one
race that requires a loop. The simplest python construction for a loop is a
while. Within that Loop you write the code once rather than rewriting it as
you have done. I hope that is enough to get you started. Please apply that
advice as best you can and come back with a revised program.

> p1 = int (input ("Insert score of the first player: "))
> p2 = int (input ("Insert score of the second player: "))
> p3 = int (input ("Insert score of the third player: "))
>
> race = str (input ("Is the competition finished?"))
>
> totalp1 = 0
> totalp2 = 0
> totalp3 = 0
>
> winner = 0
>
> if p1 > p2 and p1 > p3:
> winner = c1
> elif p2 > p1 and p2 > p3:
> winner = p2
> else:
> winner = p3
>
> if "yes" in race:
> print("The winner is:",winner)
> else:
> p1 = int (input ("Insert score of the first player: "))
> p2 = int (input ("Insert score of the second player: "))
> p3 = int (input ("Insert score of the third player: "))
>
> race = str (input ("Is the competition finished?"))
>
> You read above just my toughts, is there someone who could help me to
understand how to solve it?
>
> Regards.
> ^Bart
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: configparser - which one?

2019-03-26 Thread Jon Ribbens
On 2019-03-26, DL Neil  wrote:
> On 26/03/19 1:10 PM, Dave wrote:
>> I use Python3 3, and expected learning how to use configparser would be 
>> no big deal.  Well!  Seems there is configparser, stdconfigparser, and 
>> safeconfigparser, and multiple ways to set the section and entries to 
>> the section.  A little confusing.  I want to future-proof may code, so 
>> what should I be using?
>
> (with apologies for not answering the question directly)
>
> After striking this problem, I was encouraged to take a look at JSON, 
> and thence YAML. Once there, as they say, didn't look back!

Friends don't let friends use YAML. Indeed, I have always assumed that
YAML is a joke that got out of control, like the Flat Earth Society.
It's like they chose a list of goals and then set themselves a
challenge to design a solution that fails at meeting those goals in
the most spectacular way possible. I mean, the original point of it
was that it was a simpler replacement for XML but the YAML spec is
larger than the XML spec... that can't happen by accident, right?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: configparser - which one?

2019-03-26 Thread Grant Edwards
On 2019-03-26, Cameron Simpson  wrote:

> Like JSON, YAML etc are far far easier than XML for the reader.

If "far far easier than XML for the reader" is the bar, then we'll
have to keep "nailgun to the eyeballs" on the list...

That said, I agree with the rest of Cameron's post: for simpler stuff
.ini is darn hard to beat.  If you need nesting/arrays, then I'd
probably pick YAML over JSON.  Making simple changes to an
automatically-generated JSON file by hand is easy enough. But, I find
generating anything remotely complex by hand is far easier in YAML
than it is in JSON.  As usual, YMMV.

-- 
Grant Edwards   grant.b.edwardsYow! HUMAN REPLICAS are
  at   inserted into VATS of
  gmail.comNUTRITIONAL YEAST ...

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


Re: How to store scores of a race's players

2019-03-26 Thread Bob Gailer
Please do not use a mangled return email address. It causes us a lot of
pain when we fail to read your address to fix it and get the message
bounced back. The only reason I'm even bothering to resend it is because I
put a lot of work into it.:
> On
> Mar 26, 2019 6:55 AM, "^Bart"  wrote:
> >
> > Hello!
> >
> > I need to store scores of three players for more than a race, after
every race the user will read "Is the competition finished?", if the
competition if finished the user will see the winner who got higest score:
> >
> Thank you for reaching out to us for help as You Learn Python. A good
mailing list to use instead of the main python list is tu...@python.org.
I'm including that list in the reply addresses; please use that address in
the future and always reply all so a copy goes to that list.
>
> This looks like a homework assignment. Be advised we won't write code for
you but we will help you when you get stuck and provide some guidance. I'm
personally curious as to who wrote that specification, since it is not well
written. One of the questions that fails to address is what if two or more
players have the same high score?
>
> It's also a little hard to guide you since we don't know what you've
already learned. One of the fundamental concepts in computer programming is
that of a loop. Since the requirements indicate there will be more than one
race that requires a loop. The simplest python construction for a loop is a
while. Within that Loop you write the code once rather than rewriting it as
you have done. I hope that is enough to get you started. Please apply that
advice as best you can and come back with a revised program.
>
> > p1 = int (input ("Insert score of the first player: "))
> > p2 = int (input ("Insert score of the second player: "))
> > p3 = int (input ("Insert score of the third player: "))
> >
> > race = str (input ("Is the competition finished?"))
> >
> > totalp1 = 0
> > totalp2 = 0
> > totalp3 = 0
> >
> > winner = 0
> >
> > if p1 > p2 and p1 > p3:
> > winner = c1
> > elif p2 > p1 and p2 > p3:
> > winner = p2
> > else:
> > winner = p3
> >
> > if "yes" in race:
> > print("The winner is:",winner)
> > else:
> > p1 = int (input ("Insert score of the first player: "))
> > p2 = int (input ("Insert score of the second player: "))
> > p3 = int (input ("Insert score of the third player: "))
> >
> > race = str (input ("Is the competition finished?"))
> >
> > You read above just my toughts, is there someone who could help me to
understand how to solve it?
> >
> > Regards.
> > ^Bart
> > --
> > https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: mocking for get method in requests

2019-03-26 Thread Toni Sissala

On 18.1.2019 19:16, Shakti Kumar wrote:

Hello people,
I noticed something weird (weird as per my current knowledge, though I know
its subjective) today.


Hi Kumar,



mock_req.get('').return_value = 'Hello'


Here you are calling mock_req -MagicMocks get-method with parameter '' 
and assigning 'Hello' to its return value's return_value attribute. By 
default MagicMock instance methods always return a new MagicMock 
instance, which will create attributes on demand. You are not actually 
setting the return value of the patched requests, but rather assigning a 
return_value attribute to a local instance of a MagicMock.




mock_req.get.return_value = 'Hello'
Here you are assigning 'hello' to mock_req instance's get -methods 
return_value. This is probably what you are after. Notice that you are 
not actually calling any of its methods, only assigning.


Mocks are powerful but take some time to get use to.


>>> from unittest import mock
>>> a = mock.MagicMock()
>>> a.get.return_value = 'asd'
>>> a.get()
'asd'
>>> a.get.assert_called_once_with()
>>> b = mock.MagicMock()
>>> new_mock = b.get()
>>> new_mock.return_value = 'qwe'
>>> new_mock()
'qwe'
>>> b.get.assert_called_once_with()
>>> new_mock.assert_called_once_with()
>>> b.get()

>>> b.get.assert_called_once_with()
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.5/unittest/mock.py", line 802, in 
assert_called_once_with

    raise AssertionError(msg)
AssertionError: Expected 'get' to be called once. Called 2 times.



Hope this helps,

Toni




sample.py file

--

import requests
def random_testing():
 out = requests.get('www.cisco.com')
 a = out.json()
 return a


testing.py file

--

@patch(*’*sample.requests')
def test_random_testing(self, mock_req):
 mock_req.get('').return_value = 'Hello'
 out = api.random_testing()


Patching the sample.requests in this way does not lead the output of
requests.get() function in sample.py file to be ‘Hello’ as indicated
in
mock_req.get('').return_value = 'Hello'
Instead, it creates a new field called return_value in ‘out', and
hence out.return_value is ‘Hello’ instead of just ‘out’.

But if I patch it as,

@patch(*’*sample.requests')
def test_random_testing(self, mock_req):
 mock_req.get.return_value = 'Hello'
 out = api.random_testing()

It does give the value of ‘out’ as ‘Hello’ in sample.py file.
I know I am missing something, which is where I need some help :)

Thanks.



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


Re: The Mailing List Digest Project

2019-03-26 Thread Abdur-Rahmaan Janhangeer
Great! will see sphinx but if i find the html hard to customise, i'll drop
it.

Search feature and tags coming.

also, currently i'm formatting the mails rather than an article, i don't
know if a real summary of the topic preferable ...

Abdur-Rahmaan Janhangeer
Mauritius
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The Mailing List Digest Project

2019-03-26 Thread Christopher Barker
On Mon, Mar 25, 2019 at 10:01 PM Abdur-Rahmaan Janhangeer <
arj.pyt...@gmail.com> wrote:

> As proposed on python-ideas, i setup a repo to turn mail threads into
> articles.
>

Thanks for doing this — I find myself frequently telling people about past
relevant threads on this list - it will be great to have a single place to
point people. It can be hard to find stuff in the archives if you’re not
sure what to search for.

here is the repo
>
> https://github.com/Abdur-rahmaanJ/py-mailing-list-summary
>
> i included a script to build .md to .html
>

Maybe Sphinx and  RST instead? For consistency with other Python docs?

But markup is far less important than content.

-CHB

(with syntax highlighting) here is the index
>
> https://abdur-rahmaanj.github.io/py-mailing-list-summary/
>
> included 3 articles as a start
>
> if you want to contribute an article, just follow existing .md format and
> put it in the .md folder
>
> planning to go across ideas, list and dev
>
> i can tell you, it's a really enjoyable experience.
>
> psst. we can enhance some html later
>
> --
> Abdur-Rahmaan Janhangeer
> Mauritius
>
-- 
Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: configparser - which one?

2019-03-26 Thread dboland9
Thanks Cameron.

Dave,

March 26, 2019 12:39 AM, "Cameron Simpson"  wrote:

> On 25Mar2019 23:24, Dave  wrote:
> 
>> On 3/25/19 10:58 PM, DL Neil wrote:
>>> On 26/03/19 1:10 PM, Dave wrote:
>> 
>> I use Python3 3, and expected learning how to use configparser >>>would be 
>> no big deal.  Well! 
>> Seems there is configparser, >>>stdconfigparser, and safeconfigparser, and 
>> multiple ways to set
> the section and entries to the section.  A little confusing.  I >>>want 
> to future-proof may
>> code, so what should I be using?
>>> (with apologies for not answering the question directly)
>>> 
>>> After striking this problem, I was encouraged to take a look at >>JSON, and 
>>> thence YAML. Once
>>> there, as they say, didn't look back!
>>> - multi-dimensional possibilities, cf .ini
>>> - similarity/correspondence with Python data structures
>>> - convenient PSL
>>> - easily adopted by (power-)users, cf Python code
> 
> [...]
>>> 
>> 
>> Wish I could do that. Customer wants .ini. I would need to sell them >on an 
>> alternative. The issue
>> is human readable - .ini is easier for >people to understand.
> 
> And I agree with the customer, absent more info. Unless you need deeply 
> nested stuff, .ini is much
> easier for humans to read. Not everything is a match for it (unless you start 
> playing games with
> "[clause.subclause.subsubclause]" stuff, which I'd argue is a smell 
> indicating a format change
> might be good).
> 
> But for stuff which does fit nicely into .ini, it is FAR FAR easier on the 
> reader. Like JSON, YAML
> etc are far far easier than XML for the reader.
> 
> Lots of stuff, particularly simple configs, go well in .ini.
> 
> All that opinion aside: just use the configparser.ConfigParser class. It is 
> what _used_ to be
> "SafeConfigParser" in Python 2.
> 
> Here endith the lesson.
> 
> Cheers,
> Cameron Simpson 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: configparser - which one?

2019-03-26 Thread DL Neil

On 27/03/19 2:44 AM, Grant Edwards wrote:

On 2019-03-26, Cameron Simpson  wrote:


Like JSON, YAML etc are far far easier than XML for the reader.


If "far far easier than XML for the reader" is the bar, then we'll
have to keep "nailgun to the eyeballs" on the list...

That said, I agree with the rest of Cameron's post: for simpler stuff
.ini is darn hard to beat.  If you need nesting/arrays, then I'd
probably pick YAML over JSON.  Making simple changes to an
automatically-generated JSON file by hand is easy enough. But, I find
generating anything remotely complex by hand is far easier in YAML
than it is in JSON.  As usual, YMMV.



In my users' case, choosing YAML was a decision made before the 
(relatively) recent improvements to the .ini interface. (Thanks for that 
news!)


From a programmer's PoV, the convenience of having whatever 
config-file-rules handled within a library, so that your incoming data 
is 'reduced' to a dict/list structure, cannot be understated.


From a user's PoV, (the few who should ever be allowed to come into 
contact with such things) both .ini and YAML (and presumably) JSON are 
readily understandable, in my experience (YMMV) - perhaps in this case 
I've been 'blessed' with scientific/math/stats-types who are relatively 
'power users' and used to planning their experiments/analyses!


As far as specs go, I can't say I've ever bothered to read those for 
JSON, YAML, or even .ini. Have you? Read some article(s), started 
'playing', achieved what was required, no fuss-no muss... The previous 
post criticising same, lacks specifics, so can't learn from it. Earlier, 
mention was made of multiple 'dimensions' which are (at least to me, and 
those users) 'cleaner' in YAML/JSON/XML - however, heading 'too far' in 
that direction invites 'trouble'. What does the Zen of Python say about 
simplicity!


As with all tools, one really important criteria is the quality of 
information-provided when things 'go wrong'. We've all been frustrated 
because a 'missing comma/bracket/colon/...' "on line nnn" is not 
supposed to be there at all - and we've had to comb 'backwards' through 
the code to find where the missing punctuation should have been...


Given the relative ease with which both .ini and YAML can (now) be 
utilised (both by 'them' and by 'us'), there are not sufficient 
advantages/disadvantages to make it a 'big deal'. Other factors come 
into play and assume greater import: the OP mentioned 
user-preference/spec; whichever format this user's other systems 
utilise; the ease (reduced cost) of reaching into one's 'bag of tricks' 
for an already-coded ("re-usable") config-function...


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


Creating LF, NEL line terminators by accident? (python3)

2019-03-26 Thread Adam Funk
Hi,

I have a Python 3 (using 3.6.7) program that reads a TSV file, does
some churning with the data, and writes a TSV file out.

#v+
print('reading', options.input_file)
with open(options.input_file, 'r', encoding='utf-8-sig') as f:
for line in f.readlines():
row = line.split('\t')
# DO STUFF WITH THE CELLS IN THE ROW

# ...

print('writing', options.output_file)
with open(options.output_file, 'w', encoding='utf-8') as f:
# MAKE THE HEADER list of str
f.write('\t'.join(header) + '\n')

for doc_id in sorted(all_ids):
# CREATE A ROW list of str FOR EACH DOCUMENT ID
f.write('\t'.join(row) + '\n')
#v-

I noticed that the file command on the output returns "UTF-8 Unicode
text, with very long lines, with LF, NEL line terminators".

I'd never come across NEL terminators until now, and I've never
(AFAIK) created a file with them before.  Any idea why this is
happening?

(I tried changing the input encoding from 'utf-8-sig' to 'utf-8' but
got the same results with the output.)

Thanks,
Adam


-- 
I am at the moment writing a lengthy indictment against our
century. When my brain begins to reel from my literary labors, I make
an occasional cheese dip.---Ignatius J Reilly
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Creating LF, NEL line terminators by accident? (python3)

2019-03-26 Thread MRAB

On 2019-03-26 19:55, Adam Funk wrote:

Hi,

I have a Python 3 (using 3.6.7) program that reads a TSV file, does
some churning with the data, and writes a TSV file out.

#v+
print('reading', options.input_file)
with open(options.input_file, 'r', encoding='utf-8-sig') as f:
 for line in f.readlines():
 row = line.split('\t')
 # DO STUFF WITH THE CELLS IN THE ROW

# ...

print('writing', options.output_file)
with open(options.output_file, 'w', encoding='utf-8') as f:
 # MAKE THE HEADER list of str
 f.write('\t'.join(header) + '\n')

 for doc_id in sorted(all_ids):
# CREATE A ROW list of str FOR EACH DOCUMENT ID
f.write('\t'.join(row) + '\n')
#v-

I noticed that the file command on the output returns "UTF-8 Unicode
text, with very long lines, with LF, NEL line terminators".

I'd never come across NEL terminators until now, and I've never
(AFAIK) created a file with them before.  Any idea why this is
happening?

(I tried changing the input encoding from 'utf-8-sig' to 'utf-8' but
got the same results with the output.)

Does the input contain any NEL? Do the strings that you write out 
contain them?

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


Managing pipenv virtualenvs

2019-03-26 Thread Tim Johnson
I'm on ubuntu 16.04

using pipenv for the "Django for Beginners..." tutorial book.

each chapter instructs me to create a new virtual environment with a
folder under ~/.local/share/virtualenvs

folders are named with the project name followed by an hyphen and a
brief codified string.
examples
 helloworld-_e28Oloi
 pages-Du4qJjUr

What would happen if I deleted the first folder, which was created
in a previous chapter?

... trying to minimize my SSD real estate. 
thanks
-- 
Tim Johnson
http://www.tj49.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Managing pipenv virtualenvs

2019-03-26 Thread Test Bot
Nothing much i think. If you are properly managing dependencies for each
venv, then each new venv should have the same state as the previous one
along with some extra dependencies for each new chapter (haven't gone
through the specific book, but I am assuming that in the book, every
chapter builds on the previous one).

On a personal note it sounds strange why the author wants to have different
venv's for each chapter.

On Wed, Mar 27, 2019, 3:30 AM Tim Johnson  wrote:

> I'm on ubuntu 16.04
>
> using pipenv for the "Django for Beginners..." tutorial book.
>
> each chapter instructs me to create a new virtual environment with a
> folder under ~/.local/share/virtualenvs
>
> folders are named with the project name followed by an hyphen and a
> brief codified string.
> examples
>  helloworld-_e28Oloi
>  pages-Du4qJjUr
>
> What would happen if I deleted the first folder, which was created
> in a previous chapter?
>
> ... trying to minimize my SSD real estate.
> thanks
> --
> Tim Johnson
> http://www.tj49.com
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Your IDE's?

2019-03-26 Thread Cameron Simpson

On 25Mar2019 21:47, Tim Chase  wrote:

On 2019-03-25 21:38, John Doe wrote:

What is your favorite Python IDE?


Unix.

https://sanctum.geek.nz/arabesque/series/unix-as-ide/

Namely $EDITOR (for some value of ed/vi/vim), a shell (usually
bash, ksh, or /bin/sh), a VCS (usually git, subversion, rcs, or
fossil, though sometimes CVS or Mercurial), and a whole suite of
other battle-tested tools that work together.


The same.

A good terminal emultator helps a lot too: I use iTerm3 on a Mac, and it 
is outstanding. In particular, it lets one tile terminal sessions really 
well.


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


Re: Managing pipenv virtualenvs

2019-03-26 Thread Tim Johnson
* Test Bot  [190326 14:18]:
> Nothing much i think. If you are properly managing dependencies for each
> venv, then each new venv should have the same state as the previous one
  Good to hear

> along with some extra dependencies for each new chapter (haven't gone
> through the specific book, but I am assuming that in the book, every
> chapter builds on the previous one).
  The author's source code is on github, so I downloaded all of it
  for my edification.

  It appears that consecutive chapters do not always build on the
  following, i.e. have the previous chapter files.

  I guess I will find out why ...
  thank you
> On a personal note it sounds strange why the author wants to have different
> venv's for each chapter.
> 
> On Wed, Mar 27, 2019, 3:30 AM Tim Johnson  wrote:
> 
> > I'm on ubuntu 16.04
> >
> > using pipenv for the "Django for Beginners..." tutorial book.
> >
> > each chapter instructs me to create a new virtual environment with a
> > folder under ~/.local/share/virtualenvs
> >
> > folders are named with the project name followed by an hyphen and a
> > brief codified string.
> > examples
> >  helloworld-_e28Oloi
> >  pages-Du4qJjUr
> >
> > What would happen if I deleted the first folder, which was created
> > in a previous chapter?
> >
> > ... trying to minimize my SSD real estate.
> > thanks
> > --
> > Tim Johnson
> > http://www.tj49.com
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >
> -- 
> https://mail.python.org/mailman/listinfo/python-list

-- 
Tim Johnson
http://www.tj49.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Your IDE's?

2019-03-26 Thread Rich Shepard

On 2019-03-25 21:38, John Doe wrote:


What is your favorite Python IDE?


Emacs on Slackware.

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


Re: Managing pipenv virtualenvs

2019-03-26 Thread Test Bot
If the chapters are not contiguous then I can't find a reason to delete
them (previous venv). Moreover it would be better practice to keep separate
venv and not to use a single venv for multiple codebase. Highly discouraged
should be to use the systemwide interpreter.

Moreover the whole idea of using pipenv/pip is to make the venv easy to
recreate. That being said I would focus more on whether my
pipfile/requirements.txt is maintained properly or not. If it is then
spinning up the same venv is an easy task.

On Wed, Mar 27, 2019, 4:21 AM Tim Johnson  wrote:

> * Test Bot  [190326 14:18]:
> > Nothing much i think. If you are properly managing dependencies for each
> > venv, then each new venv should have the same state as the previous one
>   Good to hear
>
> > along with some extra dependencies for each new chapter (haven't gone
> > through the specific book, but I am assuming that in the book, every
> > chapter builds on the previous one).
>   The author's source code is on github, so I downloaded all of it
>   for my edification.
>
>   It appears that consecutive chapters do not always build on the
>   following, i.e. have the previous chapter files.
>
>   I guess I will find out why ...
>   thank you
> > On a personal note it sounds strange why the author wants to have
> different
> > venv's for each chapter.
> >
> > On Wed, Mar 27, 2019, 3:30 AM Tim Johnson  wrote:
> >
> > > I'm on ubuntu 16.04
> > >
> > > using pipenv for the "Django for Beginners..." tutorial book.
> > >
> > > each chapter instructs me to create a new virtual environment with a
> > > folder under ~/.local/share/virtualenvs
> > >
> > > folders are named with the project name followed by an hyphen and a
> > > brief codified string.
> > > examples
> > >  helloworld-_e28Oloi
> > >  pages-Du4qJjUr
> > >
> > > What would happen if I deleted the first folder, which was created
> > > in a previous chapter?
> > >
> > > ... trying to minimize my SSD real estate.
> > > thanks
> > > --
> > > Tim Johnson
> > > http://www.tj49.com
> > > --
> > > https://mail.python.org/mailman/listinfo/python-list
> > >
> > --
> > https://mail.python.org/mailman/listinfo/python-list
>
> --
> Tim Johnson
> http://www.tj49.com
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Managing pipenv virtualenvs

2019-03-26 Thread Tim Johnson
* Test Bot  [190326 15:44]:
> If the chapters are not contiguous then I can't find a reason to delete
> them (previous venv). Moreover it would be better practice to keep separate
> venv and not to use a single venv for multiple codebase. Highly discouraged
> should be to use the systemwide interpreter.
> 
> Moreover the whole idea of using pipenv/pip is to make the venv easy to
> recreate. That being said I would focus more on whether my
> pipfile/requirements.txt is maintained properly or not. If it is then
> spinning up the same venv is an easy task.
 
  thanks again, Test Bot ...

> On Wed, Mar 27, 2019, 4:21 AM Tim Johnson  wrote:
> 
> > * Test Bot  [190326 14:18]:
> > > Nothing much i think. If you are properly managing dependencies for each
> > > venv, then each new venv should have the same state as the previous one
> >   Good to hear
> >
> > > along with some extra dependencies for each new chapter (haven't gone
> > > through the specific book, but I am assuming that in the book, every
> > > chapter builds on the previous one).
> >   The author's source code is on github, so I downloaded all of it
> >   for my edification.
> >
> >   It appears that consecutive chapters do not always build on the
> >   following, i.e. have the previous chapter files.
> >
> >   I guess I will find out why ...
> >   thank you
> > > On a personal note it sounds strange why the author wants to have
> > different
> > > venv's for each chapter.
> > >
> > > On Wed, Mar 27, 2019, 3:30 AM Tim Johnson  wrote:
> > >
> > > > I'm on ubuntu 16.04
> > > >
> > > > using pipenv for the "Django for Beginners..." tutorial book.
> > > >
> > > > each chapter instructs me to create a new virtual environment with a
> > > > folder under ~/.local/share/virtualenvs
> > > >
> > > > folders are named with the project name followed by an hyphen and a
> > > > brief codified string.
> > > > examples
> > > >  helloworld-_e28Oloi
> > > >  pages-Du4qJjUr
> > > >
> > > > What would happen if I deleted the first folder, which was created
> > > > in a previous chapter?
> > > >
> > > > ... trying to minimize my SSD real estate.
> > > > thanks
> > > > --
> > > > Tim Johnson
> > > > http://www.tj49.com
> > > > --
> > > > https://mail.python.org/mailman/listinfo/python-list
> > > >
> > > --
> > > https://mail.python.org/mailman/listinfo/python-list
> >
> > --
> > Tim Johnson
> > http://www.tj49.com
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >
> -- 
> https://mail.python.org/mailman/listinfo/python-list

-- 
Tim Johnson
http://www.tj49.com
-- 
https://mail.python.org/mailman/listinfo/python-list


SCons 3.0.5 Released

2019-03-26 Thread Bill Deegan
A new SCons release, 3.0.5, is now available on the SCons download page:

https://scons.org/pages/download.html

And via pypi:
pip install scons

SCons is a tool for building software (and other files).  SCons is
implemented in Python, and its "configuration files" are actually Python
scripts, allowing you to use the full power of a real scripting language
to solve build problems.  You do not, however, need to know Python to
use SCons effectively.


Here is a summary of the changes since 3.0.4:

CHANGED/ENHANCED EXISTING FUNCTIONALITY

  - Change the default for AppendENVPath to delete_existing=0, so path
order will not be changed, unless explicitly set (Issue #3276)
  - Add lex construction variable LEXUNISTD for turning off unix headers on
windows
  - Update lex tool to use win_flex on windows if available
  - Add the textfile tool to the default tool list

FIXES

  - Fix Issue #3283 - Handle using --config=force in combination with
Decider('MD5-timestamp').
3.0.2 in fix for issue #2980 added that deciders can throw
DeciderNeedsNode exception.
The Configure logic directly calls the decider when using
--config=force but wasn't handling
that exception.  This would yield minimally configure tests using
TryLink() not running and
leaving TypeError Nonetype exception in config.log
  - Fix Issue #3303 - Handle --config=force overwriting the Environment
passed into Configure()'s
Decider and not clearing it when the configure context is completed.
  - Add default paths for yacc tool on windows to include cygwin, mingw,
and chocolatey
  - Fix issue #2799 - Fix mingw tool to respect SHCCCOMSTR, SHLINKCOMSTR
and LDMODULECOMSTR
  - Fix Issue #3329 - Add support for MS SDK V10.0A (which is commonly
installed with VS2017)
  - Fix Issue # - Add support for finding vswhere under 32 bit windows
installs.
  - Update the MSVC tool to include the nologo flag by default in RCFLAGS
  - Fixed bug which threw error when running SCons on windows system with
no MSVC installed.


IMPROVEMENTS
  - Do not store build host+user name if reproducible builds are wanted


git shortlog --no-merges -ns 3.0.4..HEAD
34  William Deegan
33  Mats Wichmann
18  Daniel
 4  Daniel Moody
 3  Bernhard M. Wiedemann
 2  Maciej Kumorek
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Your IDE's?

2019-03-26 Thread Tim Johnson
* Rich Shepard  [190326 15:19]:
> On 2019-03-25 21:38, John Doe wrote:
> 
> > What is your favorite Python IDE?
> 
> Emacs on Slackware.

  I'm an old Slacker, but got lazy and even older, so now use
  ubuntu.
  
  I also use emacs to which I have added evil and elpy; and further
  customized with plenty of my own elisp code. They won't take any
  of that away unless they pry it from my cold, dead fingers, but
  that's just me. :)
  
  I wouldn't wish emacs or vim on anyone who didn't feel that the
  learning curve was worth it.

  MTCW
-- 
Tim Johnson
http://www.tj49.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The Mailing List Digest Project

2019-03-26 Thread Christopher Barker
 On Tue, Mar 26, 2019 at 8:32 AM Abdur-Rahmaan Janhangeer <
arj.pyt...@gmail.com> wrote:

> Great! will see sphinx but if i find the html hard to customise, i'll drop
> it.
>

Sphinx has theming support, plus you can do custom CSS if you want. But
Highly discourage you from worrying about formatting — decent structure is
good enough, and content is what matters.

Search feature and tags coming.
>

Sphinx has search built in.

also, currently i'm formatting the mails rather than an article, i don't
> know if a real summary of the topic preferable ...
>

These mailing lists are really big, and the threads are long and scattered,
and they are archived and searchable already.

So I think the real value would be article-style summaries (with links to
the threads).

For Python-Ideas, I’m thinking kind of a mini rejected PEP ...

-CHB

>





> Abdur-Rahmaan Janhangeer
> Mauritius
>
-- 
Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The Mailing List Digest Project

2019-03-26 Thread Abdur-Rahmaan Janhangeer
#agree
-- 
https://mail.python.org/mailman/listinfo/python-list