Re: fixing an horrific formatted csv file.

2014-07-04 Thread Gregory Ewing

flebber wrote:

so in my file I had on line 44 this trainer name.

Michael, Wayne  John Hawkes

and in line 95 this horse name. Inz'n'out

this throws of my capturing correct item 9. How do I protect against this?


Use python's csv module to read the file. Don't try to
do it yourself; the rules for handling embedded commas
and quotes in csv are quite complicated. As long as
the file is a well-formed csv file, the csv module
should parse fields like that correctly.

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


Re: PEP8 and 4 spaces

2014-07-04 Thread Gregory Ewing

Steven D'Aprano wrote:

Disadvantages of tabs:
- Many standard Unix/Linux/POSIX tools have a hard time dealing with tabs.

I call such tools *broken*,


They're not broken, they're just using a different set of
conventions. Unix traditionally uses tab characters as a
form of space compression. The meaning of a tab is fixed,
and configurable indentation is done by inserting a suitable
combination of tabs and spaces.

As long as *all* your tools follow that convention, everything
is fine. The problems arise when you mix in tools that use
different conventions.

The truly broken tools IMO are things like mail handlers that
shrink away in terror when they see a tab and remove it
altogether. There's no excuse for that, as far as I can see.

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


Re: PEP8 and 4 spaces

2014-07-04 Thread Gregory Ewing

Steven D'Aprano wrote:


That's exactly the problem with tabs - whatever you think your code
looks like with tabs, other people will see quite different picture.


Why do you consider this a problem?


It's a problem if you try to use tabs for lining things
up in a tabular fashion in your source code.

The solution is not to use tabs for that -- only use
tabs for indentation, and use spaces for everything
else. Or, as PEP 8 suggests, don't try to line things
up in the first place.

I know it's ironic that tabs are no good for tabulation.
But it's unavoidable in a plain text format that doesn't
carry any metadata about how to interpret the tabs.

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


eGenix at the EuroPython Conference 2014

2014-07-04 Thread eGenix Team: M.-A. Lemburg


eGenix.com at the EuroPython Conference 2014

 July 21-27 2014
 Berlin, Germany



The EuroPython Conference (https://ep2014.europython.eu/) is the one
of the premier conferences for Python users and developers in
Europe. It is the second largest gathering of Python enthusiast around
the world. This year it is being held from July 21-27 in Berlin,
Germany.

This announcement is also available on our web-site for online reading:
http://www.egenix.com/company/news/EuroPython-Conference-2014.html


MEET UP WITH EGENIX AT EUROPYTHON

eGenix was one of the founding members of the EuroPython conference
team and played a major role in organizing the first EuroPython
conference in the year 2002.

Since then we have attended every EuroPython conference to meet up
face-to-face with the many people we know from the Python community
and the many people that we don't yet know from the community -- if
you are interested in meeting with us, please drop us a note so that
we can arrange a meeting at i...@egenix.com.


EGENIX TALKS AT EUROPYTHON

At this year's EuroPython, Marc-André Lemburg, CEO of eGenix, will be
giving a talk providing some insights into our experience with
large-scale database applications written in Python.

Advanced Database Programming with Python
-

Getting the best out of your database.

The Python DB-API 2.0 (http://www.python.org/dev/peps/pep-0249/)
provides a direct interface to many popular database backends. It
makes interaction with relational database very straight forward
and allows tapping into the full set of features these databases
provide.

The talk will cover advanced database topics which are relevant in
production environments such as locks, distributed transactions
and transaction isolation.

Friday, 11:30 CEST, Room C01

https://ep2014.europython.eu/en/schedule/sessions/104/

Enjoy,
-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jul 04 2014)
 Python Projects, Consulting and Support ...   http://www.egenix.com/
 mxODBC.Zope/Plone.Database.Adapter ...   http://zope.egenix.com/
 mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

2014-07-21: EuroPython 2014, Berlin, Germany ...   17 days to go

: Try our mxODBC.Connect Python Database Interface for free ! ::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PEP8 and 4 spaces

2014-07-04 Thread Marko Rauhamaa
wxjmfa...@gmail.com:

 Le vendredi 4 juillet 2014 08:35:04 UTC+2, Gregory Ewing a écrit :
 The truly broken tools IMO are things like mail handlers that shrink
 away in terror when they see a tab and remove it altogether. There's
 no excuse for that, as far as I can see.

 Yes, and you can extend this to the editors, which deliberately
 missusing the tabulation rules by inserting something else, eg. spaces
 (U+0020, 'SPACE').

A worthy flame war with top-class trolling mixed in. How could I stay
out?

My esteemed editor never misuses the tabulation rules as I have
instructed it to never insert TAB characters in files:

   (custom-set-variables
'(indent-tabs-mode nil))



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


flask sql cann't insert Variable in VALUES

2014-07-04 Thread Frank Liou
I try to insert username in to my table

it show

Internal Server Error
The server encountered an internal error and was unable to complete your 
request. Either the server is overloaded or there is an error in the 
application.

it maybe mean no request

i try to change username to '123123'

then it works

what's problem with this?



@app.route('/user/username',methods=['GET','POST'])
def hello(username):
if request.method=='POST':
save_friends(username)
return username


def save_friends(username):
conn = engine.connect()
conn.execute(INSERT INTO friends(name) VALUES(username))
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: flask sql cann't insert Variable in VALUES

2014-07-04 Thread Chris Angelico
On Fri, Jul 4, 2014 at 8:15 PM, Frank Liou fk2654159...@gmail.com wrote:
 I try to insert username in to my table

 it show

 Internal Server Error
 The server encountered an internal error and was unable to complete your 
 request. Either the server is overloaded or there is an error in the 
 application.

 ...
 def save_friends(username):
 conn = engine.connect()
 conn.execute(INSERT INTO friends(name) VALUES(username))

There are two things that you need to understand here, and rather than
give you the answers, I'm going to point you toward what you should
know. The first one is that your result page simply tells you that
there was an error; you need to look in the server logs to find the
actual text of the error. Get to know those logs; they'll collect all
sorts of errors for you. And the second is about the nature of SQL and
Python. Have a look at the basic documentation on parameterized
queries, and *be sure you understand it*. There is a lot more at stake
here than you might realize, so I'm not simply going to explain what's
wrong here; you absolutely must comprehend parameterized queries.

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


Re: fixing an horrific formatted csv file.

2014-07-04 Thread flebber
On Friday, 4 July 2014 14:12:15 UTC+10, flebber  wrote:
 I have taken the code and gone a little further, but I need to be able to 
 protect myself against commas and single quotes in names.
 
 
 
 How is it the best to do this?
 
 
 
 so in my file I had on line 44 this trainer name.
 
 
 
 Michael, Wayne  John Hawkes 
 
 
 
 and in line 95 this horse name.
 
 Inz'n'out
 
 
 
 this throws of my capturing correct item 9. How do I protect against this?
 
 
 
 Here is current code.
 
 
 
 import re
 
 from sys import argv
 
 SCRIPT, FILENAME = argv
 
 
 
 
 
 def out_file_name(file_name):
 
 take an input file and keep the name with appended _clean
 
 file_parts = file_name.split(.,)
 
 output_file = file_parts[0] + '_clean.' + file_parts[1]
 
 return output_file
 
 
 
 
 
 def race_table(text_file):
 
 utility to reorganise poorly made csv entry
 
 input_table = [[item.strip(' ') for item in record.split(',')]
 
for record in text_file.splitlines()]
 
 # At this point look at input_table to find the record indices
 
 output_table = []
 
 for record in input_table:
 
 if record[0] == 'Meeting':
 
 meeting = record[3]
 
 elif record[0] == 'Race':
 
 date = record[13]
 
 race = record[1]
 
 elif record[0] == 'Horse':
 
 number = record[1]
 
 name = record[2]
 
 results = record[9]
 
 res_split = re.split('[- ]', results)
 
 starts = res_split[0]
 
 wins = res_split[1]
 
 seconds = res_split[2]
 
 thirds = res_split[3]
 
 prizemoney = res_split[4]
 
 trainer = record[4]
 
 location = record[5]
 
 print(name, wins, seconds)
 
 output_table.append((meeting, date, race, number, name,
 
  starts, wins, seconds, thirds, prizemoney,
 
  trainer, location))
 
 return output_table
 
 
 
 MY_FILE = out_file_name(FILENAME)
 
 
 
 # with open(FILENAME, 'r') as f_in, open(MY_FILE, 'w') as f_out:
 
 # for line in race_table(f_in.readline()):
 
 # new_row = line
 
 with open(FILENAME, 'r') as f_in, open(MY_FILE, 'w') as f_out:
 
 CONTENT = f_in.read()
 
 # print(content)
 
 FILE_CONTENTS = race_table(CONTENT)
 
 # print new_name
 
 f_out.write(str(FILE_CONTENTS))
 
 
 
 
 
 if __name__ == '__main__':
 
 pass

So I found this on stack overflow

In [2]: import string

In [3]: identity = string.maketrans(, )

In [4]: x = ['+5556', '-1539', '-99', '+1500']

In [5]: x = [s.translate(identity, +-) for s in x]

In [6]: x
Out[6]: ['5556', '1539', '99', '1500']

but it fails in my file, due to I believe mine being a list of list. Is there 
an easy way to iterate the sublists without flattening?

Current code.

input_table = [[item.strip(' ') for item in record.split(',')]
   for record in text_file.splitlines()]
# At this point look at input_table to find the record indices
identity = string.maketrans(, )
print(input_table)
input_table = [s.translate(identity, ,') for s
   in input_table]

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


Re: PEP8 and 4 spaces

2014-07-04 Thread Chris “Kwpolska” Warrick
On Thu, Jul 3, 2014 at 7:31 PM, Tobiah tshep...@rcsreg.com wrote:
 Anyway, I gave up the 80 char line length long
 ago, having little feeling for some dolt on
 a Weiss terminal that for some reason needs to
 edit my code.

And yet, you did not give up an even more insane line length limit, in
e-mail.  The longest line in your original message is a measly 57
characters long.  The median line length is 46 characters.  Which is
pretty insane, and ultra-hard to read.  You can do more in e-mail.

 Each line of characters MUST be no more than 998 characters, and
 SHOULD be no more than 78 characters, excluding the CRLF.

That's the standard, [RFC 5322][]; the exact same quote appeared back
in [RFC 2822][].  However, many places actually want you to use a bit
less; common values include 70 or 72.  But still, it is MUCH more
roomy and readable than the value you use.

Here are the line lengths in the original message:

[47, 45, 45, 46, 46, 47, 45, 5, 46, 43, 46, 47, 47, 49, 31, 57, 52,
 34, 42, 23]

[RFC 5322]: http://tools.ietf.org/html/rfc5322#section-2.1.1
[RFC 2822]: http://tools.ietf.org/html/rfc2822#section-2.1.1

-- 
Chris “Kwpolska” Warrick http://kwpolska.tk
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: fixing an horrific formatted csv file.

2014-07-04 Thread flebber
On Friday, 4 July 2014 16:19:09 UTC+10, Gregory Ewing  wrote:
 flebber wrote:
 
  so in my file I had on line 44 this trainer name.
 
  
 
  Michael, Wayne  John Hawkes
 
  
 
  and in line 95 this horse name. Inz'n'out
 
  
 
  this throws of my capturing correct item 9. How do I protect against this?
 
 
 
 Use python's csv module to read the file. Don't try to
 
 do it yourself; the rules for handling embedded commas
 
 and quotes in csv are quite complicated. As long as
 
 the file is a well-formed csv file, the csv module
 
 should parse fields like that correctly.
 
 
 
 -- 
 
 Greg

True Greg worked easier

def race_table(text_file):
utility to reorganise poorly made csv entry
# input_table = [[item.strip(' ') for item in record.split(',')]
#for record in text_file.splitlines()]
# At this point look at input_table to find the record indices
# identity = string.maketrans(, )
# print(input_table)
# input_table = [s.translate(identity, ,') for s
#in input_table]
output_table = []
for record in text_file:
if record[0] == 'Meeting':
meeting = record[3]
elif record[0] == 'Race':
date = record[13]
race = record[1]
elif record[0] == 'Horse':
number = record[1]
name = record[2]
results = record[9]
res_split = re.split('[- ]', results)
starts = res_split[0]
wins = res_split[1]
seconds = res_split[2]
thirds = res_split[3]
try:
prizemoney = res_split[4]
finally:
prizemoney = 0
trainer = record[4]
location = record[5]
print(name, wins, seconds)
output_table.append((meeting, date, race, number, name,
 starts, wins, seconds, thirds, prizemoney,
 trainer, location))
return output_table

MY_FILE = out_file_name(FILENAME)

# with open(FILENAME, 'r') as f_in, open(MY_FILE, 'w') as f_out:
# for line in race_table(f_in.readline()):
# new_row = line
with open(FILENAME, 'r') as f_in, open(MY_FILE, 'w') as f_out:
CONTENT = csv.reader(f_in)
# print(content)
FILE_CONTENTS = race_table(CONTENT)
# print new_name
f_out.write(str(FILE_CONTENTS))


if __name__ == '__main__':
pass

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


Re: Is pip being automatically installed for Python 3.4.0?

2014-07-04 Thread Conrad Taylor
On Wednesday, July 2, 2014 9:59:46 PM UTC-7, Ned Deily wrote:
 In article a7809952-685b-489b-a94c-63b83c971...@googlegroups.com,
 
  Conrad Taylor conra...@gmail.com wrote:
 
  Hi, shouldn't pip be automatically installed for Python 3.4.0 release?  I 
 
  have read through the release and the PEP 453.  Thus, can someone confirm 
 
  whether or not this is the case?  BTW, I have installed Python 3.4.0 using 
 
  MacPorts.
 
 
 
 Like many other third-party package managers, MacPorts has chosen to 
 
 continue to distribute pip as a separate item.  To install it and the 
 
 MacPorts Python 3.4:
 
 
 
 sudo port install py34-pip
 

Yes, I have come to the same solution prior to the original post but I wanted 
to try the functionality in PEP 453 being that I would like to prepare 
instructions for others.

 
 
 -- 
 
  Ned Deily,
 
  n...@acm.org

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


Re: TextBlob on Windows

2014-07-04 Thread selvaperumal . p
On Saturday, 24 May 2014 04:45:14 UTC+5:30, subhaba...@gmail.com  wrote:
 Dear Group,
 
 
 
 It seems there is a nice language processing library named TextBlob, like 
 NLTK. 
 
 But I am being unable to install it on my Windows(MS-Windows 7 machine. I am 
 using Python 2.7
 
 
 
 If anyone of the esteemed members may kindly suggest me the solution.
 
 
 
 I tried the note in following URL
 
 http://stackoverflow.com/questions/20562768/trouble-installing-textblob-for-python
 
 
 
 but did not help much.
 
 
 
 Thanking in Advance,
 
 Regards,
 
 Subhabrata Banerjee.

hi mam i too having the same problem.
If you got any solution for the problem please let me know
I am in dire need of the package to be used in python.
please!
-- 
https://mail.python.org/mailman/listinfo/python-list


Why is regexp not working?

2014-07-04 Thread Florian Lindner
Hello,

I have that piece of code:

def _split_block(self, block):
cre = [re.compile(r, flags = re.MULTILINE) for r in self.regexps]
block = .join(block)
print(block)
print(---)
for regexp in cre:
match = regexp.match(block)
for grp in regexp.groupindex:
data = match.group(grp) if match else None
self.data[grp].append(data)


block is a list of strings, terminated by \n. self.regexps:


self.regexps = [rit (?Pcoupling_iterations\d+) .* dt complete yes | 
write-iteration-checkpoint |,
rit (?Pit_read_ahead\d+) read ahead


If I run my program it looks like that:


it 1 ahadf dt complete yes | write-iteration-checkpoint |
Timestep completed

---
it 1 read ahead
it 2 ahgsaf dt complete yes | write-iteration-checkpoint |
Timestep completed

---
it 4 read ahead
it 3 dfdsag dt complete yes | write-iteration-checkpoint |
Timestep completed

---
it 9 read ahead
it 4 dsfdd dt complete yes | write-iteration-checkpoint |
Timestep completed

---
it 16 read ahead
---
{'it_read_ahead': [None, '1', '4', '9', '16'], 'coupling_iterations': ['1', 
None, None, None, None]}

it_read_ahead is always matched when it should (all blocks but the first). 
But why is the regexp containing coupling_iterations only matched in the 
first block?

I tried different combinations using re.match vs. re.search and with or 
without re.MULTILINE.

Thanks!
Florian

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


Re: fixing an horrific formatted csv file.

2014-07-04 Thread F.R.

On 07/04/2014 12:28 PM, flebber wrote:

On Friday, 4 July 2014 14:12:15 UTC+10, flebber  wrote:

I have taken the code and gone a little further, but I need to be able to 
protect myself against commas and single quotes in names.



How is it the best to do this?



so in my file I had on line 44 this trainer name.



Michael, Wayne  John Hawkes



and in line 95 this horse name.

Inz'n'out



this throws of my capturing correct item 9. How do I protect against this?



Here is current code.



import re

from sys import argv

SCRIPT, FILENAME = argv





def out_file_name(file_name):

 take an input file and keep the name with appended _clean

 file_parts = file_name.split(.,)

 output_file = file_parts[0] + '_clean.' + file_parts[1]

 return output_file





def race_table(text_file):

 utility to reorganise poorly made csv entry

 input_table = [[item.strip(' ') for item in record.split(',')]

for record in text_file.splitlines()]

 # At this point look at input_table to find the record indices

 output_table = []

 for record in input_table:

 if record[0] == 'Meeting':

 meeting = record[3]

 elif record[0] == 'Race':

 date = record[13]

 race = record[1]

 elif record[0] == 'Horse':

 number = record[1]

 name = record[2]

 results = record[9]

 res_split = re.split('[- ]', results)

 starts = res_split[0]

 wins = res_split[1]

 seconds = res_split[2]

 thirds = res_split[3]

 prizemoney = res_split[4]

 trainer = record[4]

 location = record[5]

 print(name, wins, seconds)

 output_table.append((meeting, date, race, number, name,

  starts, wins, seconds, thirds, prizemoney,

  trainer, location))

 return output_table



MY_FILE = out_file_name(FILENAME)



# with open(FILENAME, 'r') as f_in, open(MY_FILE, 'w') as f_out:

# for line in race_table(f_in.readline()):

# new_row = line

with open(FILENAME, 'r') as f_in, open(MY_FILE, 'w') as f_out:

 CONTENT = f_in.read()

 # print(content)

 FILE_CONTENTS = race_table(CONTENT)

 # print new_name

 f_out.write(str(FILE_CONTENTS))





if __name__ == '__main__':

 pass

So I found this on stack overflow

In [2]: import string

In [3]: identity = string.maketrans(, )

In [4]: x = ['+5556', '-1539', '-99', '+1500']

In [5]: x = [s.translate(identity, +-) for s in x]

In [6]: x
Out[6]: ['5556', '1539', '99', '1500']

but it fails in my file, due to I believe mine being a list of list. Is there 
an easy way to iterate the sublists without flattening?

Current code.

 input_table = [[item.strip(' ') for item in record.split(',')]
for record in text_file.splitlines()]
 # At this point look at input_table to find the record indices
 identity = string.maketrans(, )
 print(input_table)
 input_table = [s.translate(identity, ,') for s
in input_table]

Sayth


Take Gregory's advice and use the csv module. Don't reinvent a csv 
parser. My csv splitter was the simplest approach possible, which I 
tend to use with undocumented formats, tweaking for unexpected features 
as they come along.


Frederic


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


capturing SNMP trap events

2014-07-04 Thread loial
I want to monitor printers for events such as the completion of printing. 
If the printer initiates an SNMP trap event when the job has finished printing, 
how can I capture this?

Presumably I need some sort of deamon to listen for these trap messages. I have 
looked at pySNMP but am not sure if this can be used to capture SNMP trap 
events from the printer.

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


Re: PEP8 and 4 spaces

2014-07-04 Thread Roy Smith
In article c1n08qfhvj...@mid.individual.net,
 Gregory Ewing greg.ew...@canterbury.ac.nz wrote:

 As long as *all* your tools follow that convention, everything
 is fine. The problems arise when you mix in tools that use
 different conventions.

The problem is, tools always get mixed.  I use emacs.  The next guy uses 
vi.  Somebody else uses Sublime.  The list goes on and on.  You will 
never control what tools other people use.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PEP8 and 4 spaces

2014-07-04 Thread Mihamina Rakotomandimby

On 07/04/2014 04:47 PM, Roy Smith wrote:

As long as*all*  your tools follow that convention, everything
is fine. The problems arise when you mix in tools that use
different conventions.

The problem is, tools always get mixed.  I use emacs.  The next guy uses
vi.  Somebody else uses Sublime.  The list goes on and on.  You will
never control what tools other people use.


This may be the subject of a PEP: What tool will you use :-)
--
https://mail.python.org/mailman/listinfo/python-list


Re: PEP8 and 4 spaces

2014-07-04 Thread Grant Edwards
On 2014-07-03, Emile van Sebille em...@fenx.com wrote:
 On 7/3/2014 2:23 PM, Tobiah wrote:
 I think your suggestion of having GIT handle the transformations
 is the way we'll go.  nothing to quibble or worry about.  Well put
 spaces in the repository since it still seems to be the community's
 preference and I'll convert to tabs with GIT on the fly.  Problem
 solved.

 Just watch out for mixed tabs and spaces in the same file -- a tab 
 counts as eight spaces and can be used interchangeably in python2.

Definitely. Indenting with tabs vs. spaces is mostly personal
preference (though spaces are better!). But, mixing the two is right
out, and should be stomped on hard.

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


Re: PEP8 and 4 spaces

2014-07-04 Thread Marko Rauhamaa
Grant Edwards invalid@invalid.invalid:

 Definitely. Indenting with tabs vs. spaces is mostly personal
 preference (though spaces are better!). But, mixing the two is right
 out, and should be stomped on hard.

Often one person writes the code and another person fixes bugs in it or
adds features to it. So if one uses tabs and the other refrains from
using them, you'll get the mixed style you abhor.

Even if we accepted that to be bad style, there's nothing on the screen
that would warn against such usage: the lines seemingly align perfectly,
and the code runs as expected.


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


Re: PEP8 and 4 spaces

2014-07-04 Thread Mark Lawrence

On 04/07/2014 15:28, Grant Edwards wrote:

On 2014-07-03, Emile van Sebille em...@fenx.com wrote:

On 7/3/2014 2:23 PM, Tobiah wrote:

I think your suggestion of having GIT handle the transformations
is the way we'll go.  nothing to quibble or worry about.  Well put
spaces in the repository since it still seems to be the community's
preference and I'll convert to tabs with GIT on the fly.  Problem
solved.


Just watch out for mixed tabs and spaces in the same file -- a tab
counts as eight spaces and can be used interchangeably in python2.


Definitely. Indenting with tabs vs. spaces is mostly personal
preference (though spaces are better!). But, mixing the two is right
out, and should be stomped on hard.



Yet another reason to switch to Python 3.

--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


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


Re: PEP8 and 4 spaces

2014-07-04 Thread Chris Angelico
On Sat, Jul 5, 2014 at 12:54 AM, Marko Rauhamaa ma...@pacujo.net wrote:
 Grant Edwards invalid@invalid.invalid:

 Definitely. Indenting with tabs vs. spaces is mostly personal
 preference (though spaces are better!). But, mixing the two is right
 out, and should be stomped on hard.

 Often one person writes the code and another person fixes bugs in it or
 adds features to it. So if one uses tabs and the other refrains from
 using them, you'll get the mixed style you abhor.

 Even if we accepted that to be bad style, there's nothing on the screen
 that would warn against such usage: the lines seemingly align perfectly,
 and the code runs as expected.

That depends on your editor. SciTE, for instance, will give a warning
any time indentation changes wrongly; if you mix tabs and spaces,
there'll be error markers at the beginning of each change (so if
there's one line with eight spaces amid a sea of tabs, that line and
the one below it will be marked).

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


Re: PEP8 and 4 spaces

2014-07-04 Thread Mark Lawrence

On 04/07/2014 15:54, Marko Rauhamaa wrote:

Grant Edwards invalid@invalid.invalid:


Definitely. Indenting with tabs vs. spaces is mostly personal
preference (though spaces are better!). But, mixing the two is right
out, and should be stomped on hard.


Often one person writes the code and another person fixes bugs in it or
adds features to it. So if one uses tabs and the other refrains from
using them, you'll get the mixed style you abhor.

Even if we accepted that to be bad style, there's nothing on the screen
that would warn against such usage: the lines seemingly align perfectly,
and the code runs as expected.

Marko



Only for the very old fashioned Python 2, the modern Python 3 has booted 
mixed tabs and spaces into touch.


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


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


Re: PEP8 and 4 spaces

2014-07-04 Thread Mark Lawrence

On 04/07/2014 14:59, Mihamina Rakotomandimby wrote:

On 07/04/2014 04:47 PM, Roy Smith wrote:

As long as*all*  your tools follow that convention, everything
is fine. The problems arise when you mix in tools that use
different conventions.

The problem is, tools always get mixed.  I use emacs.  The next guy uses
vi.  Somebody else uses Sublime.  The list goes on and on.  You will
never control what tools other people use.


This may be the subject of a PEP: What tool will you use :-)


I'll nominate our resident unicode expert to write the PEP as he's also 
an expert on tools.  Consider his superb use of the greatly loved google 
groups for example.  Sadly I understand that he has yet to master the 
intricacies of pip, but I'm sure that'll come with practice, or has he 
given up?


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


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


Re: PEP8 and 4 spaces

2014-07-04 Thread Marko Rauhamaa
Mark Lawrence breamore...@yahoo.co.uk:

 Only for the very old fashioned Python 2, the modern Python 3 has
 booted mixed tabs and spaces into touch.

Since Python 3 (alas!) got into the business of booting, it should have
booted tabs altogether.


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


Re: PEP8 and 4 spaces

2014-07-04 Thread George Silva
Isn't this an old discussion? Just configure your editor properly. In my
team we all use spaces, but I'll be damned if I need to type 12 spaces in a
row. I'll just configured Sublime to insert spaces instead of tabs. Problem
solved.


On Fri, Jul 4, 2014 at 12:12 PM, Mark Lawrence breamore...@yahoo.co.uk
wrote:

 On 04/07/2014 14:59, Mihamina Rakotomandimby wrote:

 On 07/04/2014 04:47 PM, Roy Smith wrote:

 As long as*all*  your tools follow that convention, everything
 is fine. The problems arise when you mix in tools that use
 different conventions.

 The problem is, tools always get mixed.  I use emacs.  The next guy uses
 vi.  Somebody else uses Sublime.  The list goes on and on.  You will
 never control what tools other people use.


 This may be the subject of a PEP: What tool will you use :-)


 I'll nominate our resident unicode expert to write the PEP as he's also an
 expert on tools.  Consider his superb use of the greatly loved google
 groups for example.  Sadly I understand that he has yet to master the
 intricacies of pip, but I'm sure that'll come with practice, or has he
 given up?


 --
 My fellow Pythonistas, ask not what our language can do for you, ask what
 you can do for our language.

 Mark Lawrence

 ---
 This email is free from viruses and malware because avast! Antivirus
 protection is active.
 http://www.avast.com


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




-- 
George R. C. Silva
SIGMA Consultoria

http://www.consultoriasigma.com.br/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PEP8 and 4 spaces

2014-07-04 Thread Emile van Sebille

On 7/4/2014 7:57 AM, Mark Lawrence wrote:

On 04/07/2014 15:28, Grant Edwards wrote:

On 2014-07-03, Emile van Sebille em...@fenx.com wrote:

snip

Just watch out for mixed tabs and spaces in the same file -- a tab
counts as eight spaces and can be used interchangeably in python2.


Definitely. Indenting with tabs vs. spaces is mostly personal
preference (though spaces are better!). But, mixing the two is right
out, and should be stomped on hard.



Yet another reason to switch to Python 3.


For new projects, sure. But since the v1.5 days I've deployed the 
current python version a dozen times a year on various one-offs so that 
I'm sure I've got every python version deployed somewhere, and they just 
run, so why fix something that works. Or upgrade it when a three line 
fix addresses the issue.


Emile


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


Re: Why is regexp not working?

2014-07-04 Thread MRAB

On 2014-07-04 13:27, Florian Lindner wrote:

Hello,

I have that piece of code:

 def _split_block(self, block):
 cre = [re.compile(r, flags = re.MULTILINE) for r in self.regexps]
 block = .join(block)
 print(block)
 print(---)
 for regexp in cre:
 match = regexp.match(block)
 for grp in regexp.groupindex:
 data = match.group(grp) if match else None
 self.data[grp].append(data)


block is a list of strings, terminated by \n. self.regexps:


self.regexps = [rit (?Pcoupling_iterations\d+) .* dt complete yes |
write-iteration-checkpoint |,
 rit (?Pit_read_ahead\d+) read ahead


If I run my program it looks like that:


it 1 ahadf dt complete yes | write-iteration-checkpoint |
Timestep completed

---
it 1 read ahead
it 2 ahgsaf dt complete yes | write-iteration-checkpoint |
Timestep completed

---
it 4 read ahead
it 3 dfdsag dt complete yes | write-iteration-checkpoint |
Timestep completed

---
it 9 read ahead
it 4 dsfdd dt complete yes | write-iteration-checkpoint |
Timestep completed

---
it 16 read ahead
---
{'it_read_ahead': [None, '1', '4', '9', '16'], 'coupling_iterations': ['1',
None, None, None, None]}

it_read_ahead is always matched when it should (all blocks but the first).
But why is the regexp containing coupling_iterations only matched in the
first block?

I tried different combinations using re.match vs. re.search and with or
without re.MULTILINE.


The character '|' is a metacharacter that separates alternatives. For
example, the regex 'a|b' will match 'a' or b'.

Your regexes end with '|', which means that they will match an empty
string at the start of the target string.

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


Re: PEP8 and 4 spaces

2014-07-04 Thread Mark Lawrence

On 04/07/2014 16:57, Emile van Sebille wrote:

On 7/4/2014 7:57 AM, Mark Lawrence wrote:

On 04/07/2014 15:28, Grant Edwards wrote:

On 2014-07-03, Emile van Sebille em...@fenx.com wrote:

snip

Just watch out for mixed tabs and spaces in the same file -- a tab
counts as eight spaces and can be used interchangeably in python2.


Definitely. Indenting with tabs vs. spaces is mostly personal
preference (though spaces are better!). But, mixing the two is right
out, and should be stomped on hard.



Yet another reason to switch to Python 3.


For new projects, sure. But since the v1.5 days I've deployed the
current python version a dozen times a year on various one-offs so that
I'm sure I've got every python version deployed somewhere, and they just
run, so why fix something that works. Or upgrade it when a three line
fix addresses the issue.

Emile



Surely the issue of mixing tabs and spaces is much more important than 
working systems? :)


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


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


Re: PEP8 and 4 spaces

2014-07-04 Thread Maciej Dziardziel
 Surely the issue of mixing tabs and spaces is much more important than 
 
 working systems? :)


Python 3 considers tabs as an error and refuses to work.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PEP8 and 4 spaces

2014-07-04 Thread Roy Smith
In article mailman.11497.1404486912.18130.python-l...@python.org,
 George Silva georger.si...@gmail.com wrote:

 Isn't this an old discussion? Just configure your editor properly. In my
 team we all use spaces, but I'll be damned if I need to type 12 spaces in a
 row. I'll just configured Sublime to insert spaces instead of tabs. Problem
 solved.

On emacs, I used auto-indent mode.  I hit tab, and it automatically 
inserts the correct number of spaces (where correct is 
language-specific; for Python, it uses the pep-8 rules).  It also does 
syntax highlighting, parenthesis and quote matching, keyword 
recognition, etc.

I assume any sane editor has similar functionality.  I see my coworkers 
using vim, sublime, eclipse, and X-code.  They all appear to do these 
things, and I would thus classify any of them as sane editors.  I'm sure 
there are others.  If the tool you're (in the generic sense of you) 
using doesn't have this type of basic language support, you should 
reconsider your choice of tool.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PEP8 and 4 spaces

2014-07-04 Thread Steven D'Aprano
On Fri, 04 Jul 2014 09:19:24 -0700, Maciej Dziardziel wrote:

 Surely the issue of mixing tabs and spaces is much more important than
 working systems? :)
 
 
 Python 3 considers tabs as an error and refuses to work.


Incorrect.


[steve@ando ~]$ python3
Python 3.3.0rc3 (default, Sep 27 2012, 18:44:58)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux
Type help, copyright, credits or license for more information.
=== startup script executed ===
py code = 
... def func():
... \treturn 23
...
... print( func() + 1000 )
... 
py
py exec(code)
1023



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


Re: PEP8 and 4 spaces

2014-07-04 Thread George Silva
 I assume any sane editor has similar functionality.  I see my coworkers
 using vim, sublime, eclipse, and X-code.  They all appear to do these
 things, and I would thus classify any of them as sane editors.  I'm sure
 there are others.  If the tool you're (in the generic sense of you)
 using doesn't have this type of basic language support, you should
 reconsider your choice of tool


Could not agree more :D
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: general module auditing

2014-07-04 Thread Irmen de Jong
On 4-7-2014 1:09, Rita wrote:
 
 here is what I am doing now,
 
 egrep 'from|import' *.py | wc -l which is giving me that. But this does not
 give me the number of times the particular module gets called. I was
 thinking of adding a logging feature to all of my modules so every time
 they get called it will be written to a log file with corresponding host
 and username. Is there an easy way to do that?


Okay I've read up a bit on Python import hooks and came up with the following 
code.
It hooks into Python's import mechanim by putting a custom loader into 
sys.meta_path
that logs the time, the user, the machine and the name of the module being 
imported.
Theoretically you could load this as a startup module (sitecustomize.py?) and 
make it
log to a central location or something like that.

The code at the end of this message outputs the following on my machine:

$ python audit.py
Hello I'm about to import a module.
2014-07-04 19:01:12,321 [irmen@Neptune] importing /cgi
2014-07-04 19:01:12,323 [irmen@Neptune] importing /urlparse
2014-07-04 19:01:12,328 [irmen@Neptune] importing /mimetools
[... and some more modules...]
Bye.



Code follows:


import sys
import logging
import socket
import os
import getpass


def setup_import_logging():
class ContextFilter(logging.Filter):
def filter(self, record):
record.hostname = socket.gethostname()
if sys.version_info  (3, 0):
record.username = getpass.getuser()
else:
record.username = os.getlogin()
return True

# configure the logger, adapt as desired:
logging.basicConfig(level=logging.DEBUG, format=%(asctime)s
[%(username)s@%(hostname)s] %(message)s)

class AuditingImporter(object):
log = logging.getLogger(auditingimporter)
log.setLevel(logging.DEBUG)
log.addFilter(ContextFilter())

def find_module(self, fullname, path):
return self.find_spec(fullname, path)

def find_spec(self, fullname, path, target=None):
self.log.debug(importing {path}/{fullname}.format(path=path or ,
fullname=fullname))
return None

sys.meta_path.insert(0, AuditingImporter())


setup_import_logging()

print(Hello I'm about to import a module.)

import cgi  # will generate a load of logging entries

print(Bye.)




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


Re: general module auditing

2014-07-04 Thread Irmen de Jong
On 4-7-2014 19:05, Irmen de Jong wrote:
 The code at the end of this message outputs the following on my machine:
[...]

hmm the formatting got screwed up a bit it seems.
Here's the same code: https://gist.github.com/irmen/c3d07118a8e1a00367f5


Irmen

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


Re: PEP8 and 4 spaces

2014-07-04 Thread Lie Ryan

On 04/07/14 07:55, Gregory Ewing wrote:

Steven D'Aprano wrote:


That's exactly the problem with tabs - whatever you think your code
looks like with tabs, other people will see quite different picture.


Why do you consider this a problem?


It's a problem if you try to use tabs for lining things
up in a tabular fashion in your source code.

The solution is not to use tabs for that -- only use
tabs for indentation, and use spaces for everything
else. Or, as PEP 8 suggests, don't try to line things
up in the first place.


PEP8 suggests using this style of method invocation:

obj.method(foo,
   bar,
   baz)

which is an effect impossible to do correctly with tabs alone. If you 
want to follow this style strictly, you end up having to either mix tabs 
and spaces, or just use spaces, or as I prefer it, avoid the issue 
altogether:


obj.method(
foo,
bar,
baz,
)

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


Re: PEP8 and 4 spaces

2014-07-04 Thread Simon Ward


On 4 July 2014 15:54:50 BST, Marko Rauhamaa ma...@pacujo.net wrote:
Even if we accepted that to be bad style, there's nothing on the screen
that would warn against such usage: the lines seemingly align
perfectly,
and the code runs as expected.

If using vim, set list and listchars, you get to highlight tabs and trailing 
spaces.

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


Re: PEP8 and 4 spaces

2014-07-04 Thread Roy Smith
In article mailman.11507.1404498596.18130.python-l...@python.org,
 Lie Ryan lie.1...@gmail.com wrote:

 PEP8 suggests using this style of method invocation:
 
  obj.method(foo,
 bar,
 baz)
 
 which is an effect impossible to do correctly with tabs alone.

If course you can do it with tabs. Just make sure all your method names 
are 7 letters long :-)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PEP8 and 4 spaces

2014-07-04 Thread Mark Lawrence

On 04/07/2014 20:04, Roy Smith wrote:

In article mailman.11507.1404498596.18130.python-l...@python.org,
  Lie Ryan lie.1...@gmail.com wrote:


PEP8 suggests using this style of method invocation:

  obj.method(foo,
 bar,
 baz)

which is an effect impossible to do correctly with tabs alone.


If course you can do it with tabs. Just make sure all your method names
are 7 letters long :-)



When the homework gets handed in I guess the lecturer will know who's 
read this thread :)


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


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


This Python script cannot open by a editor?

2014-07-04 Thread rxjwg98
Hi,

I am learning a Python Tool from web: 
http://www.ohwr.org/projects/hdl-make/wiki/Quick-start-new

I download the program to Ubuntu 12.04. I find that in the folder it is shown as
hdlmake-v1.0, 37.8 KB Python Script. I remember that script file can be loaded
to an editor to read its content. But, when I open it by double click, it is
shown as like binary file in GEDIT. 

What is the reason of this?

A general Python file has .py extension, and can be edited. Is it right?

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


Re: This Python script cannot open by a editor?

2014-07-04 Thread jkn
Hi there
the script is 'actually' a python script compressed, with a short header 
(see the '#!/usr/bin/python' right at the front? I'm guessing that if you make 
it executable, and run it, then it will either create a .py file that you can 
edit, or just run the hdlmake function that you want.

This is not very well explained on the wiki page that you link to... you might 
also try downloading the alternative distributions on the download page.

HTH
jon N


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


Re: PEP8 and 4 spaces

2014-07-04 Thread Gregory Ewing

Lie Ryan wrote:

PEP8 suggests using this style of method invocation:

obj.method(foo,
   bar,
   baz)

which is an effect impossible to do correctly with tabs alone.


Yes, PEP 8 is self-contradictory in that regard.
I also happen to think that recommendation is insane
for other reasons as well, and cheerfully ignore it.

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


Re: PEP8 and 4 spaces

2014-07-04 Thread Gregory Ewing

Roy Smith wrote:
The problem is, tools always get mixed.  I use emacs.  The next guy uses 
vi.  Somebody else uses Sublime.  The list goes on and on.  You will 
never control what tools other people use.


Yes, but my point is that none of the tools are broken,
they're just incompatible.

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


Re: PEP8 and 4 spaces

2014-07-04 Thread Tim Chase
On 2014-07-05 11:17, Gregory Ewing wrote:
  PEP8 suggests using this style of method invocation:
  
  obj.method(foo,
 bar,
 baz)
  
  which is an effect impossible to do correctly with tabs alone.  
 
 Yes, PEP 8 is self-contradictory in that regard.
 I also happen to think that recommendation is insane
 for other reasons as well, and cheerfully ignore it.

To be fair, in the same section[1] that example is given, it also
suggests

# More indentation included to distinguish this from the rest.
def long_function_name(
var_one, var_two, var_three,
var_four):
print(var_one)

# Hanging indents should add a level.
foo = long_function_name(
var_one, var_two,
var_three, var_four)

both of which can be done with arbitrary indentation without the need
to mix tabs+spaces or use a non-integer multiple of
indentation-spaces.  I just use these two in all instances and (as
you, Greg, advise), cheerfully ignore [the first form]


The only time I intentionally violate the don't do these section


# Arguments on first line forbidden when not using vertical alignment.
foo = long_function_name(var_one, var_two,
var_three, var_four)


is when defining options in optparse:

  parser.add_option(-v, --verbose,
help=be prolix,
action=store_true,
dest=verbose,
default=False,
)

as I find that a little easier to read when I'm scanning large blocks
of parser.add_option(...) calls, having the option stick out to the
right.

-tkc

[1] http://legacy.python.org/dev/peps/pep-0008/#indentation




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


Re: This Python script cannot open by a editor?

2014-07-04 Thread Steven D'Aprano
On Fri, 04 Jul 2014 14:50:02 -0700, rxjwg98 wrote:

 Hi,
 
 I am learning a Python Tool from web:
 http://www.ohwr.org/projects/hdl-make/wiki/Quick-start-new

Did you read that web page? It says:

To get the code you have two choices: you might clone the 
repository, which contains the most recent changes (more 
features, more bugs too...) or download a frozen version 
in a form of a binary file.


 I download the program to Ubuntu 12.04. I find that in the folder it is
 shown as hdlmake-v1.0, 37.8 KB Python Script. 

At the bash shell from inside that folder, run:

file hdlmake-v1.0


What does it say?



 I remember that script
 file can be loaded to an editor to read its content. But, when I open it
 by double click, it is shown as like binary file in GEDIT.
 
 What is the reason of this?

Because it is a binary file.


 A general Python file has .py extension, and can be edited. Is it right?

Python *source code* normally has a .py extension, although it could have 
no extension at all.

Python *byte code* is a binary file, usually with a .pyc or .pyo 
extension. On Windows, sometimes you also get .pyw.

You can also get Python code inside a zip file, which may have a .zip 
extension. On Windows, you can get Python code frozen in a .exe file, and 
I believe on Mac you can get it frozen in a .app file.



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


Re: PEP8 and 4 spaces

2014-07-04 Thread Rick Johnson
On Thursday, July 3, 2014 12:31:04 PM UTC-5, Tobiah wrote:
 Coworker takes PEP8 as gospel and uses 4 spaces snip

I'm saddened that every one of these little tabs versus
spaces arguments revolve more around selfishness and less
around an understanding of what a tabs and spaces
actually *are*, because, how can you solve a problem when
you're unable to understand the fundamental dicotomoy of
this relationship between tabs and spaces?

I believe the whole issue can be boiled down into: Use the
correct tool for the job. And there in lies the rub, before
we can make the *choice*, we must comprehend the
*differences*.


 What is a space


Duh!


 What is a tab


We all know tabs are used to present text in tabular form
(aka: tables), however, tabs are much more than merely a
concatenation-of-N-spaces. Not only do tabs allow a user
to control alignments via the mechanical process of pressing
the tab key, tabs also allow a more powerful and precise
hook into the underlying mechinism of vertical alignments
via rules defined by the user.

AND THIS LAST POINT IS THE TRUE POWER OF TABS!

Yes, tabs are an extrapolation of spaces, but they are
also more powerful than a space could ever be. If we
imagine spaces and backspaces to be like *addtion* and
*subtraction*, we can extrapolate that tabs and um, well,
backtabs to be like *multiplication* and *division* -- not
in a quantitve sense of course, but in an exponentially
more powerful sense. 


 Tabs or spaces?


And now we must answer the burning question. 

Not that my habits really matter but I myself use only
spaces and NEVER tabs, and i only use four spaces, never
more, never less,,, and i don't use spaces because i prefer
spaces over tabs, no, i use spaces because spaces are going
to render the same in all editors.

Strangly, I rather fancy the idea of using tabs in code,,,
which allow each viewer to view the code in his or her level
of indention,,, however, i cannot justify using a tab as a
replacement for a space. Tabs should be used for tabular
data (aka: speadsheets), and since code is NOT tabular data,
we would be wise to use the space char for indention.

from brain import logic
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PEP8 and 4 spaces

2014-07-04 Thread Rick Johnson
[A continuation of my last reply...]

Here is a recent situation that occurred to me that showcases
the tendency of humans to carelessly bind illogical terms to
common objects, thereby creating a inverse esoteric of
ubiquitous illogic, in this case, the term: flash-light.


 Illuminating the illogical:


A friend and myself where working outside and as the light
began to fade he realized we needed a light source, so he
called out: 

SOMEBODY GET ME A FLASH-LIGHT!

As i was heading in to grab a flashlight i realized the
bombastic insanity of such a term. Why is a handheld light
called a flashlight? It does not flash, in fact, its main
purpose is to provide a consistent light source that is easy
to carry, whereas flashing would be quite annoying!

*And just then that mischievous little inner voice started
whispering in my ear, giving me ideas, Muahahah!*

So i returned to my friend who was already quite annoyed
with his repair project, and started flashing the light on
and off. He quickly turned around and demanded: What the
hell are you doing?, to which i replied, You asked for a
flash-light, yes?

Of course everyone knows that a flash light does not
flash, so why do we continue to propagate such foolish
terms? Well, for the same reason language designers keep
giving us illogical terms like function and class, but i
digress.

The point is we go around the world falsely believing we have
a strong grasp of the simple things, when in fact, a whole
world of illogic infects our understanding of even the most
basic aspects of our lives.

Of course, I'm anxiously await my friend to ask for a drop
light -- oh boy, that will be fun! :^)
-- 
https://mail.python.org/mailman/listinfo/python-list


Your message to sqlite-users awaits moderator approval

2014-07-04 Thread sqlite-users-bounces
Your mail to 'sqlite-users' with the subject

hi

Is being held until the list moderator can review it for approval.

The reason it is being held:

Post by non-member to a members-only list

Either the message will get posted to the list, or you will receive
notification of the moderator's decision.  If you would like to cancel
this posting, please visit the following URL:


http://sqlite.org:8080/cgi-bin/mailman/confirm/sqlite-users/2d7d8debd5e7f2d664ffa70c079cc75008d59b73

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


[issue21720] TypeError: Item in ``from list'' not a string message

2014-07-04 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
assignee:  - rhettinger
nosy: +rhettinger

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21720
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14784] Re-importing _warnings changes warnings.filters

2014-07-04 Thread Mark Lawrence

Mark Lawrence added the comment:

I've just tried this and didn't see anything about warnings.filters changed.  
Full test run output in attached file.

--
nosy: +BreamoreBoy
Added file: http://bugs.python.org/file35848/Issue14784.log

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14784
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14841] os.get_terminal_size() should check stdin as a fallback

2014-07-04 Thread Mark Lawrence

Mark Lawrence added the comment:

#13609 is closed fixed so can this also be closed?  I've tried to reproduce 
this on Windows with the help of unxutils but it didn't want to know, sorry :(

--
nosy: +BreamoreBoy
type:  - behavior
versions: +Python 3.4, Python 3.5 -Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14841
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14788] Pdb debugs itself after ^C and a breakpoint is set anywhere

2014-07-04 Thread Mark Lawrence

Mark Lawrence added the comment:

A quick glance tells me the patch is okay, apart from the name 
test_issue_XXX, so can we have a formal patch review please.  See also #14743.

--
nosy: +BreamoreBoy
versions: +Python 3.4, Python 3.5 -Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14788
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14743] on terminating, Pdb debugs itself

2014-07-04 Thread Mark Lawrence

Mark Lawrence added the comment:

Can we have a formal patch review please, but note the similar patch on #14788.

--
nosy: +BreamoreBoy
versions: +Python 3.4, Python 3.5 -Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14743
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14934] generator objects can clear their weakrefs before being resurrected

2014-07-04 Thread Mark Lawrence

Mark Lawrence added the comment:

I'm still not brave enough to take on C code, but could this be handled by 
someone from the core-mentorship list?

--
nosy: +BreamoreBoy
versions: +Python 3.4, Python 3.5 -Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14934
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12067] Doc: remove errors about mixed-type comparisons.

2014-07-04 Thread Andy Maier

Andy Maier added the comment:

Terry,
I'd like to comment on your statement:
 3. By default, == and /= compare identities.
in msg148774.

What experiment lead you to that conclusion?

Here is one that contradicts it (using cpython 3.4.1):

 i1 = 42
 f1 = 42.0
 i1 == f1
True
 i1 is f1
False

Is it possible, that your experiment got influenced by the optimization that 
attempts to reuse existing objects of immutable types?
Like in this:

 i1 = 42
 i2 = 40 + 2
 i1 == i2
True
 i1 is i2
True

Andy

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12067
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21902] Docstring of math.acosh, asinh, and atanh

2014-07-04 Thread Raymond Hettinger

Raymond Hettinger added the comment:

 inverse' is probably more obvious to understand than 'area', 
 although it doesn't tie into the 'a' of 'acosh', etc.

Please don't make this gratuitous change.  The decision about whether to use 
inverse or arc was cast in stone when the functions were named acosh etc. 
  The documentation for C's math.h uses arc.  The docs for my hand 
calculators all use the term arc in the description of what the keys do.  Why 
create unnecessary divergence?  

If you truly think users of acosh can't cope with arc, then add a clarifying 
parenthetical for inverse.  But don't make the function name acosh more 
opaque by not showing what it actually stands for.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21902
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21720] TypeError: Item in ``from list'' not a string message

2014-07-04 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
assignee: rhettinger - 

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21720
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14841] os.get_terminal_size() should check stdin as a fallback

2014-07-04 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis added the comment:

This bug is still reproducible in Python 3.4 and 3.5.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14841
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21906] Tools\Scripts\md5sum.py doesn't work in Python 3.x

2014-07-04 Thread Berker Peksag

Berker Peksag added the comment:

Thanks Zachary! Here's a combined patch.

--
Added file: http://bugs.python.org/file35849/issue21906_v2.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21906
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12498] asyncore.dispatcher_with_send, disconnection problem + miss-conception

2014-07-04 Thread Xavier de Gaye

Xavier de Gaye added the comment:

 Sorry Xavier for your patches, but it's time to focus our efforts on a single 
 module and asyncio has a much better design to handle such use cases.

No problem. Thanks for taking your time to review patches made on this old 
module.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12498
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12067] Doc: remove errors about mixed-type comparisons.

2014-07-04 Thread Andy Maier

Andy Maier added the comment:

Uploaded v5 of the patch.

Changes:

1. The statement that comparison of different built-in types (always) raises 
TypeError, was too general. Changed to distinguish equal and order operators, 
as summarized by Ezio in items 3) and 4) of msg148760.

2. Ensured max line length of 80, in text areas affected by the patch.

Andy

--
versions: +Python 3.4
Added file: http://bugs.python.org/file35850/issue12067-expressions-py34_v5.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12067
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12067] Doc: remove errors about mixed-type comparisons.

2014-07-04 Thread Andy Maier

Andy Maier added the comment:

It seems I still need to practice creating patches ... uploading v6 which 
should create a review link. No other changes.
Sorry for that.
Andy

--
Added file: http://bugs.python.org/file35851/issue12067-expressions-py34_v6.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12067
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9554] test_argparse.py: use new unittest features

2014-07-04 Thread Berker Peksag

Berker Peksag added the comment:

Updated patch.

--
type: behavior - enhancement
Added file: http://bugs.python.org/file35852/issue9554_v3.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9554
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12067] Doc: remove errors about mixed-type comparisons.

2014-07-04 Thread Andy Maier

Andy Maier added the comment:

Another attempt. Really sorry...

--
Added file: http://bugs.python.org/file35853/issue12067-expressions-py34_v7.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12067
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21258] Add __iter__ support for mock_open

2014-07-04 Thread Arve Knudsen

Changes by Arve Knudsen arve.knud...@gmail.com:


--
nosy: +Arve.Knudsen

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21258
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21258] Add __iter__ support for mock_open

2014-07-04 Thread Arve Knudsen

Arve Knudsen added the comment:

I noticed this issue too, thanks for fixing it!

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21258
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14050] Tutorial, list.sort() and items comparability

2014-07-04 Thread Andy Maier

Andy Maier added the comment:

Uploaded patch version py34_v2, which contains the following changes relative 
to 3.4:

1. The changes in the description of list.sort() from default in list.sort(), 
by adding this text:
  (the arguments can be used for sort customization, see :func:`sorted` for 
their explanation)

2. The proposed extension of the description of list.sort() from patch version 
py32.

3. A statement that TypeError is raised if the ordering relationship is not 
established.

4. A reference where to look in order to establish ordering relationship for 
user-defined classes. (referencing the Basic customization section of the 
Language Reference).

5. A reference where the ordering relationships for built-in types are 
described (referencing the Comparison chapter of the Language Reference).

- Please review.

Andy

--
Added file: http://bugs.python.org/file35854/issue14050-list_sort-py34_v2.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14050
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14050] Tutorial, list.sort() and items comparability

2014-07-04 Thread Andy Maier

Andy Maier added the comment:

uploaded patch version py27_v2, which contains the same changes as py34_v2, 
relative to 2.7, except for this differences:

1. The change from default was already in 2.7.

2. The reference to defining ordering methods for user-defined classes includes 
a reference to object.__cmp__(), in addition.

- Please review

Andy

--
Added file: http://bugs.python.org/file35855/issue14050-list_sort-py27_v2.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14050
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21916] Create unit tests for turtle textonly

2014-07-04 Thread ingrid

New submission from ingrid:

Non-gui tests for turtle that Lita and I wrote.

--
components: Tests
files: test_turtle_textonly.patch
keywords: patch
messages: 82
nosy: ingrid, jesstess
priority: normal
severity: normal
status: open
title: Create unit tests for turtle textonly
versions: Python 3.5
Added file: http://bugs.python.org/file35856/test_turtle_textonly.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21916
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21915] telnetlib.Telnet constructor does not match telnetlib.Telnet.__init__ docstring

2014-07-04 Thread R. David Murray

R. David Murray added the comment:

There are reasons for both of these things.  In 2.7 we generally used the [] 
notation for keyword arguments.  In both, the timeout doesn't have a default 
that it is possible to document using our standard notation, so we use the [] 
notation.  If you can think of a better way to document this, there are several 
other places where we have similar timeout arguments that could also be 
improved (but we haven't thought of an acceptable way to improve it yet).

--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6953] readline documenation needs work

2014-07-04 Thread Andy Maier

Andy Maier added the comment:

I would like to revive this issue.

From the discussion, it seems to me that the following changes in the Python 
Library documentation would make sense:

1. Move add_history() higher up in the sequence of functions, for example  to 
after write_history_file().

2. Clarify that the pos arguments of remove_history_item() and 
replace_history_item() are 0-based.

3. Clarify that the index argument of get_history_item() is 1-based.
I do understand Stefan's comment from msg100757 that it is actually 
'history_base'-based. On the one hand, history_base is not exposed or implied 
or even described at the Python level. After searching the GNU readline 
documentation, it seems that a notion of history base is not described there, 
either (I may have missed it, though).
So either we simply state it is 1-based, or we provide in addition the 
background story mentioning some notion of history_base that is publicly 
described.

I have the following additional comments:

4. The current documentation is very abridged, probably because it intends to 
be just a description of the Python binding to GNU readline. I think it 
either needs to evolve into a standalone description (i.e. that does not depend 
on the description of GNU readline), or it needs to properly reference the 
description of GNU readline. If we go that route, a simple reference to the 
document is not sufficient, for one because it is not the only underlying 
implementation, and second, because it is large and not easy at all to map to 
the Python readline functions.

5. One needs to understand what the main entities are the module operates on, 
e.g. init file, history file(s), a (single, global?) history object, the line 
buffer. Regardless of what we do regarding comment 4., I think the Python docs 
should describe these main entities in the introduction text.

6. Some more information about the init file is needed. I suspect it is 
specific to the underlying implementation that is used. If so, add references 
to the format descriptions for each implementation (by Python OS platform).

7. parse_and_bind(): Change the description to state that it parses and binds 
the init statement provided in the string argument. That string may or may not 
come from an init file. The example at the end specifies a statement that is 
not from an init file.

8. get_line_buffer() talks about line buffer and insert_text() talks about 
command line. I suspect that means to be the same. If so, use one term 
consistently.
 
9. read_init_file(): I suspect it returns a tuple of statements from the init 
file? In any case, describe how the init file content comes back. Are comments 
removed? Where is the last filename used remembered, does that survive restarts 
of the Python runtime?

10. read_history_file(): Add that the history file content is put into a 
(global?) history object, replacing its prior history.

11. write_history_file(): Add that the (global?) history object is where the 
information comes from. Is an existing history file replaced? Appended? 
Exception raised?

12. clear_history(): From the text, I read that if the underlying GNU readline 
does not support it, this Python function does not exist in the module. If this 
is not how it works (e.g. if the function exists and raises an exception in the 
unsupported case), that text should be clarified.
Also, mention which version of GNU readline is minimally needed in order to 
support the function.

13. get_history_length(): It says get the desired length of the history file, 
but I think it is really the desired number of lines in the history file (i.e. 
consistent with set_history_length().

14. get_history_item() and remove_history_item() talk about history item, 
while all other functions talk about history line or line. Use one term 
consistently.

15. the completion related functions (from set_completer() to 
set_completion_display_matches_hook()) are really somewhat short:
What is the role of a completer function?
Which completion types are defined?
What is the beginning index of tab-completion?
What are word delimiters for tab-completion?

16. Last but not least, the libedit library is mentioned for MacOS. Has that 
been implemented yet, and is it part of standard Python? If so, mention that.

Andy

--
nosy: +andymaier
versions: +Python 3.4, Python 3.5 -Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6953
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21902] Docstring of math.acosh, asinh, and atanh

2014-07-04 Thread Mark Dickinson

Mark Dickinson added the comment:

Raymond: I don't think it's gratuitous.  I'd be happy to replace the 'inverse' 
by 'area' if that's what people prefer.  But hyperbolic arc cosine is just 
plain incorrect.  (And the in radians bit is utterly nonsensical.)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21902
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19711] add test for changed portions after reloading a namespace package

2014-07-04 Thread Mark Lawrence

Mark Lawrence added the comment:

Latest patch LGTM.  Can we have a patch review please as #18864 is dependent on 
this.

--
nosy: +BreamoreBoy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19711
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19714] Add tests for importlib.machinery.WindowsRegistryFinder

2014-07-04 Thread Mark Lawrence

Mark Lawrence added the comment:

Latest patch LGTM at a quick glance.  Can we have a patch review please as 
#18864 is dependent on this.

--
nosy: +BreamoreBoy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19714
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21099] Switch applicable importlib tests to use PEP 451 API

2014-07-04 Thread Mark Lawrence

Mark Lawrence added the comment:

Can we have a patch review please as #18864 is dependent on this.

--
nosy: +BreamoreBoy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21099
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18864] Implementation for PEP 451 (importlib.machinery.ModuleSpec)

2014-07-04 Thread Mark Lawrence

Mark Lawrence added the comment:

I've asked for patch reviewss on the three dependencies outstanding, #19711, 
#19714 and #21099.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18864
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21917] Python 2.7.7 Tests fail, and math is faulty

2014-07-04 Thread repcsike

New submission from repcsike:

Python is built with IBM XLC compiler, some tests fail and after installation 
mathematical executions are giving bad results. I corrected the 
_sysconfigdata.py bug (issue18235) with ld_so_aix , and found this out when 
tried to install some modules.
 
Please see this other issue for the other tests:
https://github.com/warner/python-ecdsa/issues/28

# ./configure --with-gcc=xlc_r -q64 AR=ar -X64 
--prefix=/usr/local/Python-2.7.7_64_test

# make

# make test
running build_scripts
find ./Lib -name '*.py[co]' -print | xargs rm -f
 ./python -Wd -3 -E -tt  ./Lib/test/regrtest.py -l
Traceback (most recent call last):
  File ./Lib/test/regrtest.py, line 220, in module
TEMPDIR = os.path.abspath(tempfile.gettempdir())
  File /tmp/Python-2.7.7/Lib/tempfile.py, line 269, in gettempdir
tempdir = _get_default_tempdir()
  File /tmp/Python-2.7.7/Lib/tempfile.py, line 197, in _get_default_tempdir
fd = _os.open(filename, flags, 0o600)
OverflowError: signed integer is greater than maximum
make: 1254-004 The error code from the last command is 1.
make: 1254-005 Ignored error code 1 from last command.
 ./python -Wd -3 -E -tt  ./Lib/test/regrtest.py -l
Traceback (most recent call last):
  File ./Lib/test/regrtest.py, line 220, in module
TEMPDIR = os.path.abspath(tempfile.gettempdir())
  File /tmp/Python-2.7.7/Lib/tempfile.py, line 269, in gettempdir
tempdir = _get_default_tempdir()
  File /tmp/Python-2.7.7/Lib/tempfile.py, line 197, in _get_default_tempdir
fd = _os.open(filename, flags, 0o600)
OverflowError: signed integer is greater than maximum
make: 1254-004 The error code from the last command is 1.


Stop.

--
components: Build
messages: 91
nosy: repcsike
priority: normal
severity: normal
status: open
title: Python 2.7.7 Tests fail, and math is faulty
type: compile error
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21917
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10289] Document magic methods called by built-in functions

2014-07-04 Thread Andy Maier

Andy Maier added the comment:

I have reviewed the descriptions of the built-in functions in Python 3.4, and 
found only the following issues w.r.t. missing __special__functions:

1. getattr(), setattr(), delattr(): They only refer to object attributes and 
miss to mention the fallback to object.__getattr__(), etc. Because hasattr() 
calls getattr() to test for the presence, the __getattr__() is relevant for 
hasattr() as well.

2. len() misses to describe that it uses s.__len__().

3. sorted() misses to describe how rich comparison methods can be used. I think 
we can integrate the changes to list.sort() proposed in issue14050.

4. str() delegates the description to stdtypes.html#str, which in turn does 
describe obj.__str__(). Not sure we need to do something for str().

I did not check 2.7 yet.

Andy

--
nosy: +andymaier
versions: +Python 3.4, Python 3.5 -Python 3.1, Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10289
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4972] context management support in imaplib, smtplib, ftplib

2014-07-04 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
versions: +Python 3.5 -Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4972
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21907] Update Windows build batch scripts

2014-07-04 Thread Jeremy Kloth

Changes by Jeremy Kloth jeremy.kloth+python-trac...@gmail.com:


--
nosy: +jkloth

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21907
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21917] Python 2.7.7 Tests fail, and math is faulty

2014-07-04 Thread Stefan Krah

Stefan Krah added the comment:

I think you need to figure out the right build flags -- we had
an xlc build slave for a while that did not have this behavior.

The flags were quite complicated though.

--
nosy: +skrah

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21917
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21743] Create tests for RawTurtleScreen

2014-07-04 Thread Lita Cho

Lita Cho added the comment:

submitted a patch that tests all of this. Issue 21914

--
resolution:  - duplicate
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21743
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12954] Multiprocessing logging under Windows

2014-07-04 Thread paul j3

paul j3 added the comment:

The documentation currently warns
https://docs.python.org/2/library/multiprocessing.html#windows

 Safe importing of main module

 Make sure that the main module can be safely imported by a new Python 
 interpreter without causing unintended side effects (such a starting a new 
 process).

The logging duplication that I mentioned here is one of those side effects.  So 
there's probably no need for further warnings.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12954
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21844] Fix HTMLParser in unicodeless build

2014-07-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Agree.

--
resolution:  - wont fix

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21844
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21715] Chaining exceptions at C level

2014-07-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Sorry. Here is it.

--
keywords: +patch
Added file: http://bugs.python.org/file35857/capi_chain_exceptions.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21715
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21881] python cannot parse tcl value

2014-07-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Interesting, what result of getdouble?

 import _tkinter
 tk = _tkinter.create()
 nan = float('nan')
 tk.getdouble(nan)
nan

What returns getdouble() (note that _tkinter is imported instead of tkinter!) 
for NaN value?

--
assignee:  - serhiy.storchaka

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21881
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19593] Use specific asserts in importlib tests

2014-07-04 Thread Mark Lawrence

Mark Lawrence added the comment:

Can we have a commit review on this please.  I've already asked for reviews on 
#18864 and its dependencies.

--
nosy: +BreamoreBoy
versions: +Python 3.5 -Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19593
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21881] python cannot parse tcl value

2014-07-04 Thread Andreas Schwab

Andreas Schwab added the comment:

 _tkinter.create().getdouble(float('nan'))
nan

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21881
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20544] Use specific asserts in operator tests

2014-07-04 Thread Mark Lawrence

Mark Lawrence added the comment:

There are 28 dependencies listed on #16510.  18 have already been closed, 
presumably with patches committed but I haven't checked them all.  10 are still 
open including this one.  Can we have a decision now as to whether we move 
forward with committing all of these changes, subject of course to formal 
review, or simply close the outstanding ones as won't fix.

--
nosy: +BreamoreBoy
versions: +Python 3.5 -Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20544
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21597] Allow turtledemo code pane to get wider.

2014-07-04 Thread Lita Cho

Lita Cho added the comment:

Hi Terry, I started digging into this deeper and it looks like my tests doesn't 
tear in Python 2.7. I have tried on Python 3.5 and 3.4 and it tears on those 
versions.

I also tried the ttk objects, and the widgets also teared when I added frames. 
Here is the code I tried.

from tkinter import *
from tkinter import ttk

paned = ttk.Panedwindow(orient=horizontal)
left = ttk.Frame(paned)
left.pack(side='left', fill='both', expand=True)
right = ttk.Frame(paned)
right.pack(side='right', fill='both', expand=True)
button = ttk.Button(left,text=lefgt pane)
button.pack( fill='both', expand=True)
button2 = ttk.Button(right, text=right pane)
button2.pack( fill='both', expand=True)
paned.add(left)
paned.add(right)
paned.pack(fill=both,expand=True, pady = (4,1), padx=4)

mainloop()

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21597
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21597] Allow turtledemo code pane to get wider.

2014-07-04 Thread Lita Cho

Lita Cho added the comment:

Should I file a bug? I feel like this a bug specifically related to Python 3 
and Tkinter.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21597
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21859] Add Python implementation of FileIO

2014-07-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Updated patch has included recent changes from C implementation (issue21679 and 
issue21090).

--
Added file: http://bugs.python.org/file35858/pyio_fileio_2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21859
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19279] UTF-7 can produce inconsistent Unicode string

2014-07-04 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
resolution:  - fixed
stage: patch review - resolved
status: open - closed
title: UTF-7 to UTF-8 decoding crash - UTF-7 can produce inconsistent Unicode 
string
versions: +Python 2.7, Python 3.3, Python 3.4 -Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19279
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19279] UTF-7 decoder can produce inconsistent Unicode string

2014-07-04 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
title: UTF-7 can produce inconsistent Unicode string - UTF-7 decoder can 
produce inconsistent Unicode string

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19279
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5712] tkinter - askopenfilenames returns string instead of tuple in windows 2.6.1 release

2014-07-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Som, what is full version of your Python?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5712
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21918] Convert test_tools to directory

2014-07-04 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Lib/test/test_tools.py becomes too large. It includes tests of unrelated 
command-lines tools and scripts. It would be good to convert it to directory 
containing separate test files for different tools.

--
components: Tests
messages: 222305
nosy: berker.peksag, serhiy.storchaka, zach.ware
priority: normal
severity: normal
stage: needs patch
status: open
title: Convert test_tools to directory
type: enhancement
versions: Python 2.7, Python 3.4, Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21918
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21597] Allow turtledemo code pane to get wider.

2014-07-04 Thread Ned Deily

Ned Deily added the comment:

If by tearing you mean leaving artifacts on the screen, differences in behavior 
are almost certainly due to different versions of Tk being used.  Tkinter is 
really just a wrapper around calls to Tk; nearly all of the heavy-duty graphics 
work is done by Tk making calls to other, platform-specific graphics libraries. 
 FWIW, I ran your last test with the current python.org 2.7.8 and 3.4.1 on OS X 
with the current ActiveTcl Tk 8.5.15 and they both performed identically: I 
expanded the frame to fill the screen and could cleanly move the slider to the 
left or right with no artifacts.

--
nosy: +ned.deily

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21597
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17652] Add skip_on_windows decorator to test.support

2014-07-04 Thread Mark Lawrence

Mark Lawrence added the comment:

I like the idea and the patch looks clean so can we have a commit review please.

--
nosy: +BreamoreBoy
versions: +Python 3.5 -Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17652
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17773] test_pydoc fails with the installed testsuite (2.7)

2014-07-04 Thread Mark Lawrence

Mark Lawrence added the comment:

Can this be closed as out of date?

--
nosy: +BreamoreBoy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17773
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17055] ftplib.ftpcp test

2014-07-04 Thread Mark Lawrence

Mark Lawrence added the comment:

LGTM so can we have a commit review please.

--
nosy: +BreamoreBoy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17055
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12067] Doc: remove errors about mixed-type comparisons.

2014-07-04 Thread Terry J. Reedy

Terry J. Reedy added the comment:

In py3, *everything* is an instance of class object. This makes like simple 
than in 2.x. The default comparison rules are set by the rich comparison 
methods of object. 'By experiment' meant by experiments with instances of 
object, which use those default methods, rather than by inspection of the 
relevant .c source code. Instances of subclasses taht do not override the 
defaults would act the same. Here is what seem to be the default code, from 
object.c, do_compare.  It verifies what I said (v, w are pointers, which 
represent identity):

/* If neither object implements it, provide a sensible default
   for == and !=, but raise an exception for ordering. */
switch (op) {
case Py_EQ:
res = (v == w) ? Py_True : Py_False;
break;
case Py_NE:
res = (v != w) ? Py_True : Py_False;
break;
default:
/* XXX Special-case None so it doesn't show as NoneType() */
PyErr_Format(PyExc_TypeError,
 unorderable types: %.100s() %s %.100s(),
 v-ob_type-tp_name,
 opstrings[op],
 w-ob_type-tp_name);
return NULL;
}
Py_INCREF(res);
return res;

Subclasses can and ofter do override the default methods. In particular, the 
number subclasses compare by value, across number types.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12067
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >