[issue24789] ctypes doc string

2015-08-04 Thread David W. Lambert

New submission from David W. Lambert:

doc string suggests str is a valid init argument.  The code strongly 
discourages this.

ctypes.create_string_buffer

def create_string_buffer(init, size=None):
"""create_string_buffer(aBytes) -> character array
create_string_buffer(anInteger) -> character array
create_string_buffer(aString, anInteger) -> character array
"""
if isinstance(init, bytes):
if size is None:
size = len(init)+1
buftype = c_char * size
buf = buftype()
buf.value = init
return buf
elif isinstance(init, int):
buftype = c_char * init
buf = buftype()
return buf
raise TypeError(init)

--
components: ctypes
messages: 247998
nosy: LambertDW
priority: normal
severity: normal
status: open
title: ctypes doc string
versions: Python 3.4

___
Python tracker 
<http://bugs.python.org/issue24789>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16608] immutable subclass constructor call error does not show subclass name

2012-12-04 Thread David W. Lambert

David W. Lambert added the comment:

Sorry again.  You probably didn't follow the link I posted to see the
problem origination.   Which was "Cannot subclass str."  I generalized
this to tuple.

On Tue, 2012-12-04 at 20:08 +, R. David Murray wrote:
> R. David Murray added the comment:
> 
> I have no idea what you are referring to by 'constructing str' :(
> 
> I thought at first it was your incorrect tuple call in the init that was the 
> issue, but that didn't look right, and after reproducing it and playing with 
> it for a bit I figured out it was the __new__ failure, and I realized the 
> reason I was confused was that the error message said 'tuple' instead of 'c'. 
>  So I definitely think that message could use improvement if it is practical.
> 
> --
> 
> ___
> Python tracker 
> <http://bugs.python.org/issue16608>
> ___

--

___
Python tracker 
<http://bugs.python.org/issue16608>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16608] immutable subclass constructor call error does not show subclass name

2012-12-04 Thread David W. Lambert

David W. Lambert added the comment:

The apparent problem was that the constructing str with __init__ failed.  I now 
recall that immutables take initial values in the __new__ method.  Sorry!  
Otherwise, it was quite thoughtful for you to search for a problem.  Dave.

--

___
Python tracker 
<http://bugs.python.org/issue16608>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16608] subclass str fails

2012-12-04 Thread David W. Lambert

New submission from David W. Lambert:

http://forums.devshed.com/newreply.php?do=newreply&noquote=1&p=2838814

>>> class c(tuple):
...  def __init__(s,a,b):
...   tuple.__init__(s,a)
...   self.b = b
...
>>> c(tuple(),666)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: tuple() takes at most 1 argument (2 given)
>>>

--
components: Interpreter Core
messages: 176928
nosy: LambertDW
priority: normal
severity: normal
status: open
title: subclass str fails
type: behavior
versions: Python 2.7, Python 3.2

___
Python tracker 
<http://bugs.python.org/issue16608>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13485] tcl question

2011-11-26 Thread David W. Lambert

New submission from David W. Lambert :

I was unable to solve this question.

http://forums.devshed.com/python-programming-11/setting-tkinter-checkbox-default-graphical-state-865148.html

Summary: Trouble initiating button in "checked" state.

If you answer to me, I'll post the answer at the devshed forum.
If you answer at the forum I'll probably find it.

  
I doubt this is a python bug.  I doubt this is a tcl bug.  I think the proper 
forum would be the "How do I use tcl?" forum.  Sorry, I've posed the question 
here.

Thank you, Dave Lambert
also known as b49P23TIvg

--
components: Library (Lib)
messages: 148415
nosy: LambertDW
priority: normal
severity: normal
status: open
title: tcl question

___
Python tracker 
<http://bugs.python.org/issue13485>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13484] mail rejected: tu...@python.org

2011-11-26 Thread David W. Lambert

New submission from David W. Lambert :

I sent this question to tu...@python.org as advertised at
http://mail.python.org/mailman/listinfo/tutor
The message was returned, and we still need an answer to the question.  I'll 
post it as a separate bug.
Thank you, Dave.


From:   David Ward Lambert 
To: tu...@python.org
Subject:tkinter question I have not been able to resolve.
Date:   Mon, 21 Nov 2011 22:15:23 -0500


http://forums.devshed.com/python-programming-11/setting-tkinter-checkbox-default-graphical-state-865148.html

Summary: Trouble initiating button in "checked" state.

If you answer to me, I'll post the answer at the devshed forum.
If you answer at the forum I'll probably find it.

Thank you, Dave Lambert
also known as b49P23TIvg

--
components: None
messages: 148414
nosy: LambertDW
priority: normal
severity: normal
status: open
title: mail rejected: tu...@python.org

___
Python tracker 
<http://bugs.python.org/issue13484>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13202] subprocess __exit__ attribute missing

2011-10-17 Thread David W. Lambert

New submission from David W. Lambert :

There are a number of issues with subprocess and __exit__ , 12494 status fixed 
among them.

Program (which doesn't work as I had hoped, but that's not the issue):


'file p.py'

import subprocess as S

with 
S.Popen(('cat','-n',),shell=False,stdin=S.PIPE,stdout=S.PIPE,bufsize=1,universal_newlines=True)
 as p:
p.stdin.write('these\n')
print(p.stdout.readline())




Use:

$ python3 p.py

Traceback (most recent call last):
  File "p.py", line 5, in 
print(p.stdout.readline())
KeyboardInterrupt
$
$ python p.py
Traceback (most recent call last):
  File "p.py", line 3, in 
with 
S.Popen(('cat','-n',),shell=False,stdin=S.PIPE,stdout=S.PIPE,bufsize=1,universal_newlines=True)
 as p:
AttributeError: __exit__
$
$ python
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

--
components: Interpreter Core, Library (Lib)
messages: 145707
nosy: LambertDW
priority: normal
severity: normal
status: open
title: subprocess __exit__ attribute missing
versions: Python 2.7

___
Python tracker 
<http://bugs.python.org/issue13202>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8341] sphinx bug?

2010-04-07 Thread David W. Lambert

New submission from David W. Lambert :

http://docs.python.org/py3k/library/multiprocessing.html

Indentation is incorrect as displayed and copied from google chrome browser:


 from multiprocessing import Process

def f(name):
print('hello', name)

 if __name__ == '__main__':
 p = Process(target=f, args=('bob',))
 p.start()
 p.join()

--
assignee: georg.brandl
components: Documentation
messages: 102583
nosy: LambertDW, georg.brandl
severity: normal
status: open
title: sphinx bug?
versions: Python 3.2

___
Python tracker 
<http://bugs.python.org/issue8341>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8338] Outdated information

2010-04-07 Thread David W. Lambert

New submission from David W. Lambert :

http://docs.python.org/py3k/library/multiprocessing.html

Doc/library/multiprocessing.rst refers to "SimpleHTTPServer.HttpServer".  The 
patch changes this to "SimpleHTTPRequestHandler" although you may prefer 
"http.server.SimpleHTTPRequestHandler" or, of course, something entirely 
different.

Thanks, Dave.

--
assignee: georg.brandl
components: Documentation
files: multiprocessing_docs.patch
keywords: patch
messages: 102567
nosy: LambertDW, georg.brandl
severity: normal
status: open
title: Outdated information
versions: Python 3.1, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file16807/multiprocessing_docs.patch

___
Python tracker 
<http://bugs.python.org/issue8338>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5479] Add an easy way to provide total ordering now that __cmp__ is deprecated/gone

2010-04-05 Thread David W. Lambert

David W. Lambert  added the comment:

http://en.wikipedia.org/wiki/Total_order

For pair of items from a set,  (that's the total)
if  a <= b  and  b <= c  then  a <= c  (part of the order)
if  a <= b  and  b <= a  then  a compares the same as b, a == b, (the
other part of the order)

On Mon, 2010-04-05 at 19:46 +, Éric Araujo wrote:
> Éric Araujo  added the comment:
> 
> Hello
> 
> Small documentation question: Does the expression “total ordering” have 
> established usage in maths or computer science? Its meaning is not obvious to 
> the non-maths person that I am.
> 
> Regards
> 
> --
> 
> ___
> Python tracker 
> <http://bugs.python.org/issue5479>
> ___

--

___
Python tracker 
<http://bugs.python.org/issue5479>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8218] typo currect

2010-03-24 Thread David W. Lambert

David W. Lambert  added the comment:

I apologize for the noise.
Yes, I'll read the article carefully and provide changes as a unified
diff against the subversion trunk.

On Wed, 2010-03-24 at 08:20 +, Martin v. Löwis wrote:
> Martin v. Löwis  added the comment:
> 
> David, can you provide these changes as a unified diff against the subversion 
> trunk?
> 
> --
> nosy: +loewis
> 
> ___
> Python tracker 
> <http://bugs.python.org/issue8218>
> ___

--

___
Python tracker 
<http://bugs.python.org/issue8218>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8218] typo currect

2010-03-23 Thread David W. Lambert

David W. Lambert  added the comment:

There is an incredible number of frameworks
s/is/are/

The majority of users is best 
s/is/are/

o work together as good as possible.
s/good/well/

jects can be saven in a st
s/saven/saved/

Thank you.  I'm through for now.

--

___
Python tracker 
<http://bugs.python.org/issue8218>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8218] typo currect

2010-03-23 Thread David W. Lambert

David W. Lambert  added the comment:

you can rely an already existing

   rely on an

--

___
Python tracker 
<http://bugs.python.org/issue8218>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8218] typo currect

2010-03-23 Thread David W. Lambert

David W. Lambert  added the comment:

There is a number of middlewares

  are

--

___
Python tracker 
<http://bugs.python.org/issue8218>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8218] typo currect

2010-03-23 Thread David W. Lambert

David W. Lambert  added the comment:

much easier as is is specially designed

more easily and is especially designed

--

___
Python tracker 
<http://bugs.python.org/issue8218>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8218] typo currect

2010-03-23 Thread David W. Lambert

David W. Lambert  added the comment:

"Another problem ist the basic concept"

 is

--

___
Python tracker 
<http://bugs.python.org/issue8218>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8218] typo currect

2010-03-23 Thread David W. Lambert

David W. Lambert  added the comment:

In same file, "intermangled with Python” and it has a “Publisher” which 
destignates"

intermingled?
designates?

Thanks, Dave.

--

___
Python tracker 
<http://bugs.python.org/issue8218>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8218] typo currect

2010-03-23 Thread David W. Lambert

New submission from David W. Lambert :

http://docs.python.org/py3k/howto/webservers.html

The path to the interpreter in the shebang (#!/usr/bin/env python) must be 
currect.


Sorry man there are a great many distractions here.

--
assignee: georg.brandl
components: Documentation
messages: 101614
nosy: LambertDW, georg.brandl
severity: normal
status: open
title: typo currect
versions: Python 3.1

___
Python tracker 
<http://bugs.python.org/issue8218>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8217] typo unterlying

2010-03-23 Thread David W. Lambert

New submission from David W. Lambert :

http://docs.python.org/py3k/howto/webservers.html

The low-level view

When a user enters a web site, his browser makes a connection to the site’s 
webserver (this is called the request). The server looks up the file in the 
file system and sends it back to the user’s browser, which displays it (this is 
the response). This is roughly how the unterlying protocol, HTTP works.

--
assignee: georg.brandl
components: Documentation
messages: 101610
nosy: LambertDW, georg.brandl
severity: normal
status: open
title: typo  unterlying
versions: Python 3.1

___
Python tracker 
<http://bugs.python.org/issue8217>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7076] Documentation add note about SystemRandom

2010-01-22 Thread David W. Lambert

David W. Lambert  added the comment:

I recall an experience with a random file in /dev that was considerably slow 
after consuming its cache.  I used it as a seeder.  I've now got an ubuntu 
system for which /dev/urandom gives me a hundred million bytes quickly.  
Perhaps a nosy one has more information?

--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue7076>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7480] trite documentation issue.

2009-12-11 Thread David W. Lambert

New submission from David W. Lambert :

http://docs.python.org/dev/py3k/library/stdtypes.html#index-559

Proposal: remove last sentence from

"class.__bases__
The tuple of base classes of a class object. If there are no base 
classes, this will be an empty tuple."


Reason: Sentence is a python 2 relic.  The only case is this---

>>> object.__bases__
()

Point being that documentation should be clear, puzzles left as a 
comprehension test.

--
assignee: georg.brandl
components: Documentation
messages: 96269
nosy: LambertDW, georg.brandl
severity: normal
status: open
title: trite documentation issue.
versions: Python 3.1

___
Python tracker 
<http://bugs.python.org/issue7480>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7466] Segmentation fault after about 20 seconds on lenovo T500

2009-12-09 Thread David W. Lambert

David W. Lambert  added the comment:

Further isolation, following change removes segmentation fault: 

digital_roots = tuple(map(digital_root,factorization))

becomes

digital_roots = [digital_root(factor) for factor in 
factorization]

--

___
Python tracker 
<http://bugs.python.org/issue7466>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7466] Segmentation fault after about 20 seconds on lenovo T500

2009-12-09 Thread David W. Lambert

New submission from David W. Lambert :

'''
This brute [possibly a] solution to

http://projecteuler.net/index.php?section=problems&id=159

causes segmentation fault.


$ p3 # an AMD 64 bit build.
Python 3.1.1 (r311:74480, Oct  2 2009, 12:29:57) 
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more 
information.
>>>


The block between "load_primes" and "print(result)" can be written
as a single statement using various comprehensions.  sum(max(...))
The program does not seg-fault this way, but the result was wrong.
I unrolled the code to fix my algorithm, disclosing the segmentation 
fault.
'''

import functools
import operator
import itertools
import array

PrimeQ = Primes = 'use load_primes(n) function'

def load_primes(n):
global PrimeQ,Primes
PrimeQ = sieve(1+n)
Primes = array.array('L',(i for (i,Q,) in enumerate(PrimeQ) if Q))

def sieve(n):
a = array.array('b',(True,))*n
a[0] = a[1] = False
for (i,j) in enumerate(a):
if j:
for k in range(i**2,n,i):
a[k] = False
return a

def PrimeRange(a):
'''
see "load_primes"
'''
n = 1+int(a**(1/2))
for p in Primes:
if n < p:
raise StopIteration
yield p

def PrimeFactor(a):
'''
see "load_primes"

>>> load_primes(30)
>>> print([PrimeFactor(x)for x in (6,7,)])
[[2, 3], [7]]
'''
if (a < len(PrimeQ)) and PrimeQ[a]:
return [a]
for p in PrimeRange(a):
(q,r,) = divmod(a,p)
if not r:
return [p]+PrimeFactor(q)
return [a]

def product(a):
return functools.reduce(operator.mul,a,1)

def digital_root(n):
while 9 < n:
n = sum(map(int,str(n)))
return n

def partition(L, chain=itertools.chain):
'''
python recipe by Ray Hettinger
'''
s = L
n = len(s)
first, middle, last = [0], range(1, n), [n]
return [[L[a:b] for (a,b) in zip(chain(first, div), chain(div, 
last))]
for i in range(n) for div in itertools.combinations(middle, 
i)]





load_primes(1000)

s = 0
for n in range(2,10**6):
factorizations = [
[product(p)for p in group]for group in 
partition(PrimeFactor(n))]
mx = 0
for factorization in factorizations:
digital_roots = tuple(map(digital_root,factorization))
sdr = sum(digital_roots)
mx = max(mx,sdr)
s += mx

print('result!',s)

--
messages: 96190
nosy: LambertDW
severity: normal
status: open
title: Segmentation fault after about 20 seconds on lenovo T500
type: crash
versions: Python 3.1

___
Python tracker 
<http://bugs.python.org/issue7466>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7439] Bug or expected behavior? I cannot tell.

2009-12-05 Thread David W. Lambert

David W. Lambert  added the comment:

Thank you!

A prime sieve variant is a better way to generate the generalized
Hamming numbers I'm after, at least if the maximum is known ahead of
time.

Dave Lambert

--

___
Python tracker 
<http://bugs.python.org/issue7439>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7439] Bug or expected behavior? I cannot tell.

2009-12-04 Thread David W. Lambert

New submission from David W. Lambert :

Raymond Hettinger posted clever Hamming number generator,
http://code.activestate.com/recipes/576961/
which I tried to modify.  The function gives incorrect output when
called as hamming_numbers(shorthand = True).  It seemed reasonable to
expect the two arrangements of statements controlled by the shorthand
boolean to be functionally equivalent. 
http://docs.python.org/3.1/reference/executionmodel.html is relevant,
and makes me think this is not a bug, but I wish it were.  I'd
appreciate your determination.  Thanks, Dave.



from itertools import tee, chain, islice, groupby
from heapq import merge

def hamming_numbers(shorthand = False):

def deferred_output():
for i in output:
yield i

result, p2, p3, p5 = tee(deferred_output(), 4)

if shorthand:   # Lambert modification
m = [(a*x for x in p) for (a,p,) in ((2,p2),(3,p3),(5,p5))]
assert m[0] is not m[2]
merged = merge(*m)
else:   # original
m2 = (2*x for x in p2)
m3 = (3*x for x in p3)
m5 = (5*x for x in p5)
merged = merge(m2, m3, m5)

combined = chain([1], merged)
output = (k for k, v in groupby(combined))

return result


if __name__ == '__main__':
print(list(islice(hamming_numbers(), 10)))
print(list(islice(hamming_numbers(True), 10)))

--
components: Interpreter Core
messages: 95981
nosy: LambertDW
severity: normal
status: open
title: Bug or expected behavior?  I cannot tell.
type: behavior
versions: Python 3.1

___
Python tracker 
<http://bugs.python.org/issue7439>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7430] "cmp" still sends messages

2009-12-03 Thread David W. Lambert

New submission from David W. Lambert :

'''
RuntimeError: maximum recursion depth exceeded in cmp

Python 3.1.1 (r311:74480, Oct  2 2009, 12:29:57) 
[GCC 4.3.3] on linux2
'''

import itertools,pprint

combos = itertools.combinations

def connect(nodes,a,b):
nodes[a].append(b)
nodes[b].append(a)

def insert(nodes,components):
if components == 0:
pprint.pprint(nodes)
for (i,node,) in enumerate(nodes):
if not node:
break
i += 2
for joints in combos(range(i),2):
connect(nodes,*joints)
nest = [node[:]for node in nodes]
insert(nest,components-1)

def e155(components):
if components < 1:
return 0
network = [[]for i in range((components+1)*2)]
insert(network,components)
return network

e155(2)

--
messages: 95943
nosy: LambertDW
severity: normal
status: open
title: "cmp" still sends messages
versions: Python 3.1

___
Python tracker 
<http://bugs.python.org/issue7430>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7429] PrettyPrinter cannot print dicts with unsortable keys

2009-12-03 Thread David W. Lambert

David W. Lambert  added the comment:

I believe this issue was resolved---expect it in a future release.

--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue7429>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3976] pprint._safe_repr is not general enough in one instance

2009-11-18 Thread David W. Lambert

Changes by David W. Lambert :


--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue3976>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7237] Syntax error with not

2009-10-29 Thread David W. Lambert

David W. Lambert  added the comment:

problem also exists in 2.6.
It's a, in my humble opinion, release blocker.

--
type: compile error -> behavior

___
Python tracker 
<http://bugs.python.org/issue7237>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7237] Syntax error with not

2009-10-29 Thread David W. Lambert

New submission from David W. Lambert :

lambertdw$ p3
Python 3.1.1 (r311:74480, Oct  2 2009, 12:29:57) 
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> not 23
False
>>> not(23&1)
False
>>> 1+not(23&1)
  File "", line 1
1+not(23&1)
^
SyntaxError: invalid syntax
>>>

--
components: Interpreter Core
messages: 94675
nosy: LambertDW
severity: normal
status: open
title: Syntax error with not
type: compile error
versions: Python 3.1

___
Python tracker 
<http://bugs.python.org/issue7237>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5540] "file objects" in python 3 tutorial

2009-03-23 Thread David W. Lambert

David W. Lambert  added the comment:

File objects should not be discussed in the tutorial to emphasize that
the file type is gone.

File objects should be in the tutorial as a useful familiar concept.

--

___
Python tracker 
<http://bugs.python.org/issue5540>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5539] open documentation unclear

2009-03-22 Thread David W. Lambert

Changes by David W. Lambert :


--
assignee:  -> georg.brandl
components: +Documentation
nosy: +georg.brandl
versions: +Python 3.0

___
Python tracker 
<http://bugs.python.org/issue5539>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5540] "file objects" in python 3 tutorial

2009-03-22 Thread David W. Lambert

New submission from David W. Lambert :

http://docs.python.org/dev/py3k/tutorial/inputoutput.html#methods-of-
file-objects

Is it proper to discuss file objects in py3K?

--
assignee: georg.brandl
components: Documentation
messages: 83991
nosy: LambertDW, georg.brandl
severity: normal
status: open
title: "file objects" in python 3 tutorial
versions: Python 3.0

___
Python tracker 
<http://bugs.python.org/issue5540>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5539] open documentation unclear

2009-03-22 Thread David W. Lambert

New submission from David W. Lambert :

See thread
http://groups.google.com/group/comp.lang.python/browse_thread/thread/85e
c714aa6898d84#


En Sun, 22 Mar 2009 19:12:13 -0300, Benjamin Peterson   
 escribió: 
> Gabriel Genellina  yahoo.com.ar> writes: 
>> The undocumented behavior is relying on the open() builtin to return 
a 
>> BufferedReader for a binary file. 
> I don't see the problem. open() will return some BufferedIOBase   
> implmentor, and 
> that's all that TextIOWrapper needs. 


How do you know? AFAIK, the return value of open() is completely   
undocumented: 
http://docs.python.org/3.0/library/functions.html#open 
And if you open the  file in text mode, the return value isn't a   
BufferedIOBase. 
-- 
Gabriel Genellina 

The return value of open() is a "stream", according to 
http://docs.python.org/dev/py3k/library/io.html#module-io

--
messages: 83990
nosy: LambertDW
severity: normal
status: open
title: open documentation unclear

___
Python tracker 
<http://bugs.python.org/issue5539>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5513] "What's New" should say VERY CLEARLY that the type file is gone

2009-03-19 Thread David W. Lambert

David W. Lambert  added the comment:

My file class extends text files with seek or read through condition or 
pattern, providing an awk like pattern{action} task separation.

If I allow a pre-existing stream into my constructor (subprocess.Popen 
my favorite) I still suffer the same garbage collection problem.

class file(io.TextIOWrapper):
'add condition matching to a stream'
def __init__(self,stream_or_name):
a = stream_or_name
buffer = (a.buffer if isinstance(a, io.TextIOWrapper)
   else io.BufferedReader(io.FileIO(a, 'r')))
super().__init__(buffer)

Use this on a stream whose reference count goes to zero causes
ValueError: I/O operation on closed file.  Increasing stream's reference 
count by saving it with the object corrects it.

I appreciate your considerations.
Dave.

--

___
Python tracker 
<http://bugs.python.org/issue5513>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5513] "What's New" should say VERY CLEARLY that the type file is gone

2009-03-19 Thread David W. Lambert

David W. Lambert  added the comment:

#OOPS!  I forgot the subtlety.
#I must also retain the stream
#else it gets collected.
#Nasty.


import io

class file(io.TextIOWrapper):

'''condensing code for this list without test is a no no!'''

def __init__(self,name):
self.stream = open(name)   # SAVE THE STREAM!
super().__init__(self.stream.buffer)

--

___
Python tracker 
<http://bugs.python.org/issue5513>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5513] "What's New" should say VERY CLEARLY that the type file is gone

2009-03-19 Thread David W. Lambert

David W. Lambert  added the comment:

# With py3Krc1 it took me days to figure out how to
# replace my base class file.   Granted, there were
# issues with io module at the time.  Following met
# my need.


import io

class File(io.TextIOWrapper):

'''Open a text file with read access, providing...'''

def __init__(self,name):
super().__init__(open(name).buffer)

--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue5513>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1520662] support all of strftime(3)

2009-03-17 Thread David W. Lambert

David W. Lambert  added the comment:

(I have no clue where the servers are.)

--

___
Python tracker 
<http://bugs.python.org/issue1520662>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1520662] support all of strftime(3)

2009-03-17 Thread David W. Lambert

David W. Lambert  added the comment:

(with similar links for strpfime).


These are reasons a patch may be worth while:

x difficult to work around using ctypes module with c library.

x help(strftime)  advises the programmer to see the reference manual for 
formatting codes.

x Searching bugs.python.org open issues for strftime has 31 hits, some 
related.

--

___
Python tracker 
<http://bugs.python.org/issue1520662>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1520662] support all of strftime(3)

2009-03-17 Thread David W. Lambert

David W. Lambert  added the comment:

http://linux.die.net/man/3/strftime

or this link may be in USA, if you care:

http://www.manpagez.com/man/3/strftime/

--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue1520662>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2382] [Py3k] SyntaxError cursor shifted if multibyte character is in line.

2009-03-15 Thread David W. Lambert

David W. Lambert  added the comment:

Resolution of this may be applicable to Issue3446 as well.
"center, ljust and rjust are inconsistent with unicode parameters"

--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue2382>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3565] array documentation, method names not 3.0 compliant

2009-03-15 Thread David W. Lambert

Changes by David W. Lambert :


--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue3565>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5479] Add an easy way to provide total ordering now that __cmp__ is deprecated/gone

2009-03-12 Thread David W. Lambert

David W. Lambert  added the comment:

(As I recall) in python-dev mailing list Ray claimed he could clean up a
cited active state recipe to address this issue.  He succeeded to the
extent I'm aware---he's the author of
http://code.activestate.com/recipes/576685/.

I haven't used the redundant >, >= comparisons operators in code since
1981.  The chances of simplifying python by removing them from the
language are None, but the mistake predates python by 10**n years, where
(3 <= n <= 7) or (7 >= n >= 3).

--

___
Python tracker 
<http://bugs.python.org/issue5479>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5479] Add an easy way to provide total ordering now that __cmp__ is deprecated/gone

2009-03-12 Thread David W. Lambert

David W. Lambert  added the comment:

That's the best version I recall seeing at activestate.

Still, I'd deprecate and remove > and >= from mathematics.

--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue5479>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5476] datetime: timedelta(minutes = i) silently fails with numpy.int32 input

2009-03-11 Thread David W. Lambert

David W. Lambert  added the comment:

With older versions of each timedelta rejects the data type.  Maybe
that's a good resolution?

$ /usr/local/bin/python2.4 
Python 2.4.2 (#2, Jul  7 2006, 10:20:47) 
[GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.version.version
'0.9.8'
>>> from numpy import int32
>>> from datetime import timedelta
>>> assert timedelta(seconds = 36) == timedelta(seconds = int32(36))
Traceback (most recent call last):
  File "", line 1, in ?
TypeError: unsupported type for timedelta seconds component: int32scalar
>>>

--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue5476>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5420] Queue deprecation warning patch

2009-03-04 Thread David W. Lambert

Changes by David W. Lambert :


--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue5420>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5416] str.replace does strange things when given a negative count

2009-03-04 Thread David W. Lambert

David W. Lambert  added the comment:

I completely agree that this is a documentation issue.

Also, or perhaps for foolish completeness, in

http://docs.python.org/3.0/library/stdtypes.html

we would point out that the following group of string methods also work
for bytes and bytearrays.  Of these, only str type has format method.

"String Methods

String objects support the methods listed below. Note that none of these
methods take keyword arguments.

In addition, Python’s strings support the sequence type methods
described in the Sequence Types — str, bytes, bytearray, list, tuple,
range section. To output formatted strings, see the String Formatting
section. Also, see the re module for string functions based on regular
expressions."

--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue5416>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1175686] add "reload" function to IDLE

2009-03-03 Thread David W. Lambert

David W. Lambert  added the comment:

0->kbk

I avoid idle altogether and run python in emacs shell buffer.  Switching
windows usually involves mice.  Mice are evil.

emacs has gazillions of features.

artist mode (oops, mice!)
rectangular regions,
registers,
25 (hundreds with C-{digit}) reasonable places to move the cursor with a
couple keystrokes.
calc, modes, keyboard macros, mail, directory editing, buffer shared on
multiple x-servers ...

--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue1175686>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5383] Allow intermixing of keyword arguments and vargarg arguments

2009-02-27 Thread David W. Lambert

David W. Lambert  added the comment:

I think you need this order preserving paradigm using python as is: 

def xhtmlNode(tag,*args):
...

xhtmlNode('div', {'id':'sidebar'}, 'Hello world')


Less work in xhtmlNode might offset the extra work in writing the
function call.  Oh well, I didn't read the pythonforum thread.

--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue5383>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5382] Allow Python keywords as keyword arguments for functions.

2009-02-27 Thread David W. Lambert

David W. Lambert  added the comment:

You can sneak them in thusly:


def f(**kwargs):
print(kwargs)

f(**{'class':'sidebar'})

___
Python tracker 
<http://bugs.python.org/issue5382>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5382] Allow Python keywords as keyword arguments for functions.

2009-02-27 Thread David W. Lambert

David W. Lambert  added the comment:

Use cases are easy to find.
So easily found that there's probably a sound reason for reserved words.
The proposal couples lexical analysis to the parser.

# syntax error or name error?

def f():
class
return

def f(class):
class
return

--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue5382>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4318] optparse: formatting of help text/descriptions

2009-02-26 Thread David W. Lambert

David W. Lambert  added the comment:

granted, this isn't terribly difficult:

'\n'.join(textwrap.fill(line) for line in text.split('\n'))

___
Python tracker 
<http://bugs.python.org/issue4318>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4318] optparse: formatting of help text/descriptions

2009-02-26 Thread David W. Lambert

David W. Lambert  added the comment:

I'd like textwrap option to preserve new lines.  Actual case:

I have a code that produces cryptograms meant to be printed and solved 
with paper and pencil.  Standard format for cryptogram inserts space 
character between each character of the original text, doubling the line 
length.  textwrap is handy to fit the cryptogram back to paper width.

Problem: When text to "cryptogramize" is a limerick original line breaks 
should be preserved.


P A Y C Y   H J K   J   K Q L Z   B J U R   G C V F   P C Y I P ,   H A 
V 

 K V O N A P   I Y H   H J R K   P V   U Y U Y I P .   A Y C   P R E ' Y 
C 

 L A V L Z   G O B B   V G   E V V   G C V F   J   N O B B .   K A Y 

 U Q Y U   B J K P   I Q N A P ;   K A Y   H J K   K E Y I P . 

 J I V I R F V O K



import string
import random
import textwrap

def Shuffle(L):
random.shuffle(L)
return L

def create_cryptogram(quote):
"""
(disregards cryptogram rule that a letter can't stand for 
itself)
doctest omitted
"""
# wish: wrap line-by-line to preserve original line breaks
wrapped_quote = textwrap.fill(text=quote,width=38).upper()
d = {c:c for c in string.printable}
d['\n'] = '\n'*2
UC = string.ascii_uppercase
d.update(zip(UC,Shuffle(list(UC
return ' '.join(d[c] for c in wrapped_quote)

--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue4318>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5350] Modification to "pairwise" in itertools recipes

2009-02-23 Thread David W. Lambert

David W. Lambert  added the comment:

Nice.  I had thought of this a while ago but found counter example,
probably using the empty iterator

def f():
raise StopIteration
yield


I didn't realize "next" had optional argument.

___
Python tracker 
<http://bugs.python.org/issue5350>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5350] Modification to "pairwise" in itertools recipes

2009-02-23 Thread David W. Lambert

Changes by David W. Lambert :


--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue5350>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5332] csv sniffer

2009-02-20 Thread David W. Lambert

New submission from David W. Lambert :

Following instructions in
http://docs.python.org/dev/3.0/library/csv.html#module-csv
I opened file in binary mode.  This might be simply a documentation
problem or it may run deeper.  Text mode works on red hat linux system.

Here's the use:

>>> stream=open('csv','rb')
>>> dialect=csv.Sniffer().sniff(stream.read(1024))
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/users/lambert/bin/python/lib/python3.0/csv.py", line 169,
in sniff
self._guess_quote_and_delimiter(sample, delimiters)
  File "/usr/users/lambert/bin/python/lib/python3.0/csv.py", line 210,
in _guess_quote_and_delimiter
matches = regexp.findall(data)
TypeError: can't use a string pattern on a bytes-like object




Here's the conflicting documentation statement:

"If csvfile is a file object, it must be opened with the ‘b’ flag on
platforms where that makes a difference. ... see section Dialects and
Formatting Parameters.

All data read are returned as strings. No automatic data type conversion
is performed."

(Problem is that the binary file returnd data of type bytes.)

Thanks, Dave.

--
components: Library (Lib)
messages: 82546
nosy: LambertDW
severity: normal
status: open
title: csv sniffer
type: behavior
versions: Python 3.0

___
Python tracker 
<http://bugs.python.org/issue5332>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5331] multiprocessing hangs when Pool used within Process

2009-02-20 Thread David W. Lambert

David W. Lambert  added the comment:

Fails also on this system.

$ p3
Python 3.0.1 (r301:69556, Feb 13 2009, 23:52:55) 
[GCC 3.4.6 20060404 (Red Hat 3.4.6-3)] on linux2
(...)
>>> # use both hangs
(...)
>>> p.start()
>>> p.join()
(hmm la  do diii   laaa...)^C
Traceback (most recent call last):
  File "", line 1, in 
  File
"/usr/users/lambert/bin/python/lib/python3.0/multiprocessing/process.py",
line 119, in join
res = self._popen.wait(timeout)
  File
"/usr/users/lambert/bin/python/lib/python3.0/multiprocessing/forking.py",
line 118, in wait
return self.poll(0)
  File
"/usr/users/lambert/bin/python/lib/python3.0/multiprocessing/forking.py",
line 107, in poll
pid, sts = os.waitpid(self.pid, flag)
KeyboardInterrupt
>>>

--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue5331>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5295] turtle.py "dicionary" spelling patch

2009-02-17 Thread David W. Lambert

New submission from David W. Lambert :

x/lib/python3.0$ diff --unified turtle.py.bak turtle.py
--- turtle.py.bak   2009-02-17 11:29:15.0 -0500
+++ turtle.py   2009-02-17 11:29:37.0 -0500
@@ -2265,7 +2265,7 @@
"outline":   positive number
"tilt"   :   number
 
-This dicionary can be used as argument for a subsequent
+This dictionary can be used as argument for a subsequent
 pen()-call to restore the former pen-state. Moreover one
 or more of these attributes can be provided as keyword-arguments.
 This can be used to set several pen attributes in one statement.

--
components: Library (Lib)
messages: 82341
nosy: LambertDW
severity: normal
status: open
title: turtle.py "dicionary" spelling patch
type: behavior
versions: Python 3.0

___
Python tracker 
<http://bugs.python.org/issue5295>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5247] Unhelpful error message with str.format()

2009-02-13 Thread David W. Lambert

Changes by David W. Lambert :


--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue5247>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5237] Allow auto-numbered replacement fields in str.format() strings

2009-02-13 Thread David W. Lambert

David W. Lambert  added the comment:

Answering first question msg81873.

Without colon separator, this might be considered confusing:

>>> (
... '{d}{s}{f}{f}'.format(3, 'foo', 3.14, 2.72),
... '{d}{s}{f}{f}'.format(d=3, s='foo', f=3.14)
... )
('3foo3.142.72', '3foo3.143.14')

___
Python tracker 
<http://bugs.python.org/issue5237>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5237] Allow auto-numbered replacement fields in str.format() strings

2009-02-12 Thread David W. Lambert

David W. Lambert  added the comment:

I am net yet fluent in format method.  I meant

":" where "#" appeared.

Anyway, I think you need the colon. 
 
If from
print('{0:9}'.format(33))

you make the argument number implicit and remove the colon you'd get

print('{9}'.format(33))

which does and should raise IndexError.

___
Python tracker 
<http://bugs.python.org/issue5237>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5237] Allow auto-numbered replacement fields in str.format() strings

2009-02-12 Thread David W. Lambert

David W. Lambert  added the comment:

'{d}{s}{f}'.format(3, 'foo', 3.14)

is possibly unclear,
but is shorter than

'{#d}{#s}{#f}'.format(...)

--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue5237>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5229] Documentation for super() neglects to say what super() actually does

2009-02-12 Thread David W. Lambert

Changes by David W. Lambert :


--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue5229>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5032] itertools.count step

2009-02-12 Thread David W. Lambert

David W. Lambert  added the comment:

I run my shells with low priority so I can sneak around and kill them.

___
Python tracker 
<http://bugs.python.org/issue5032>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5186] Reduce hash collisions for objects with no __hash__ method

2009-02-11 Thread David W. Lambert

David W. Lambert  added the comment:

"x |= x>>4"

Are you (Ray) sure you didn't mean

"x ^= x>>4"?

--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue5186>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5221] help related topic doesn't exist

2009-02-11 Thread David W. Lambert

New submission from David W. Lambert :

help function is not current, then again, neither is my python3. 
Possibly sequencemethods[12] are eradicated.

$ p3
Python 3.0rc1+ (py3k, Nov  5 2008, 14:44:46) 
[GCC 3.4.6 20060404 (Red Hat 3.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> help('SEQUENCEMETHODS')
...

Related help topics: SEQUENCES, SEQUENCEMETHODS2, SPECIALMETHODS

>>> help('SEQUENCEMETHODS1')
no Python documentation found for 'SEQUENCEMETHODS1'

>>> help('SEQUENCEMETHODS2')
no Python documentation found for 'SEQUENCEMETHODS2'

--
components: Interpreter Core
messages: 81668
nosy: LambertDW
severity: normal
status: open
title: help  related topic doesn't exist
type: behavior
versions: Python 3.0

___
Python tracker 
<http://bugs.python.org/issue5221>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5192] Update log message formatting.

2009-02-09 Thread David W. Lambert

New submission from David W. Lambert :

Allow logger object log message creation methods using ''.format method.

have:

logger_object.info('%s','lazy is better')
logger_object.debug('{0!s}'.format('wasted effort'))


want:

logger_object.debug('{0}','Lazy')


Work'rounds from pep282:

if log.isEnabledFor(logging.INFO):
hamletStr = hamletDom.toxml()
log.info(hamletStr)

or install custom Formatter.

I presume this is already on the back burner.


Incidentally, BufferingFormatter.format uses string += string instead of
''.join(list_of_strings).

--
components: Library (Lib)
messages: 81461
nosy: LambertDW
severity: normal
status: open
title: Update log message formatting.
type: feature request
versions: Python 3.0, Python 3.1

___
Python tracker 
<http://bugs.python.org/issue5192>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5157] os.stat('foo') succeds if 'foo.exe' exists on cygwin

2009-02-05 Thread David W. Lambert

Changes by David W. Lambert :


--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue5157>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5142] pdb feature request: Ability to skip standard lib modules and other selected packages/modules

2009-02-03 Thread David W. Lambert

Changes by David W. Lambert :


--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue5142>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5126] Space character returns false from isprintable() method

2009-02-01 Thread David W. Lambert

David W. Lambert  added the comment:

Python 3.0rc1+ (py3k, Nov  5 2008, 14:44:46) [GCC 3.4.6 20060404 (Red 
Hat 3.4.6-3)] on linux2 Type "help", "copyright", "credits" or "license" 
for more information.
>>> ' '.isprintable()  # probably no surprise:
False
>>> import sys
>>> sys.getdefaultencoding()
'utf-8'

--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue5126>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5092] weird memory usage in multiprocessing module

2009-01-30 Thread David W. Lambert

David W. Lambert  added the comment:

#Ah!  Not a problem.  You need globals() and locals() dictionaries.
# as a python3 script, this message produces next couple lines output.

#method one
#yup, global a is gone
#method two
#{'gv': 'local here', 'name': 'gv'}
#yup, global gv is gone

print('method one')

a = ''

def Delete_a_global_variable():
global a
del a

Delete_a_global_variable()

try:
a
print('whoops!  this can never happen')
except NameError:
print('yup, global a is gone')

print('method two')

gv = '' # global variable

def delete_chosen_variable(name):
del globals()[name]
gv = 'local here'
print(locals())

delete_chosen_variable('gv')

try:
gv
print('whoops!  this can never happen')
except NameError:
print('yup, global gv is gone')

___
Python tracker 
<http://bugs.python.org/issue5092>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5109] array.array constructor very slow when passed an array object.

2009-01-30 Thread David W. Lambert

David W. Lambert  added the comment:

memcpy won't work if the data type changes.  (possibly signed <-> 
unsigned same-byte-count works).

--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue5109>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5092] weird memory usage in multiprocessing module

2009-01-30 Thread David W. Lambert

David W. Lambert  added the comment:

The alternative is unreasonable.  I doubt you'd be happy with this:


a = 'Something'

def variable_both_global_and_local()->Exception('No good!'):
del a# delete a from global name space
a = 'anotherthing'  # define a in local name space

___
Python tracker 
<http://bugs.python.org/issue5092>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4174] Performance optimization for min() and max() over lists

2009-01-29 Thread David W. Lambert

Changes by David W. Lambert :


___
Python tracker 
<http://bugs.python.org/issue4174>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4174] Performance optimization for min() and max() over lists

2009-01-29 Thread David W. Lambert

Changes by David W. Lambert :


___
Python tracker 
<http://bugs.python.org/issue4174>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5099] subprocess.POpen.__del__() AttributeError (os module == None!)

2009-01-29 Thread David W. Lambert

Changes by David W. Lambert :


--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue5099>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5092] weird memory usage in multiprocessing module

2009-01-28 Thread David W. Lambert

David W. Lambert  added the comment:

My second answer is irrelevant.  Function receives the global data as 
well as the arguments.

___
Python tracker 
<http://bugs.python.org/issue5092>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5092] weird memory usage in multiprocessing module

2009-01-28 Thread David W. Lambert

David W. Lambert  added the comment:

The del statement makes the variable local, as alluded to by

http://docs.python.org/dev/3.0/reference/simple_stmts.html#the-del-
statement

The manual is clearer about assignments, which are local unless declared 
global or nonlocal.


For other question, me thinks you need to write slightly cleverer code 
that passes only required data.  I have experience with 
multiprocessing.Pool().map which lets me control the arguments I pass to 
functions.

--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue5092>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4707] round(25, 1) should return an integer, not a float

2009-01-27 Thread David W. Lambert

David W. Lambert  added the comment:

The value of one of the arguments controls how many digits there are.

Certainly if you rounded $10 to the nearest cents you'd expect $10.00.
Thus round(10,2) should be 10.00.  Without using decimal module, the 
best we can do is produce  10.0.

I'd apply a similar argument to convince you that the return value 
should be integral for negative "number of digits".

Hark!  This is python.  We can take this correct and beautiful approach.  
We are not constrainded by function signatures of c++ or FORTRAN90.

___
Python tracker 
<http://bugs.python.org/issue4707>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4707] round(25, 1) should return an integer, not a float

2009-01-27 Thread David W. Lambert

David W. Lambert  added the comment:

I'd prefer round(x,positive_integer) return float.  Returning int is a 
bit of a lie, except that the decimal module is available to avoid this 
sort of lie.

For non-positive integer roundings I'd like an integer return.

In my opinion, we'd benefit from this definition of round:


import numbers

def round(a,p=0,base=10):
'''
>>> round(147,-1,5)
145.0
>>> round(143,-1,5)
145.0
>>> round(142,-1,5)
140.0
>>> round(12.345,1,2)
12.5
>>> round(12.345,2,2)
12.25
>>> round(12.345,-2,2)
12
>>> round(12.345,-3,2)
16
'''
# consider using sign transfer for negative a

if base < 1:
raise ValueError('base too confusing')

require_integral_output = (
(p < 1) and
isinstance(base, numbers.Integral) and
isinstance(p, numbers.Integral))

b = base**p
result = int(a*b+0.5)/b
if require_integral_output:
result = int(0.5+result)
return result

--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue4707>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1397474] timeit execution enviroment

2009-01-27 Thread David W. Lambert

Changes by David W. Lambert :


--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue1397474>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5032] itertools.count step

2009-01-26 Thread David W. Lambert

David W. Lambert  added the comment:

Probably a better prime factor algorithm uses Sieve of E. to generate
primes through int(1+sqrt(n)) and test these.

The other algorithm uses a custom generator anyway.  Oh well, good luck,
I'll shut up.
You do have use cases that I couldn't think of.

Dave.

___
Python tracker 
<http://bugs.python.org/issue5032>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5032] itertools.count step

2009-01-26 Thread David W. Lambert

David W. Lambert  added the comment:

Nice.  Now I know that $e$ is a least transcendental number.  But I 
can't figure out why inserting this code into your file (and removing 
some "itertools.") is difficult or unreadable.  I maintain a personal 
library of modules that I don't actually expect Guido to include in the 
python standard library.


import itertools

def count(offset=0,stride=1):
for i in itertools.count():
yield offset+i*stride


# this version probably performs faster
def count(offset=0,stride=1):
while True:
yield offset
offset += stride

___
Python tracker 
<http://bugs.python.org/issue5032>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5061] Inadequate documentation of the built-in function open

2009-01-26 Thread David W. Lambert

David W. Lambert  added the comment:

(prospective, not perspective programmer)

Spelling out the possibilities as suggested in Message80563 makes better
sense to me than writing in words the logic handling the mode argument
of the io.open function.  (Perhaps there is a clearer implementation
using a dictionary with frozenset keys, but the io module for py3k is
being recast in c, per my understanding.)

___
Python tracker 
<http://bugs.python.org/issue5061>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5061] Inadequate documentation of the built-in function open

2009-01-25 Thread David W. Lambert

David W. Lambert  added the comment:

I disagree.  You propose to examine the trees but ignore the forest.  
The perspective programmer needs to understand what is a file.

--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue5061>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5044] name not found in generator in eval()

2009-01-24 Thread David W. Lambert

Changes by David W. Lambert :


--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue5044>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2527] Pass a namespace to timeit

2009-01-24 Thread David W. Lambert

David W. Lambert  added the comment:

This note is simply a reminder that Antoine's 'from __main__ import *' 
solution fails in python3.  Also, resolution of this issue probably 
could incorporate Issue1397474.


>>> import timeit
>>> timeit.timeit('None','from __main__ import *')
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python3.0/timeit.py", line 227, in timeit
return Timer(stmt, setup, timer).timeit(number)
  File "/usr/local/lib/python3.0/timeit.py", line 135, in __init__
code = compile(src, dummy_src_name, "exec")
  File "", line 2
SyntaxError: import * only allowed at module level

--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue2527>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5032] itertools.count step

2009-01-22 Thread David W. Lambert

Changes by David W. Lambert :


--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue5032>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5029] Odd slicing behaviour

2009-01-21 Thread David W. Lambert

Changes by David W. Lambert :


--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue5029>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5028] tokenize.generate_tokens doesn't always return logical line

2009-01-21 Thread David W. Lambert

Changes by David W. Lambert :


--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue5028>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4994] subprocess (Popen) doesn't works properly

2009-01-18 Thread David W. Lambert

Changes by David W. Lambert :


--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue4994>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4899] doctest should support fixtures

2009-01-13 Thread David W. Lambert

David W. Lambert  added the comment:

For unittests I recommend two things instead of need for doctest change.
A decoupled strict test to prove that the iterator works, and this class
to publish,

class Tped_use_cases(...):

def test_Marker_iteration(self):

'''
Illustrative code adapted from what is now your doctest
'''

...

___
Python tracker 
<http://bugs.python.org/issue4899>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4899] doctest should support fixtures

2009-01-13 Thread David W. Lambert

David W. Lambert  added the comment:

My goodness, that's the starting base sequence to gene 38c, chromosome 4
of the Columbian caldera cricket!  But seriously...

1) The relevant part of the doc string is this, and this is how it
should read (your argument being "if doctests provided setUp framework
my doc string would look like this!"):

def TpedIterator(handle):

'''
Iterates on an TPed file handler.
Returns Marker objects.

Tped_stream = open('cricket.sequence','r')
ti = TpedIterator(Tped_stream)
for marker in ti:
use(marker)
'''


2) (With the caveat that I am unfamilar with your project.)  You should
choose terminology appropriate for your project.  A computer scientist
would expect "file handle" to be an integer.  What you call "handle" is
clearly a "stream" object and therefore of uncommon name.  Since the
file objects are more likely to be from the computer sciences rather
than the biological realm you should stick with "stream".

3) We agree, "Don't Repeat Yourself".  The last two chunks of your file
enable doctest.  I'll guess that similar lines may be found repeated
throughout your sources.  Instead of internal support, write a single
test script that provides external support.  It would process named
files with unittest, doctest.[, and customtests.]
$ python -c 'import test' glob
There may be a python library for this.  I can't guide you easily
because I built and use my own framework.  Nor have I bothered to figure
out how python runs its own installation tests.

4) Yes, unittest are quite appropriate for your project.  When you move
your docstring tests to unittests try to isolate the tests.  For
instance, the test you've shown couples the TpedIterator with the string
representation of a Marker object.

5) Is your system really so simple that it's useful to run
interactively?  I may be out of touch but I script most of my codes and
tests because I make so many errors and module changes.  In other words,
is your interactive docstring example a reasonable use case?

___
Python tracker 
<http://bugs.python.org/issue4899>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4925] Improve error message of subprocess

2009-01-12 Thread David W. Lambert

David W. Lambert  added the comment:

(Actual command stream includes chmod +x ./s.sh)

___
Python tracker 
<http://bugs.python.org/issue4925>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4925] Improve error message of subprocess

2009-01-12 Thread David W. Lambert

David W. Lambert  added the comment:

Related, but outside python realm, this error likewise confuses:

$ cat < s.sh
#! invalid path
echo hi
EOF
$ ./s.sh 
zsh: no such file or directory: ./s.sh

--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue4925>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4760] cmp gone documentations

2009-01-12 Thread David W. Lambert

David W. Lambert  added the comment:

http://docs.python.org/dev/3.1/library/unittest.html#module-unittest

Search for "cmp".  There are two references.  I apologize if I
misunderstand issue 1717,

--
title: cmp gone---What's new in 3.1 -> cmp gone documentations

___
Python tracker 
<http://bugs.python.org/issue4760>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4899] doctest should support fixtures

2009-01-09 Thread David W. Lambert

David W. Lambert  added the comment:

I disagree.  Purpose of __doc__ is to explain functionality all at once.
This command idiom is useful:

$ python -c 'from a_module import thing; help(thing)'

The doctest module is a lightweight nicety that helps verify that which
is suitable.  The sufficiently simple algorithms of my code have doc
strings that are the complete test and explanation.  For others I
provide both docstring and unit tests.  But with many I explain the
arguments and output, possibly the algorithm in a doc string.  Tests and
use case examples reside in the module's unit test.

I'm among the "Choose correct tool for the job.  python comes with full
tool bag." group.

--
nosy: +LambertDW

___
Python tracker 
<http://bugs.python.org/issue4899>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4816] Patch of itertools.{combinations, permutations} for empty combinations

2009-01-07 Thread David W. Lambert

David W. Lambert  added the comment:

I had thought highly of the "mull it over for a week" plan.  After a 
week we'd decide to follow Stephen Wolfram's lead, which seems to be the 
current patch.  I haven't yet used the python permutations iterator, 
although I used to have a script that solved word JUMBLE puzzles with a 
mathematica | spell pipeline.  Now I look up words using a sorted 
anagram dictionary.

___
Python tracker 
<http://bugs.python.org/issue4816>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4816] Patch of itertools.{combinations, permutations} for empty combinations

2009-01-07 Thread David W. Lambert

David W. Lambert  added the comment:

I try to "not know" excel.  Does it have any other means to represent an 
empty set?

___
Python tracker 
<http://bugs.python.org/issue4816>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4816] Patch of itertools.{combinations, permutations} for empty combinations

2009-01-07 Thread David W. Lambert

David W. Lambert  added the comment:

Mathematica indicates for the user to define it later.  An error.

In[3]:= Permutations[{1,2},{-2}]

Permutations::nninfseq: 
   Position 2 of Permutations[{1, 2}, {-2}]
 must be All, Infinity, a non-negative integer, or a List whose 
first
 element (required) is a non-negative integer, second element 
(optional)
 is a non-negative integer or Infinity, and third element (optional) 
is a
 nonzero integer.

Out[4]= Permutations[{1, 2}, {-2}]

___
Python tracker 
<http://bugs.python.org/issue4816>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >