Re: Iterate from 2nd element of a huge list

2012-02-01 Thread Peter Otten
Arnaud Delobelle wrote:

 Em 01-02-2012 01:39, Paulo da Silva escreveu:

 What is the best way to iterate thru a huge list having the 1st element
 a different process? I.e.:

 Nobody mentioned itertools.islice, which can be handy, especially if
 you weren't interested in the first element of the list:

Also, skipping two or seven or ... items is just as easy.
The example should be

 from itertools import islice:

for el in islice(mylist, 1, None):
 process2(el)
 


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


Re: Installing pypi package twice

2012-02-01 Thread Ben Finney
Jason Friedman ja...@powerpull.net writes:

 How would I also install this package for 3.2.2?  (I am assuming that
 python-daemon-1.5.5 is either version3-compatible or I can make it
 so).

I am the primary developer of ‘python-daemon’. It is an explicit goal of
this library to target Python 3, but that has not been achieved yet.

I welcome discussion on the new forum for development discussion
URL:http://lists.alioth.debian.org/mailman/listinfo/python-daemon-devel.

-- 
 \ “Science is a way of trying not to fool yourself. The first |
  `\ principle is that you must not fool yourself, and you are the |
_o__)   easiest person to fool.” —Richard P. Feynman, 1964 |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: xhtml encoding question

2012-02-01 Thread Stefan Behnel
Tim Arnold, 31.01.2012 19:09:
 I have to follow a specification for producing xhtml files.
 The original files are in cp1252 encoding and I must reencode them to utf-8.
 Also, I have to replace certain characters with html entities.
 
 I think I've got this right, but I'd like to hear if there's something I'm
 doing that is dangerous or wrong.
 
 Please see the appended code, and thanks for any comments or suggestions.
 
 I have two functions, translate (replaces high characters with entities)
 and reencode (um, reencodes):
 -
 import codecs, StringIO
 from lxml import etree
 high_chars = {
0x2014:'mdash;', # 'EM DASH',
0x2013:'ndash;', # 'EN DASH',
0x0160:'Scaron;',# 'LATIN CAPITAL LETTER S WITH CARON',
0x201d:'rdquo;', # 'RIGHT DOUBLE QUOTATION MARK',
0x201c:'ldquo;', # 'LEFT DOUBLE QUOTATION MARK',
0x2019:rsquo;, # 'RIGHT SINGLE QUOTATION MARK',
0x2018:lsquo;, # 'LEFT SINGLE QUOTATION MARK',
0x2122:'trade;', # 'TRADE MARK SIGN',
0x00A9:'copy;',  # 'COPYRIGHT SYMBOL',
}
 def translate(string):
s = ''
for c in string:
if ord(c) in high_chars:
c = high_chars.get(ord(c))
s += c
return s

I hope you are aware that this is about the slowest possible algorithm
(well, the slowest one that doesn't do anything unnecessary). Since none of
this is required when parsing or generating XHTML, I assume your spec tells
you that you should do these replacements?


 def reencode(filename, in_encoding='cp1252',out_encoding='utf-8'):
with codecs.open(filename,encoding=in_encoding) as f:
s = f.read()
sio = StringIO.StringIO(translate(s))
parser = etree.HTMLParser(encoding=in_encoding)
tree = etree.parse(sio, parser)

Yes, you are doing something dangerous and wrong here. For one, you are
decoding the data twice. Then, didn't you say XHTML? Why do you use the
HTML parser to parse XML?


result = etree.tostring(tree.getroot(), method='html',
pretty_print=True,
encoding=out_encoding)
with open(filename,'wb') as f:
f.write(result)

Use tree.write(f, ...)

Assuming you really meant XHTML and not HTML, I'd just drop your entire
code and do this instead:

  tree = etree.parse(in_path)
  tree.write(out_path, encoding='utf8', pretty_print=True)

Note that I didn't provide an input encoding. XML is safe in that regard.

Stefan

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


Re: xhtml encoding question

2012-02-01 Thread Ulrich Eckhardt

Am 31.01.2012 19:09, schrieb Tim Arnold:

high_chars = {
0x2014:'mdash;', # 'EM DASH',
0x2013:'ndash;', # 'EN DASH',
0x0160:'Scaron;',# 'LATIN CAPITAL LETTER S WITH CARON',
0x201d:'rdquo;', # 'RIGHT DOUBLE QUOTATION MARK',
0x201c:'ldquo;', # 'LEFT DOUBLE QUOTATION MARK',
0x2019:rsquo;, # 'RIGHT SINGLE QUOTATION MARK',
0x2018:lsquo;, # 'LEFT SINGLE QUOTATION MARK',
0x2122:'trade;', # 'TRADE MARK SIGN',
0x00A9:'copy;', # 'COPYRIGHT SYMBOL',
}


You could use Unicode string literals directly instead of using the 
codepoint, making it a bit more self-documenting and saving you the 
later call to ord():


high_chars = {
u'\u2014': 'mdash;',
u'\u2013': 'ndash;',
...
}


for c in string:
if ord(c) in high_chars:
c = high_chars.get(ord(c))
s += c
return s


Instead of checking if there is a replacement and then looking up the 
replacement again, just use the default:


  for c in string:
  s += high_chars.get(c, c)

Alternatively, if you find that clearer, you could also check if the 
returnvalue of get() is None to find out if there is a replacement:


  for c in string:
  r = high_chars.get(c)
  if r is None:
  s += c
  else:
  s += r


Uli

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


Re: Iterate from 2nd element of a huge list

2012-02-01 Thread Paul Rubin
Paulo da Silva p_s_d_a_s_i_l_...@netcabo.pt writes:
 process1(mylist[0])
 for el in mylist[1:]:
   process2(el)

 This way mylist is almost duplicated, isn't it?

I think it's cleanest to use itertools.islice to get the big sublist
(not tested):

   from itertools import islice

   process1 (mylist[0])
   for el in islice(mylist, 1, None):
   process2 (el)

The islice has a small, constant amount of storage overhead instead of
duplicating almost the whole list.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: xhtml encoding question

2012-02-01 Thread Peter Otten
Ulrich Eckhardt wrote:

 Am 31.01.2012 19:09, schrieb Tim Arnold:
 high_chars = {
 0x2014:'mdash;', # 'EM DASH',
 0x2013:'ndash;', # 'EN DASH',
 0x0160:'Scaron;',# 'LATIN CAPITAL LETTER S WITH CARON',
 0x201d:'rdquo;', # 'RIGHT DOUBLE QUOTATION MARK',
 0x201c:'ldquo;', # 'LEFT DOUBLE QUOTATION MARK',
 0x2019:rsquo;, # 'RIGHT SINGLE QUOTATION MARK',
 0x2018:lsquo;, # 'LEFT SINGLE QUOTATION MARK',
 0x2122:'trade;', # 'TRADE MARK SIGN',
 0x00A9:'copy;', # 'COPYRIGHT SYMBOL',
 }
 
 You could use Unicode string literals directly instead of using the
 codepoint, making it a bit more self-documenting and saving you the
 later call to ord():
 
 high_chars = {
  u'\u2014': 'mdash;',
  u'\u2013': 'ndash;',
  ...
 }
 
 for c in string:
 if ord(c) in high_chars:
 c = high_chars.get(ord(c))
 s += c
 return s
 
 Instead of checking if there is a replacement and then looking up the
 replacement again, just use the default:
 
for c in string:
s += high_chars.get(c, c)
 
 Alternatively, if you find that clearer, you could also check if the
 returnvalue of get() is None to find out if there is a replacement:
 
for c in string:
r = high_chars.get(c)
if r is None:
s += c
else:
s += r

It doesn't matter for the OP (see Stefan Behnel's post), but If you want to 
replace characters in a unicode string the best way is probably the 
translate() method:

 print u\xa9\u2122
©™
 u\xa9\u2122.translate({0xa9: ucopy;, 0x2122: utrade;})
u'copy;trade;'


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


Re: How can I verify if the content of a variable is a list or a string?

2012-02-01 Thread Chris Angelico
On Wed, Feb 1, 2012 at 12:11 PM, Andres Soto soto_and...@yahoo.com wrote:

 okok, my mistake is that I was using string in place of str. Thank you!!
 regards

Tip: In the interactive interpreter, enter:

 type(spam)
class 'str'

In Python 2, it'll say type not class, but same diff. It tells you
there what the type is.

Same can be used for any other literal, name, or other object. Can be
quite handy at times.

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


Re: Disable use of pyc file with no matching py file

2012-02-01 Thread Jean-Michel Pichavant

Terry Reedy wrote:

On 1/31/2012 9:19 AM, Jean-Michel Pichavant wrote:


A: My wheel is flat
B: Buy a new car


A better analogy would be

Q. How do I make my old model car do something (it cannot do)?
A. Get the free new model that has that feature added.

Of course, there is a cost to giving up the old and familiar and 
learning and adjusting to the new, even when it is available gratis. A 
husband wearing an old sweater after his wife gives him a new one, and 
even retrieving it from the trash when she tosses it out, is a classic 
(and true) cartoon joke.


But I am sure that 95% of readers here will be using 3.x withing 10 
years. The only question for them is When?. This not-well-known new 
feature is one straw that some will put on the 'sooner' side of the 
balance.


A simple solution to that problem has been provided by Miki. Someone 
should read at least http://wiki.python.org/moin/Python2orPython3 before 
migrating to python 3.


Speaking for myself, I'm stuck with python 2.5 :-/

JM


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


Re: Disable use of pyc file with no matching py file

2012-02-01 Thread Terry Reedy

On 1/31/2012 11:14 PM, Roy Smith wrote:


We would love to move to 3.x, for the better unicode support, if nothing
else.  What's keeping us from doing so is the host of third-party
modules and tools we depend on that don't yet support 3.x.


Tell that to the authors of packages you use so they no longer say that 
they have not converted for lack of demand ;-)


--
Terry Jan Reedy

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


Re: configobj

2012-02-01 Thread Andrea Crotti

On 02/01/2012 12:21 AM, Terry Reedy wrote:

On 1/31/2012 11:06 AM, Andrea Crotti wrote:

I have a couple of questions about configobj, which I'm happily trying
to use for this project.


When asking about 3rd party modules, please include a url, so we can 
be sure of what you mean and even take a look. Is

www.voidspace.org.uk/python/configobj.html
what you mean?


Yes I meant that sorry.




which looked less complete and more cumbersome (to me at least)


Does ConfigParser have the same problems you found with ConfigObj.



Well no, but also because it just gets raw strings, and doesn't do any 
validation.

With ConfigObj I can do simply a spec file

skip_pesky_pyc_paths = string_list
include_extra_paths = string_list
use_real_dependencies = bool(default=False)
compute_dependencies_recursively = bool(default=False)

And the options which are not declared will default automatically to 
that value.

And also I never really liked the ConfigParser API..

Anyway I solved just leaving these long lists somewhere else, but otherwise
I think a better solution would be YAML in general (which doesn't have 
much validation either

apparently).
--
http://mail.python.org/mailman/listinfo/python-list


Re: Iterate from 2nd element of a huge list

2012-02-01 Thread Arnaud Delobelle
On 1 February 2012 08:11, Peter Otten __pete...@web.de wrote:
 Arnaud Delobelle wrote:
 The example should be

 from itertools import islice:

 for el in islice(mylist, 1, None):
     process2(el)

Oops!

-- 
Arnaud
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Disable use of pyc file with no matching py file

2012-02-01 Thread Devin Jeanpierre
On Tue, Jan 31, 2012 at 6:55 PM, Terry Reedy tjre...@udel.edu wrote:
 Q. How do I make my old model car do something (it cannot do)?
 A. Get the free new model that has that feature added.

 Of course, there is a cost to giving up the old and familiar and learning
 and adjusting to the new, even when it is available gratis. A husband
 wearing an old sweater after his wife gives him a new one, and even
 retrieving it from the trash when she tosses it out, is a classic (and true)
 cartoon joke.

It really bothers me that you imagine that there are no other problems
than the newness. It's disheartening, because the problems are not
that trivial and the world would be better if people were less callous
about it, and realized that they exist. Python 3 is not very different
from Python 2, as far as humans are concerned
semantically/syntactically -- but, hell, just pick any project that
uses PyPy, or Jython, or IronPython, or Twisted, or Zope, etc. -- it
can be a lot of effort (sometimes infeasibly much) to port something
dependent on these things, and it's taken years to get the (smallish)
set of dependencies ported that we have now [and we literally paid
people to do it, too!], and still many large projects haven't made the
transition, and many small projects never will.

Anyone that relies on those projects is stuck, and your free car
metaphor completely ignores the true cost of wasting that much time
porting everything for a tiny little feature. Evaluating only the
monetary amounts can be misleading as to what the rational decision is
(in particular when there are no monetary amounts). The only true
notion of cost is the alternatives you sacrifice in making a decision:
opportunity cost. The car is not free.

-- Devin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Iterate from 2nd element of a huge list

2012-02-01 Thread Stefan Behnel
Paul Rubin, 01.02.2012 10:25:
 Paulo da Silva writes:
 process1(mylist[0])
 for el in mylist[1:]:
  process2(el)

 This way mylist is almost duplicated, isn't it?
 
 I think it's cleanest to use itertools.islice to get the big sublist
 (not tested):
 
from itertools import islice
 
process1 (mylist[0])
for el in islice(mylist, 1, None):
process2 (el)
 
 The islice has a small, constant amount of storage overhead instead of
 duplicating almost the whole list.

It also has a tiny runtime overhead, though. So, if your code is totally
performance critical and you really just want to strip off the first
element and then run through all the rest, it may still be better to go the
iter() + next() route.

python3.3 -m timeit -s 'l=list(range(10))' \
   'it = iter(l); next(it); all(it)'
1000 loops, best of 3: 935 usec per loop

python3.3 -m timeit -s 'l=list(range(10))' \
-s 'from itertools import islice' \
'all(islice(l, 1, None))'
1000 loops, best of 3: 1.63 msec per loop

Stefan

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


FounderDating - Helping entrepreneurs find their co-founder start companies!

2012-02-01 Thread Jason Demant
Looking for your co-founder? FounderDating is back in San Francisco on
March 1st (Apply by February 20th), in Seattle on March 6th (Apply by
February 26th) and NY on February 21st (Apply by February 16th) at
http://members.founderdating.com/application/.

What is FounderDating? A great team is the best predictor of a new
venture's success. Great teams are composed of high caliber people
with complementary skills, this is where FounderDating comes in.
FounderDating brings together super talented, handpicked entrepreneurs
with different backgrounds and skill sets who want to start companies.
We help them find the right match by giving them access to invitation-
only events and an online member network. What differentiates
FounderDating is the extreme quality of its members and their
commitment to start something now! Apply now! --
http://members.founderdating.com/application/.

Thanks!
Jason
http://www.FounderDating.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Disable use of pyc file with no matching py file

2012-02-01 Thread John Roth
On Jan 31, 4:43 pm, Terry Reedy tjre...@udel.edu wrote:
 On 1/31/2012 3:20 PM, John Roth wrote:

  On Jan 30, 3:43 pm, Terry Reedytjre...@udel.edu  wrote:
  On 1/30/2012 4:30 PM, Roy Smith wrote:

  Every so often (typically when refactoring), I'll remove a .py file
  and forget to remove the corresponding .pyc file.  If I then import
  the module, python finds the orphaned .pyc and happily imports it.
  Usually leading to confusing and hard to debug failures.

  Is there some way to globally tell python, Never import a .pyc
  unless the corresponding .py file exits?

  Upgrade to 3.2.

 I tested before writing this. The caveat is that x.pyc in the same
 directly as x.py will not be ignored (for back compatibility). However,
 this only happens intentionally as .pyc files are put in __pycache__/
 with name x.version.pyc, where version is 'cpython-32' or something
 similar for another version or implementation.

  I've noticed that the tutorial (section 6.1.3) hasn't been updated for
  PEP 3147; there's no way of telling that this is the behavior from
  reading the tutorial. The development doc for 3.3 hasn't been updated
  either.

 You are right. An oversight. Thanks for 
 noticing.http://bugs.python.org/issue13915
 Suggested rewrites are welcome.

 --
 Terry Jan Reedy

I'll see if I can put a suggestion in the bug report.

One other point: I'm unclear if a compiled module in the source
directory would be named spam.pyc or spam.cpython-32.pyc. I'd think
the latter to allow two versions of a compiled-only distribution.

John Roth

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


python reliability with EINTR handling in general modules

2012-02-01 Thread oleg korenevich
I have linux board on samsung SoC s3c6410 (ARM11). I build rootfs with
buildroot: Python 2.7.1, uClibc-0.9.31. Linux kernel: Linux buildroot
2.6.28.6 #177 Mon Oct 3 12:50:57 EEST 2011 armv6l GNU/Linux

My app, written on python, in some mysterios conditons raise this
exceptions:

1) exception:

 File ./dfbUtils.py, line 3209, in setItemData
ValueError: (4, 'Interrupted system call')
code:

currentPage=int(math.floor(float(rowId)/
self.pageSize))==self.selectedPage
2) exception:

File ./terminalGlobals.py, line 943, in getFirmawareName
OSError: [Errno 4] Interrupted system call: 'firmware'
code:

for fileName in os.listdir('firmware'):
Some info about app: it have 3-7 threads, listen serial ports via
'serial' module, use gui implemented via c extension that wrap
directfb, i can't reproduce this exceptions, they are not predictable.

I googled for EINTR exceptions in python, but only found that EINTR
can occur only on slow system calls and python's modules socket,
subprocess and another one is already process EINTR. So what happens
in my app? Why simple call of math function can interrupt program at
any time, it's not reliable at all. I have only suggestions: ulibc
bug, kernel/hw handling bug. But this suggestions don't show me
solution.

Now i created wrap functions (that restart opertion in case of EINTR)
around some functions from os module, but wrapping math module will
increase execution time in 2 times. There another question: if math
can be interrutped than other module also can and how to get
reliability?
-- 
http://mail.python.org/mailman/listinfo/python-list


Registry entries set up by the Windows installer

2012-02-01 Thread Paul Moore
I'm trying to get information on what registry entries are set up by
the Python Windows installer, and what variations exist. I don't know
enough about MSI to easily read the source, so I'm hoping someone who
knows can help :-)

As far as I can see on my PC, the installer puts entries

HKLM\Software\Python\PythonCore\x.y

with various bits underneath. I think I've seen indications that
sometimes these are in HKCU, presumably for a per user install? If I
manually hack around in the registry, and have both HKLM and HKCU,
which one will Python use?

Furthermore, more of a Windows question than Python, but there's a
similar question with regard to the .py and .pyw file associations -
they can be in HKLM\Software\Classes or HKCU\Software\Classes. Which
takes precedence? I assume that the installer writes to HKLM for all
users and HKCU for per-user installs.

Is there anything else I've missed?

The reason I ask, is that I'm starting to work with virtualenv, and I
want to see what would be involved in (re-)setting the registry
entries to match the currently active virtualenv. virtualenvwrapper-
powershell seems to only deal with HKCU (which is a big plus on
Windows 7, as it avoids endless elevation requests :-)) but that
doesn't work completely cleanly with my all-users install. (Note: I'm
not entirely sure that changing global settings like this to patch a
per-console virtualenv is a good idea, but I'd like to know how hard
it is before dismissing it...)

Thanks,
Paul.
-- 
http://mail.python.org/mailman/listinfo/python-list


Buffering in Wing and IDLE 3

2012-02-01 Thread Franck Ditter
Hi,
I'm using Python 3.2.x with beginners.
If I try the following in IDLE 3, it works as expected :

from time import sleep
import sys

for i in range(4) :
sys.stdout.write(str(i))
sys.stdout.flush()
sleep(1)

but with Wing-101, it write 0123 after the total sleep time.
Why ???

I would prefer to use IDLE but as we are in France, the Python team 
does not seem to be aware that the ~ and others are not available 
on MacOS-X here (probably the same in Europe)...

franck
-- 
http://mail.python.org/mailman/listinfo/python-list


solutions manual books

2012-02-01 Thread solutions team
trust solutions team


trustsolutionsteam(at)hotmail(dot)com

We're a team for providing solution manuals to help students in their
study.
We sell the books in a soft copy, PDF format.

We will find any book or solution manual for you.

Just email us:

t r u s t s o l u t i o n s t e a m @ h o t m a i l . c o m

List of some books we have
=

A Course in Modern Mathematical Physics by Peter Szekeres
A First Course in Abstract Algebra By  John B. Fraleigh
A first course in probability 6th edition by Ross
A First Course in String Theory by Barton Zwiebach
A Practical Introduction to Data Structures and Algorithm Analysis
Second Edition by Clifford A. Shaffer
A Quantum Approach to Condensed Matter Physics by Philip L. Taylor
A Short Introduction to Quantum Information and Quantum Computation by
Michel Le Bellac
Accompany Digital Systems Principles and Applications, 10th Edition By
Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss
Accompany Electric Machinery and Power System Fundamentals, First
Edition by Stephen J. Chapman
Accompany Electronic Devices and Circuit Theory, 8Ed By Robert L.
Boylestad; Louis Nashelsky; Franz J. Monseen
Accompany Elementary Statistics Ninth Edition by  MILTON LOYER
Accompany Engineering circuit analysis, 6th edition By Hayt
Accompany Foundations of Electromagnetic Theory 2nd Ed. by John R.
Reitz, Frederick J. Milford
Accompany Fundamentals of Fluid Mechanics, 5th Edition by Bruce R.
Munson, Donald F. Young, Theodore H. Okiishi
Accompany Introduction to algorithms By  Sussman J
Accompany Physics for Poets Second Edition By Robert H. March
Accompany Principles of geotechnical engineering, sixth edition by
braja M. DAS
Adaptive Control, 2nd Edition, By Karl Johan Astrom,Bjorn Wittenmark
Adaptive filter thoery 4th edition By Simon Haykin
Advanced Digital Design with the Verilog HDL by Michael D. Ciletti
(Selected problems)
Advanced engineering electromagnetics by Constantine A. Balanis
Advanced Engineering Mathematics 8 Edition By Erwin Kreyszig
Advanced Engineering Mathematics 9 Edition By Erwin Kreyszig
Advanced Modern Engineering Mathematics 3rd Edition by Glyn James
Aircraft Structures for Engineering Students Fourth Edition by T. H.
G. Megson (2007)
Algebra and Trigonometry and Precalculus, 3rd Edition by Penna 
Bittinger Beecher
An introduction to database systems 8th edition By C J Date
An Introduction to Ordinary Differential Equations By James C.
Robinson (with Matlab files)
An Introduction to Signals and Systems By John Stuller
An Introduction to The Finite Element Method (Third Edition) By  J. N.
REDDY
Analysis and design of analog integrated circuits 4th edition by
Srikanth Vaidianathan and Haoyuee Wang
Analytical Mechanics, 7th Edition By Fowles  Cassiday
Antenna Theory Analysis and Design, 2nd Edition Balanis
Antennas for all Applications 3rd edition by John D. Kraus  Ronald J.
Marhefka
Anton Calculus 8th edition, Exercises solutions
Applied Numerical Analysis 7th Edition By Curtis F. Gerald,Patrick O.
Wheatley
Applied Partial Differential Equations with Fourier Series and
Boundary Value Problems 4th Edition by Richard Haberman
Applied Quantum Mechanics by  A. F. J. Levi
Applied Statistics And Probability For Engineers 3rd edition By
Montgomery,Runger
Applied Statistics And Probability For Engineers 4th edition By
Montgomery,Runger
Applied Strength of Materials 4th Edition By Robert L. Mott
Artificial Intelligence A ModernApproach 2nd edition by StuartJ.
Russelland, Peter Norvig
Assembly Language for Intel-Based Computers,3ed, by Kip R. Irvine
Automatic Control Systems 8th edition By Kuo and Golnaraghi

Basic Electrical Engineering By Nagrath, D P Kothari, Nagrath D P
Kothari I J Nagrath, I J Nagrath, 2002
Basic Engineering Circuit Analysis 7th Ed. by J. David Irwin (Selected
Problems)
Basic Engineering Circuit Analysis 8th Edition By J. David Irwin

C++ How to Program, 3rd Ed by  Harvey M. Deitel, Paul J. Deitel
C++ How to Program, 3rd edition By Deitel  Nieto
Calculus 5th Edition By James Stewart
Calculus A Complete Course 6th Edition by R.A. Adams
Calculus Early Transcendentals 5th Edition By Stewart
Calculus early transcendentals 7th edition By Anton Bivens Davis
calculus multivariable 4th edition Deborah Hughes-Hallett, Andrew M.
Gleason, et al
Calculus Single Variable Hughes-Hallett, Gleason, McCallum, et al
Chemical and Engineering Thermodynamics 3rd Ed. by Stanley I. Sandler
Chemical Enginering Vol 6 4th edition by Coulson and Richardson
Classical Dynamics A Contemporary Approach by Jorge V. Jose, Eugene J.
Saletan
Classical Dynamics of Particles and Systems 5th edition by Stephen T.
Thornton, Jerry B. Marion
Classical Electrodynamics 2nd Edition by John David Jackson by Kasper
van Wijk
Classical Mechanics - An Undergraduate Text by R. Douglas Gregory
Classical Mechanics 2nd edition By Goldstein  Safko
CMOS Digital Integrated Circuits 3rd edition By Sung-Mo Kang,Yusuf
Leblebici
CMOS VLSI Design 3e by ananymous
Communication Networks 

Re: python zipfile v. native unzip

2012-02-01 Thread Michael Torrie
On 01/31/2012 06:41 AM, Jason Friedman wrote:
 Does Python 2.7's zipfile module use its own algorithm or does it
 leverage the zip/unzip libraries that exist on the host?  I ask
 because my host's native unzip program cannot handle files that, when
 unzipped, are larger than 2GB.  Will using Python 2.7 get around this
 limitation?

What operating system and file system?
-- 
http://mail.python.org/mailman/listinfo/python-list


changing sys.path

2012-02-01 Thread Andrea Crotti

So suppose I want to modify the sys.path on the fly before running some code
which imports from one of the modules added.

at run time I do
sys.path.extend(paths_to_add)

but it still doesn't work and I get an import error.

If I take these paths and add them to site-packages/my_paths.pth
everything works, but at run-time the paths which I actually see before
importing are exactly the same.

So there is something I guess that depends on the order, but what can I
reset/reload to make these paths available (I thought I didn't need 
anything in theory)?

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


Re: xhtml encoding question

2012-02-01 Thread Ulrich Eckhardt

Am 01.02.2012 10:32, schrieb Peter Otten:

It doesn't matter for the OP (see Stefan Behnel's post), but If you want to
replace characters in a unicode string the best way is probably the
translate() method:


print u\xa9\u2122

©™

u\xa9\u2122.translate({0xa9: ucopy;, 0x2122: utrade;})

u'copy;trade;'



Yes, this is both more expressive and at the same time probably even 
more efficient.



Question though:

 u'abc'.translate({u'a': u'A'})
u'abc'

I would call this a chance to improve Python. According to the 
documentation, using a string is invalid, but it neither raises an 
exception nor does it do the obvious and accept single-character strings 
as keys.



Thoughts?


Uli
--
http://mail.python.org/mailman/listinfo/python-list


Re: Installing pypi package twice

2012-02-01 Thread Hans Mulder

On 1/02/12 07:04:31, Jason Friedman wrote:

My system's default python is 2.6.5.  I have also installed python3.2
at /opt/python.
I installed a pypi package for 2.6.5 with:
$ tar xzf package.tar.gz
$ cd package
$ python setup.py build
$ sudo python setup.py install

How can I also install this same package for 3.2?  (I am assuming this
package works with 3.2 or that I can make it work.)


How about (in another directory):

$ tar xzf package.tar.gz
$ cd package
$ /opt/python/bin/python setup.py build
$ sudo /opt/python/bin/python setup.py install

This assumes that /opt/python/bin/python is your python3.2 executable.

You may want to insert some testing between the 'build' and 'install'
steps.  Or you could try:

$ /opt/python/bin/python -m compileall build/lib

That would try to compile all Python files in the subdirectory to byte
code.  That's likely to fail if the Python code is not valid Python 3.
If it compiles, you may still want to do some testing.

Hope this helps,

-- HansM
--
http://mail.python.org/mailman/listinfo/python-list


Re: Installing pypi package twice

2012-02-01 Thread Andrea Crotti

On 02/01/2012 04:49 PM, Hans Mulder wrote:


How about (in another directory):

$ tar xzf package.tar.gz
$ cd package
$ /opt/python/bin/python setup.py build
$ sudo /opt/python/bin/python setup.py install

This assumes that /opt/python/bin/python is your python3.2 executable.

You may want to insert some testing between the 'build' and 'install'
steps.  Or you could try:

$ /opt/python/bin/python -m compileall build/lib

That would try to compile all Python files in the subdirectory to byte
code.  That's likely to fail if the Python code is not valid Python 3.
If it compiles, you may still want to do some testing.

Hope this helps,

-- HansM



That works, but it's probably easier to (depending on your needs):
- install easy_install / pip for that python version
- use virtualenv
--
http://mail.python.org/mailman/listinfo/python-list


TypeError

2012-02-01 Thread Clark, Kathleen
Hello,

I am new to python and am trying to correct the follow error:

TypeError: sequence item 1: expected string, NoneType found

The error message is referencing line 86 of my code:

ws.cell(row=row, column=1).value = ','.join([str(ino), fn, ln, sdob])


If I'm understanding this correctly, the code is expecting a string, but not 
finding it.  I'm wondering, what is meant by a string and also how I can 
figure out the problem and correct it.

If anyone could help me understand what the error is and needs to be done to 
correct it, I think I might be able to fill in the blanks.

Thanks,

Katie



__
[logo for email]
  Katie Clark
Research Assistant
  SHARRPP
60 Temple Street, Suite 4D
 New Haven, CT 06510
   203-737-7425
   katie.cl...@yale.edu
 www.sharrpp.com



inline: image002.jpg-- 
http://mail.python.org/mailman/listinfo/python-list


Question about name scope

2012-02-01 Thread Olive
I am learning python and maybe this is obvious but I have not been able
to see a solution. What I would like to do is to be able to execute a
function within the namespace I would have obtained with  from module
import *

For example if I write:

def f(a):
return sin(a)+cos(a)

I could then do:

from math import *

f(5)

But I have polluted my global namespace with all what's defined in
math. I would like to be able to do something like from math import *
at the f level alone.

The main reason for this is the sympy module for CAS (computer algebra).
It reimplement a lot of functions and define all the letters as symbolic
variables. Writing sympy.function everywhere is inconvenient.
Importing all the symbols in the global namespace would lead to name
clash. It would be nice if I could import all the sympy names but for a
given function only.

Olive



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


Re: changing sys.path

2012-02-01 Thread jmfauth
On 1 fév, 17:15, Andrea Crotti andrea.crott...@gmail.com wrote:
 So suppose I want to modify the sys.path on the fly before running some code
 which imports from one of the modules added.

 at run time I do
 sys.path.extend(paths_to_add)

 but it still doesn't work and I get an import error.

 If I take these paths and add them to site-packages/my_paths.pth
 everything works, but at run-time the paths which I actually see before
 importing are exactly the same.

 So there is something I guess that depends on the order, but what can I
 reset/reload to make these paths available (I thought I didn't need
 anything in theory)?


 import mod
Traceback (most recent call last):
  File eta last command, line 1, in module
ImportError: No module named mod
 sys.path.append(r'd:\\jm\\junk')
 import mod
 mod
module 'mod' from 'd:\\jm\\junk\mod.py'
 mod.hello()
fct hello in mod.py


sys.path? Probably, the most genious Python idea.

jmf
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: TypeError

2012-02-01 Thread Dave Angel

On 02/01/2012 11:53 AM, Clark, Kathleen wrote:

Hello,
Which python version, what operating system.  Doesn't cost much to 
specify, and can frequently be relevant.


I am new to python and am trying to correct the follow error:

TypeError: sequence item 1: expected string, NoneType found

That's not an error message, it's just the last line of one.  Please use 
copy/paste to post the entire traceback into your query.

The error message is referencing line 86 of my code:

ws.cell(row=row, column=1).value = ','.join([str(ino), fn, ln, sdob])

And this couldn't be simplified?  The sample is not runnable, so we have 
to make up a wrapper program to define at least 6 variables, and then 
execute this line?

If I'm understanding this correctly, the code

Which code?


is expecting a string, but not finding it.  I'm wondering, what is meant by a 
string and also how I can figure out the problem and correct it.

If anyone could help me understand what the error is and needs to be done to 
correct it, I think I might be able to fill in the blanks.

Thanks,

Katie


If I guess you're running Python 2.7 on Linux 11.04, I could try the 
following:


 ino = 4
 fn = None
 ln = 12
 sdobj = object()
 '.'.join([str(ino), fn, ln, sdobj)
  File stdin, line 1
'.'.join([str(ino), fn, ln, sdobj)
 ^
SyntaxError: invalid syntax
 '.'.join([str(ino), fn, ln, sdobj])
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: sequence item 1: expected string, NoneType found


If this matches your circumstance, the problem is that fn has a value of 
None.  You could have guessed this by simply tucking some print 
statements right in front of the offending line, displaying all six 
variables, and seeing which is of type NoneType.


So now you have to figure out how fn got that value.

(please don't post graphic attachments to your message, this is a text 
mailing list)




--

DaveA

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


Re: Question about name scope

2012-02-01 Thread Chris Kaynor
On Wed, Feb 1, 2012 at 9:11 AM, Olive di...@bigfoot.com wrote:

 I am learning python and maybe this is obvious but I have not been able
 to see a solution. What I would like to do is to be able to execute a
 function within the namespace I would have obtained with  from module
 import *

 For example if I write:

 def f(a):
return sin(a)+cos(a)

 I could then do:

 from math import *

 f(5)

 But I have polluted my global namespace with all what's defined in
 math. I would like to be able to do something like from math import *
 at the f level alone.

 The main reason for this is the sympy module for CAS (computer algebra).
 It reimplement a lot of functions and define all the letters as symbolic
 variables. Writing sympy.function everywhere is inconvenient.
 Importing all the symbols in the global namespace would lead to name
 clash. It would be nice if I could import all the sympy names but for a
 given function only.


The standard way would be to just do:
import math
def f(a):
   return math.sin(a)+math.cos(a)


What this does is import the module math into the current module namespace,
then access attributes on that module.



 Olive



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

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


Re: Question about name scope

2012-02-01 Thread Rick Johnson
On Feb 1, 11:11 am, Olive di...@bigfoot.com wrote:

 But I have polluted my global namespace with all what's defined in
 math. I would like to be able to do something like from math import *
 at the f level alone.

Seeing is believing!

 dir()
['__builtins__', '__doc__', '__name__', '__package__']
 from math import *
 dir()
['__builtins__', '__doc__', '__name__', '__package__', 'acos',
'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil',
'copysign', 'cos', 'cosh', 'degrees', 'e', 'erf', 'erfc', 'exp',
'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum',
'gamma', 'hypot', 'isinf', 'isnan', 'ldexp', 'lgamma', 'log', 'log10',
'log1p', 'modf', 'pi', 'pow', 'radians', 'sin', 'sinh', 'sqrt', 'tan',
'tanh', 'trunc']
  RESTART 
 dir()
['__builtins__', '__doc__', '__name__', '__package__']
 from math import sin, cos
 dir()
['__builtins__', '__doc__', '__name__', '__package__', 'cos', 'sin']

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


Re: Question about name scope

2012-02-01 Thread Ethan Furman

Olive wrote:

I am learning python and maybe this is obvious but I have not been able
to see a solution. What I would like to do is to be able to execute a
function within the namespace I would have obtained with  from module
import *

For example if I write:

def f(a):
return sin(a)+cos(a)

I could then do:

from math import *

f(5)

But I have polluted my global namespace with all what's defined in
math. I would like to be able to do something like from math import *
at the f level alone.


If you are using Python 2.x you can do:

def f(a):
from sympy import *
return a(a) + d(a)

Python 3 does not allow * imports in functions, however, so you would 
need to do:


def f(a):
from sympy import a,b,c,d,e,f,g,h,i,j,k,l,m
from sympy import n,o,p,q,r,s,t,u,v,w,x,y,z
return z(a) / f(a) + o(a)

Obviously, only import the functions you are actually going to use.  ;)

~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list


Re: TypeError

2012-02-01 Thread Nick Dokos
Clark, Kathleen katie.cl...@yale.edu wrote:



 TypeError: sequence item 1: expected string, NoneType found
 
 The error message is referencing line 86 of my code:
 
 ws.cell(row=row, column=1).value = ','.join([str(ino), fn, ln, sdob])
 
 If I’m understanding this correctly, the code is expecting a string, but not 
 finding it.  I’m
 wondering, what is meant by a “string” and also how I can figure out the 
 problem and correct it. 

I'd guess that the sequence in question is the list that's the argument
of join(), in which case item 1 is fn: it should be a string but for some
reason, it is a None value:

,
|  ','.join([str(45), None, bar, foo])
| Traceback (most recent call last):
|   File stdin, line 1, in module
| TypeError: sequence item 1: expected string, NoneType found
| ','.join([str(45), a string, bar, foo])
|'45,a string,bar,foo'
`

Nick

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


Re: Question about name scope

2012-02-01 Thread Dave Angel

On 02/01/2012 12:11 PM, Olive wrote:

I am learning python and maybe this is obvious but I have not been able
to see a solution. What I would like to do is to be able to execute a
function within the namespace I would have obtained with  frommodule
import *

For example if I write:

def f(a):
return sin(a)+cos(a)

I could then do:

from math import *

f(5)

But I have polluted my global namespace with all what's defined in
math. I would like to be able to do something like from math import *
at the f level alone.

The main reason for this is the sympy module for CAS (computer algebra).
It reimplement a lot of functions and define all the letters as symbolic
variables. Writing sympy.function  everywhere is inconvenient.
Importing all the symbols in the global namespace would lead to name
clash. It would be nice if I could import all the sympy names but for a
given function only.

Olive



Start by specifying python version and operating system.

I tried your experiment using Python 2.7 and Linux 11.04


def f(a):
from math import sin, cos
return sin(a) + cos(a)

print f(45)

Does what you needed, and neatly.  The only name added to the global 
namspace is f, of type function.


I was a bit surprised that using   from math import * inside the 
function worked, but it generates  a warning:

olive.py:2: SyntaxWarning: import * only allowed at module level
  def f(a):

I normally avoid any use of the from XX import * form, as it pollutes 
the global name space.  The only exception is when a library writer 
documents that this is the normal way to interface to it.  In this 
case, he usually defines just a few things that are visible this way)


What I do is put a single import math at the top of my source file, and 
use math.sin, and math.cos where needed.  Occasionally, I'll use 
something like:


 from math import sin,cos

at the top, so I know just which symbols I'm defining.

How about:

import math

def f(a):
sin = math.sin
cos = math.cos
return sin(a) + cos(a)

print f(45)

This lets you explicitly use the sin and cos names inside the function, 
by defining them at entry to the function.







--

DaveA

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


Re: Question about name scope

2012-02-01 Thread Chris Rebert
On Wed, Feb 1, 2012 at 9:11 AM, Olive di...@bigfoot.com wrote:
 I am learning python and maybe this is obvious but I have not been able
 to see a solution. What I would like to do is to be able to execute a
 function within the namespace I would have obtained with  from module
 import *

 For example if I write:

 def f(a):
        return sin(a)+cos(a)

 I could then do:

 from math import *

 f(5)

 But I have polluted my global namespace with all what's defined in
 math. I would like to be able to do something like from math import *
 at the f level alone.

 The main reason for this is the sympy module for CAS (computer algebra).
 It reimplement a lot of functions and define all the letters as symbolic
 variables. Writing sympy.function everywhere is inconvenient.
 Importing all the symbols in the global namespace would lead to name
 clash. It would be nice if I could import all the sympy names but for a
 given function only.

Don't think that's possible. Best alternative I can think of would be:

import sympy as s
def f(a):
return s.sin(a) + s.cos(a)

Cheers,
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: changing sys.path

2012-02-01 Thread Andrea Crotti

On 02/01/2012 05:13 PM, Eric Snow wrote:

On Wed, Feb 1, 2012 at 9:15 AM, Andrea Crottiandrea.crott...@gmail.com  wrote:

So suppose I want to modify the sys.path on the fly before running some code
which imports from one of the modules added.

at run time I do
sys.path.extend(paths_to_add)

but it still doesn't work and I get an import error.

Make sure you are adding to sys.path the directories that your
packages/modules are in, and not the actual package directories.
During import Python looks for modules/packages _in_ each of the
directories on sys.path, but not _at_ those directories.


Yes sure I do this..



If I take these paths and add them to site-packages/my_paths.pth
everything works, but at run-time the paths which I actually see before
importing are exactly the same.

You mean sys.path looks exactly the same in the two cases?

-eric


Yes they are exactly the same, because in that file I just write exactly 
the same list,
but when modifying it at run-time it doesn't work, while if at the 
application start

there is this file everything works correctly...

That's what really puzzles me.. What could that be then?
--
http://mail.python.org/mailman/listinfo/python-list


Re: Question about name scope

2012-02-01 Thread Christian Heimes
Am 01.02.2012 18:36, schrieb Dave Angel:
 def f(a):
 from math import sin, cos
 return sin(a) + cos(a)
 
 print f(45)
 
 Does what you needed, and neatly.  The only name added to the global
 namspace is f, of type function.

I recommend against this approach. It's slightly slower and the global
import lock will cause trouble if you start using threads.

Christian

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


Re: changing sys.path

2012-02-01 Thread Rick Johnson
On Feb 1, 10:15 am, Andrea Crotti andrea.crott...@gmail.com wrote:
 So suppose I want to modify the sys.path on the fly before running some code
 which imports from one of the modules added.

 at run time I do
 sys.path.extend(paths_to_add)

 but it still doesn't work and I get an import error.

 If I take these paths and add them to site-packages/my_paths.pth
 everything works, but at run-time the paths which I actually see before
 importing are exactly the same.

1. Is paths_to_add a nested list?
2. Have you tried inspecting the contents of sys.path AFTER calling
extend method?

Consider:
py sys.path.__len__()
14
py sys.path.extend([[1,2,3]])
py sys.path.__len__()
15
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python zipfile v. native unzip

2012-02-01 Thread Tim Chase

On 01/31/12 07:41, Jason Friedman wrote:

Does Python 2.7's zipfile module use its own algorithm or does it
leverage the zip/unzip libraries that exist on the host?  I ask
because my host's native unzip program cannot handle files that, when
unzipped, are larger than 2GB.  Will using Python 2.7 get around this
limitation?


According to:

http://hg.python.org/cpython/file/5395f96588d4/Lib/zipfile.py#l669

I'm guessing that the ZIP64_LIMIT references the 2GB limit, and 
Python's zipfile module requires you to instantiate with


  zf = ZipFile(..., allosZip64=True)


The ZIP64_LIMIT = (1  31) - 1  which is 2GB.  It appears this 
was added in revision fd412a00a07d:


  Patch #1446489 (zipfile: support for ZIP64)

which seems to have been implemented back in at least Python 2.5.

-tkc


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


TypeError

2012-02-01 Thread Clark, Kathleen
Hello and thank you for all responses.  I have resolved my problem.  Turned out 
that one of the files was missing fn and after deleting the record, the 
program ran just fine.

Thanks again,

Katie


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


Startup Chile Company Looking For Founding Developer/CTO

2012-02-01 Thread Jennifer Turliuk
Hi everyone,

My name is Jennifer Turliuk. I'm currently in Santiago, Chile for the
next 6 months as part of the Startup Chile program. I think you may be
able to help me out. We are looking to bring on a developer ASAP (see
description below).

If you are interested, we'd love to hear from you. Or, if you know of
anyone that may be interested, we'd be very grateful if you would pass
this along.

Thanks in advance, and I look forward to hearing from you.

Regards,
Jenn

*Startup Chile Company Looking for Founding Developer/CTO*

We’re building a highly curated online marketplace where people can
find others to exchange skills with on a one-to-one, offline basis.
We’re
looking for a full-time founding developer/CTO to join us, starting
with
the first 6 months in Santiago, Chile as part of the Startup Chile
program.

*About Us*: - Selected for Startup Chile program (alumni: Cruisewise,
Gym-pact) - Secured seed funding - Finalist in competition to shadow
Dave McClure (500 Startups) - Spoke on stage with Peter Thiel - First
website was featured in magazine at age 13 - Top sales associate in
one of N.A.’s most aggressive sales environments - Publicity stunt
garnered $4MM in media coverage in 24hrs - Attended the Oscars 
Grammys - Member of exclusive kiteboarding group with CEOs of
Dropbox, Scribd, Gowalla, etc.

*About the Role*: - Build an AirBnB for skills-exchanges, where
people
can list skills that they can offer and want to learn (e.g. if they
want to
learn Spanish and can teach programming, they can find people to
exchange with via trade or money) - Create a new sharing economy
where time is the currency - Join a tight team that is serious about
winning but also has a great time - Opportunity to build a team and
manage others as we grow - Flexible compensation includes flights
to South America, accommodation, salary, and equity.

*About You*: - Comfortable with backend work, particularly working
with databases and keeping an eye on application performance -
Excited
by challenges and the flexibility of a consumer-facing web startup - A
deep-seated love of efficient/elegant Python, Ruby, Node.js or Django
(front-end knowledge is also helpful) - Passionate about the business
idea - Able to relocate to Santiago, Chile for 6 months fairly
quickly.

Contact us at jenn.turl...@gmail.com by February 1st.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question about name scope

2012-02-01 Thread Mel Wilson
Dave Angel wrote:

 I tried your experiment using Python 2.7 and Linux 11.04
 
 
 def f(a):
  from math import sin, cos
  return sin(a) + cos(a)
 
 print f(45)
 
 Does what you needed, and neatly.  The only name added to the global
 namspace is f, of type function.
 
 I was a bit surprised that using   from math import * inside the
 function worked, but it generates  a warning:
 olive.py:2: SyntaxWarning: import * only allowed at module level
def f(a):

I guess they want local symbols in functions to be pre-compiled.  Similar to 
the way you can't usefully update the dict returned by locals().  Strangely, 
I notice that

Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) 
[GCC 4.4.3] on linux2
Type help, copyright, credits or license for more information.
 def f(x):
...   exec x
...   exec 'print a'
... 
 f('a=4')
4
 

works, but I really cannot explain why.

Mel.

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


PyDev 2.4.0 Released

2012-02-01 Thread Fabio Zadrozny
Hi All,

PyDev 2.4.0 has been released

Details on PyDev: http://pydev.org
Details on its development: http://pydev.blogspot.com

Release Highlights:
---

PyDev is now faster and uses less memory (many performance and memory
improvements were done)!

The contents of the homepage are now migrated to a wiki at
https://wiki.appcelerator.org/display/tis/Python+Development ...
(later most of the homepage will become a mirror of the wiki).

Others

* Organize imports: Fixed issue where other statements in a commit
line got lost (now such a line is ignored).
* PyDev Package Explorer: closed project no longer remains with old icons.
* Fixed deadlock when setting project as Django.
* Fixed issue in code formatting *args on lambda statement.
* TODO tags: only searched now in a string/comment partition.
* Fixed issue when saving empty document (bad location on code-formatter).
* Fixed issue removing comments from document.
* Applied patch for internal Jython 2.2.1 to fix list.sort
(http://bugs.jython.org/issue1835099).
* Fixed resolution of template variable prev_class_or_method and
next_class_or_method.


What is PyDev?
---

PyDev is a plugin that enables users to use Eclipse for Python, Jython
and IronPython development -- making Eclipse a first class Python IDE
-- It comes with many goodies such as code completion, syntax
highlighting, syntax analysis, refactor, debug and many others.


Cheers,

-- 
Fabio Zadrozny
--
Software Developer

Appcelerator
http://appcelerator.com/

Aptana
http://aptana.com/

PyDev - Python Development Environment for Eclipse
http://pydev.org
http://pydev.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Disable use of pyc file with no matching py file

2012-02-01 Thread Terry Reedy

On 2/1/2012 6:14 AM, Devin Jeanpierre wrote:


It really bothers me that you imagine that there are no other problems
than the newness.


And it bothers me that you imput such ignorance to me. You made what I 
think was a bad analogy and I made a better one of the same type, though 
still imperfect. I acknowledged that the transition will take years.


--
Terry Jan Reedy

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


Re: Disable use of pyc file with no matching py file

2012-02-01 Thread Terry Reedy

On 2/1/2012 8:11 AM, John Roth wrote:


One other point: I'm unclear if a compiled module in the source
directory would be named spam.pyc or spam.cpython-32.pyc. I'd think
the latter to allow two versions of a compiled-only distribution.


By test, it has to be spam.pyc, as before.

--
Terry Jan Reedy

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


Re: Buffering in Wing and IDLE 3

2012-02-01 Thread Terry Reedy

On 2/1/2012 10:17 AM, Franck Ditter wrote:


I would prefer to use IDLE but as we are in France, the Python team
does not seem to be aware that the ~ and others are not available
on MacOS-X here (probably the same in Europe)...


We are quite aware of the problem but cannot directly do anything about 
it as the problem is with tcl/tk and Apple. A couple of days ago, Kevin 
Walzer wrote on an IDLE-sig post I'm currently reviewing an updated 
patch to address the problem. When I commit the patch, it will go into 
both Tk's trunk and in the Cocoa 8.5 backport, and eventually be 
available through ActiveState's distribution.


--
Terry Jan Reedy

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


Re: changing sys.path

2012-02-01 Thread Tim Delaney
On 2 February 2012 04:47, Andrea Crotti andrea.crott...@gmail.com wrote:

 Yes they are exactly the same, because in that file I just write exactly
 the same list,
 but when modifying it at run-time it doesn't work, while if at the
 application start
 there is this file everything works correctly...

 That's what really puzzles me.. What could that be then?


Post the actual code, plus traceback. We cannot help you without it.

Tim Delaney
-- 
http://mail.python.org/mailman/listinfo/python-list


Generator problem: parent class not seen

2012-02-01 Thread Russell E. Owen
I have an odd and very intermittent problem in Python script. 
Occasionally it fails with this error:

Traceback (most recent call last):
 File 
/Applications/APO/TTUI.app/Contents/Resources/lib/python2.7/TUI/Base/Bas
eFocusScript.py, line 884, in run
 File 
/Applications/APO/TTUI.app/Contents/Resources/lib/python2.7/TUI/Base/Bas
eFocusScript.py, line 1690, in initAll
TypeError: unbound method initAll() must be called with BaseFocusScript 
instance as first argument (got ScriptClass instance instead)
self=ScriptClass object at 0x2066b410; class hierarchy=[(class 
'TUI.Base.BaseFocusScript.ImagerFocusScript', (class 
'TUI.Base.BaseFocusScript.BaseFocusScript',)), [(class 'ScriptClass', 
(class 'TUI.Base.BaseFocusScript.ImagerFocusScript',))]]

The code looks like this:

def run(self, sr):
try:
self.initAll()

except Exception:
traceback.print_exc(file=sys.stderr)
sys.stderr.write(self=%r; class hierarchy=%s\n % (self, 
inspect.getclasstree([type(self)])))
raise

As a detail that may be important: the code is a generator that is being 
run by a script runner class (an instance of which is passed into the 
run function as argument sr). When the user starts a script the script 
runner calls the script's run generator. The script runner calls the 
run generator again later when conditions are right (e.g. data that is 
being waited for arrives, a time limit is reached...). In this case the 
failure occurs at the very start of the script, so a yield has not yet 
executed.

I am puzzled why Python thinks the class type is wrong, given the output 
of inspect.getclasstree. Any ideas on what might be wrong and how to 
track it down (and why it would be so intermittent)?

-- Russell

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


Problem sending an email in html with mime image

2012-02-01 Thread Ariel
Hi everybody I have a question, here is my problem I want to send an
email with content in html with an image embed so I converted the
image binary in mime text and then I put the mime code inside the src
attribute of the html like this:

img class=logoe src=data:image/jpeg;base64,/9j/4QAYRXhpZgAASUkq ...  /

Then I send the email, here is my code:

from django.template.loader import render_to_string
from django.core.mail.message import EmailMultiAlternatives

contextcopy = {}
message = render_to_string('bulletin.html', contextcopy)
subject = TEST
msg = EmailMultiAlternatives(subject, message,
from_email,['myem...@gmail.com''])
msg.attach_alternative(message, text/html)
msg.send()

The problem is that if I don't put the image mime code inside the src
the email is sent but when I put the code then the email is not send
and I don't get any error message.

Could somebody please, help me ???
Why the email is not send when I put the mime code of the image in the html ???

Regards,
Ariel
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Patching CGIHTTPServer.py

2012-02-01 Thread Giovanni Funchal
Wow, that's very flattering :-)

I've opened an item in the python bug tracker for this enhancement and
attached my patch, let's see how it goes.

Thanks,
-- Giovanni



On Sat, Jan 28, 2012 at 4:04 PM, Miki Tebeka miki.teb...@gmail.com wrote:
 IMO the code is good enough to submit a patch.
 --
 http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


Work from Home. Earn $2000/month. No Investment. Part Time, 1-2h/day.

2012-02-01 Thread businessmot...@hotmail.com
Work from Home. Earn $2000/month. No Investment. Part Time, 1-2h/day.

Wanted Online Internet job workers. Job is only through Internet. Work
from home part time jobs. You can earn $1500-2500/month working 1-2
hours/day, no matter where you live. These are genuine Data entry jobs
 Internet jobs. No Investment required. Only serious enquires please.
For more details visit http://www.earnparttimejobs.com/index.php?id=3677959


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


Work from Home. Earn $2000/month. No Investment. Part Time, 1-2h/day.

2012-02-01 Thread businessmot...@hotmail.com
Work from Home. Earn $2000/month. No Investment. Part Time, 1-2h/day.

Wanted Online Internet job workers. Job is only through Internet. Work
from home part time jobs. You can earn $1500-2500/month working 1-2
hours/day, no matter where you live. These are genuine Data entry jobs
 Internet jobs. No Investment required. Only serious enquires please.
For more details visit http://www.earnparttimejobs.com/index.php?id=3677959


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


Re: Question about name scope

2012-02-01 Thread Ian Kelly
On Wed, Feb 1, 2012 at 11:47 AM, Mel Wilson mwil...@the-wire.com wrote:
 I guess they want local symbols in functions to be pre-compiled.  Similar to
 the way you can't usefully update the dict returned by locals().  Strangely,
 I notice that

 Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
 [GCC 4.4.3] on linux2
 Type help, copyright, credits or license for more information.
 def f(x):
 ...   exec x
 ...   exec 'print a'
 ...
 f('a=4')
 4


 works, but I really cannot explain why.

I am not a dev, but I believe it works because assigning to locals()
and assigning via exec are not the same thing.  The problem with
assigning to locals() is that you're fundamentally just setting a
value in a dictionary, and even though it happens to be the locals
dict for the stack frame, Python can't figure out that it should go
and update the value of the optimized local to match.  exec, on the
other hand, compiles and executes an actual STORE_NAME operation.  Of
course, if the particular local variable hasn't been optimized by the
compiler, then updating locals() works just fine (although you
probably should not rely on this):

 def f(x, y):
... locals()[x] = y
... print locals()[x]
... exec 'print ' + x
...
 f('a', 42)
42
42

Another interesting thing to note is that the print in your example
doesn't even need to be in a second exec, which I believe works
because the presence of any exec statement disables global variable
optimizations for the function.  Compare:

 def f(x):
... locals()['a'] = 4
... print a
...
 f('pass')
Traceback (most recent call last):
  File stdin, line 1, in module
  File stdin, line 3, in f
NameError: global name 'a' is not defined
 def f(x):
... locals()['a'] = 4
... print a
... exec x
...
 f('pass')
4

And while we're on the subject, here's a nicely obscure syntax error:

 def f(x):
...   def g():
... print x
...   exec x
...
  File stdin, line 4
SyntaxError: unqualified exec is not allowed in function 'f' it
contains a nested function with free variables

Cheers,
Ian
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Generator problem: parent class not seen

2012-02-01 Thread Chris Rebert
On Wed, Feb 1, 2012 at 1:00 PM, Russell E. Owen ro...@uw.edu wrote:
 I have an odd and very intermittent problem in Python script.
 Occasionally it fails with this error:

 Traceback (most recent call last):
  File
 /Applications/APO/TTUI.app/Contents/Resources/lib/python2.7/TUI/Base/Bas
 eFocusScript.py, line 884, in run
  File
 /Applications/APO/TTUI.app/Contents/Resources/lib/python2.7/TUI/Base/Bas
 eFocusScript.py, line 1690, in initAll
 TypeError: unbound method initAll() must be called with BaseFocusScript
 instance as first argument (got ScriptClass instance instead)
snip
 The code looks like this:

    def run(self, sr):
        try:
            self.initAll()
snip
 I am puzzled why Python thinks the class type is wrong, given the output
 of inspect.getclasstree. Any ideas on what might be wrong and how to
 track it down (and why it would be so intermittent)?

What's the offending line of initAll() [#1690 in BaseFocusScript.py]
look like? The lines preceding it would also be helpful for context.

Cheers,
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question about name scope

2012-02-01 Thread Ian Kelly
On Wed, Feb 1, 2012 at 3:24 PM, Ethan Furman et...@stoneleaf.us wrote:
 Definitely should rely on it, because in CPython 3 exec does not un-optimize
 the function and assigning to locals() will not actually change the
 functions variables.

Well, the former is not surprising, since exec was changed from a
statement to a built-in.  I don't see any difference in the way
locals() behaves, though:

Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win
32
Type help, copyright, credits or license for more information.
 def f(x, y):
... locals()[x] = y
... print(vars())
... exec('print(' + x + ')')
...
 f('a', 42)
{'y': 42, 'x': 'a', 'a': 42}
42

That still seems to work as I described it.  You couldn't directly
reference it as 'a', though, since the result would be either that it
would try to look up a global with that name, or the compiler would
consider it a local, optimize it, and then you could no longer assign
it via locals().

Cheers,
Ian
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question about name scope

2012-02-01 Thread Ethan Furman

Ian Kelly wrote:

I am not a dev, but I believe it works because assigning to locals()
and assigning via exec are not the same thing.  The problem with
assigning to locals() is that you're fundamentally just setting a
value in a dictionary, and even though it happens to be the locals
dict for the stack frame, Python can't figure out that it should go
and update the value of the optimized local to match.  exec, on the
other hand, compiles and executes an actual STORE_NAME operation.  Of
course, if the particular local variable hasn't been optimized by the
compiler, then updating locals() works just fine (although you
probably should not rely on this):


def f(x, y):

... locals()[x] = y
... print locals()[x]
... exec 'print ' + x
...

f('a', 42)

42
42


Definitely should rely on it, because in CPython 3 exec does not 
un-optimize the function and assigning to locals() will not actually 
change the functions variables.


~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list


Re: Question about name scope

2012-02-01 Thread Ian Kelly
On Wed, Feb 1, 2012 at 3:53 PM, Ethan Furman et...@stoneleaf.us wrote:
 -- def f(x, y):

 ...     locals()[x] = y
 ...     print(vars())
 ...     exec('print (' + x + ')')
 ...     print(x)
 ...
 -- f('a', 42)

 {'y': 42, 'x': 'a', 'a': 42}
 42
 a

 Indeed -- the point to keep in mind is that locals() can become out of sync
 with the functions actual variables.  Definitely falls in the camp of if
 you don't know *exactly* what you are doing, do not play this way!

Sure, but that's not actually out of sync.  The argument of your exec
evaluates to 'print (a)'.  You get two different results because
you're actually printing two different variables.  You can get the
dict temporarily out of sync:

 def f(x, y):
... frob = None
... loc = locals()
... loc[x] = y
... print(loc)
... print(locals())
... print(loc)
...
 f('frob', 42)
{'y': 42, 'x': 'frob', 'frob': 42, 'loc': {...}}
{'y': 42, 'x': 'frob', 'frob': None, 'loc': {...}}
{'y': 42, 'x': 'frob', 'frob': None, 'loc': {...}}

In this case, 'frob' is updated to 42 in the dict, but the optimized
local is not updated.  Calling locals() again refreshes the dict.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Generator problem: parent class not seen

2012-02-01 Thread Russell Owen
On Feb 1, 2012, at 2:34 PM, Chris Rebert wrote:

 On Wed, Feb 1, 2012 at 1:00 PM, Russell E. Owen ro...@uw.edu wrote:
 I have an odd and very intermittent problem in Python script.
 Occasionally it fails with this error:
 
 Traceback (most recent call last):
  File
 /Applications/APO/TTUI.app/Contents/Resources/lib/python2.7/TUI/Base/Bas
 eFocusScript.py, line 884, in run
  File
 /Applications/APO/TTUI.app/Contents/Resources/lib/python2.7/TUI/Base/Bas
 eFocusScript.py, line 1690, in initAll
 TypeError: unbound method initAll() must be called with BaseFocusScript
 instance as first argument (got ScriptClass instance instead)
 snip
 The code looks like this:
 
def run(self, sr):
try:
self.initAll()
 snip
 I am puzzled why Python thinks the class type is wrong, given the output
 of inspect.getclasstree. Any ideas on what might be wrong and how to
 track it down (and why it would be so intermittent)?
 
 What's the offending line of initAll() [#1690 in BaseFocusScript.py]
 look like? The lines preceding it would also be helpful for context.

Here you go. The offending line #169 is marked with ***

-- Russell

class ImagerFocusScript(BaseFocusScript):
   ...
def __init__(self,
sr,
instName,
imageViewerTLName = None,
defRadius = 5.0,
defBinFactor = 1,
maxFindAmpl = None,
doWindow = False,
windowOrigin = 1,
windowIsInclusive = True,
doZeroOverscan = False,
helpURL = None,
debug = False,
):
...
BaseFocusScript.__init__(self,
sr = sr,
gcamActor = gcamActor,
instName = instName,
imageViewerTLName = imageViewerTLName,
defRadius = defRadius,
defBinFactor = defBinFactor,
maxFindAmpl = maxFindAmpl,
doWindow = doWindow,
windowOrigin = windowOrigin,
windowIsInclusive = windowIsInclusive,
helpURL = helpURL,
debug = debug,
)
self.doZeroOverscan = bool(doZeroOverscan)


def initAll(self):
Override the default initAll to record initial bin factor, if 
relevant

***   BaseFocusScript.initAll(self)
if self.exposeModel.instInfo.numBin  0:
self.finalBinFactor = self.exposeModel.bin.getInd(0)[0]


Also, here is BaseFocusScript:

class BaseFocusScript(object):
Basic focus script object.

This is a virtual base class. The inheritor must:
- Provide widgets
- Provide a run method

cmd_Find = find
cmd_Measure = measure
cmd_Sweep = sweep

# constants
#DefRadius = 5.0 # centroid radius, in arcsec
#NewStarRad = 2.0 # amount of star position change to be considered a new 
star
DefFocusNPos = 5  # number of focus positions
DefFocusRange = 200 # default focus range around current focus
FocusWaitMS = 1000 # time to wait after every focus adjustment (ms)
BacklashComp = 0 # amount of backlash compensation, in microns (0 for none)
WinSizeMult = 2.5 # window radius = centroid radius * WinSizeMult
FocGraphMargin = 5 # margin on graph for x axis limits, in um
MaxFocSigmaFac = 0.5 # maximum allowed sigma of best fit focus as a 
multiple of focus range
MinFocusIncr = 10 # minimum focus increment, in um
def __init__(self,
sr,
gcamActor,
instName,
tccInstPrefix = None,
imageViewerTLName = None,
defRadius = 5.0,
defBinFactor = 1,
finalBinFactor = None,
canSetStarPos = True,
maxFindAmpl = None,
doWindow = True,
windowOrigin = 0,
windowIsInclusive = True,
helpURL = None,
debug = False,
):

self.sr = sr
self.sr.debug = bool(debug)
self.gcamActor = gcamActor


def initAll(self):
Initialize variables, table and graph.

# initialize shared variables
self.doTakeFinalImage = False
self.focDir = None
self.currBoreXYDeg = None
self.begBoreXYDeg = None
self.instScale = None
self.arcsecPerPixel = None
self.instCtr = None
self.instLim = None
self.cmdMode = None
self.focPosToRestore = None
self.expTime = None
self.absStarPos = None
self.relStarPos = None
self.binFactor = None
self.window = None # LL pixel is 0, UR pixel is included

self.enableCmdBtns(False)

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


Re: Generator problem: parent class not seen

2012-02-01 Thread Peter Otten
Russell E. Owen wrote:

 I have an odd and very intermittent problem in Python script.
 Occasionally it fails with this error:
 
 Traceback (most recent call last):
  File
 /Applications/APO/TTUI.app/Contents/Resources/lib/python2.7/TUI/Base/Bas
 eFocusScript.py, line 884, in run
  File
 /Applications/APO/TTUI.app/Contents/Resources/lib/python2.7/TUI/Base/Bas
 eFocusScript.py, line 1690, in initAll
 TypeError: unbound method initAll() must be called with BaseFocusScript
 instance as first argument (got ScriptClass instance instead)
 self=ScriptClass object at 0x2066b410; class hierarchy=[(class
 'TUI.Base.BaseFocusScript.ImagerFocusScript', (class
 'TUI.Base.BaseFocusScript.BaseFocusScript',)), [(class 'ScriptClass',
 (class 'TUI.Base.BaseFocusScript.ImagerFocusScript',))]]
 
 The code looks like this:
 
 def run(self, sr):
 try:
 self.initAll()
 
 except Exception:
 traceback.print_exc(file=sys.stderr)
 sys.stderr.write(self=%r; class hierarchy=%s\n % (self,
 inspect.getclasstree([type(self)])))
 raise
 
 As a detail that may be important: the code is a generator that is being
 run by a script runner class (an instance of which is passed into the
 run function as argument sr). When the user starts a script the script
 runner calls the script's run generator. The script runner calls the
 run generator again later when conditions are right (e.g. data that is
 being waited for arrives, a time limit is reached...). In this case the
 failure occurs at the very start of the script, so a yield has not yet
 executed.
 
 I am puzzled why Python thinks the class type is wrong, given the output
 of inspect.getclasstree. Any ideas on what might be wrong and how to
 track it down (and why it would be so intermittent)?

Do you reload()?

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


Re: Generator problem: parent class not seen

2012-02-01 Thread Arnaud Delobelle
On Feb 1, 2012 9:01 PM, Russell E. Owen ro...@uw.edu wrote:

 I have an odd and very intermittent problem in Python script.
 Occasionally it fails with this error:

 Traceback (most recent call last):
  File
 /Applications/APO/TTUI.app/Contents/Resources/lib/python2.7/TUI/Base/Bas
 eFocusScript.py, line 884, in run
  File
 /Applications/APO/TTUI.app/Contents/Resources/lib/python2.7/TUI/Base/Bas
 eFocusScript.py, line 1690, in initAll
 TypeError: unbound method initAll() must be called with BaseFocusScript
 instance as first argument (got ScriptClass instance instead)
 self=ScriptClass object at 0x2066b410; class hierarchy=[(class
 'TUI.Base.BaseFocusScript.ImagerFocusScript', (class
 'TUI.Base.BaseFocusScript.BaseFocusScript',)), [(class 'ScriptClass',
 (class 'TUI.Base.BaseFocusScript.ImagerFocusScript',))]]


Looks like you have loaded the same module twice.  So you have two versions
of your class hierarchies. You can check by printing the ids of your
classes. You will get classes with the same name but different ids.

Arnaud
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question about name scope

2012-02-01 Thread Ethan Furman

Ethan Furman wrote:

Ian Kelly wrote:

I am not a dev, but I believe it works because assigning to locals()
and assigning via exec are not the same thing.  The problem with
assigning to locals() is that you're fundamentally just setting a
value in a dictionary, and even though it happens to be the locals
dict for the stack frame, Python can't figure out that it should go
and update the value of the optimized local to match.  exec, on the
other hand, compiles and executes an actual STORE_NAME operation.  Of
course, if the particular local variable hasn't been optimized by the
compiler, then updating locals() works just fine (although you
probably should not rely on this):


def f(x, y):

... locals()[x] = y
... print locals()[x]
... exec 'print ' + x
...

f('a', 42)

42
42


Definitely should rely on it, because in CPython 3 exec does not 
un-optimize the function and assigning to locals() will not actually 
change the functions variables.



Ouch, that should have been *not* rely on it; not because it doesn't 
work (exec uses locals() if one is not specified), but because it is 
easy for the names in the function to get out of sync with the names in 
the functions locals() (or __dict__).


~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list


Re: Buffering in Wing and IDLE 3

2012-02-01 Thread Kevin Walzer

On 2/1/12 3:01 PM, Terry Reedy wrote:

On 2/1/2012 10:17 AM, Franck Ditter wrote:


I would prefer to use IDLE but as we are in France, the Python team
does not seem to be aware that the ~ and others are not available
on MacOS-X here (probably the same in Europe)...


We are quite aware of the problem but cannot directly do anything about
it as the problem is with tcl/tk and Apple. A couple of days ago, Kevin
Walzer wrote on an IDLE-sig post I'm currently reviewing an updated
patch to address the problem. When I commit the patch, it will go into
both Tk's trunk and in the Cocoa 8.5 backport, and eventually be
available through ActiveState's distribution.


And it's been committed:

http://core.tcl.tk/tk/info/9844fe10b9

--Kevin

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


solutions manual

2012-02-01 Thread solutions for student
solutions for student


solutions(dot)for(dot)student(at)hotmail(dot)com

We're a team for providing solution manuals to help students in their
study.
We sell the books in a soft copy, PDF format.

We will find any book or solution manual for you.

Just email us:

s o l u t i o n s . f o r . s t u d e n t @ h o t m a i l . c o m

List of some books we have
=

A Course in Modern Mathematical Physics by Peter Szekeres
A First Course in Abstract Algebra By  John B. Fraleigh
A first course in probability 6th edition by Ross
A First Course in String Theory by Barton Zwiebach
A Practical Introduction to Data Structures and Algorithm Analysis
Second Edition by Clifford A. Shaffer
A Quantum Approach to Condensed Matter Physics by Philip L. Taylor
A Short Introduction to Quantum Information and Quantum Computation by
Michel Le Bellac
Accompany Digital Systems Principles and Applications, 10th Edition By
Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss
Accompany Electric Machinery and Power System Fundamentals, First
Edition by Stephen J. Chapman
Accompany Electronic Devices and Circuit Theory, 8Ed By Robert L.
Boylestad; Louis Nashelsky; Franz J. Monseen
Accompany Elementary Statistics Ninth Edition by  MILTON LOYER
Accompany Engineering circuit analysis, 6th edition By Hayt
Accompany Foundations of Electromagnetic Theory 2nd Ed. by John R.
Reitz, Frederick J. Milford
Accompany Fundamentals of Fluid Mechanics, 5th Edition by Bruce R.
Munson, Donald F. Young, Theodore H. Okiishi
Accompany Introduction to algorithms By  Sussman J
Accompany Physics for Poets Second Edition By Robert H. March
Accompany Principles of geotechnical engineering, sixth edition by
braja M. DAS
Adaptive Control, 2nd Edition, By Karl Johan Astrom,Bjorn Wittenmark
Adaptive filter thoery 4th edition By Simon Haykin
Advanced Digital Design with the Verilog HDL by Michael D. Ciletti
(Selected problems)
Advanced engineering electromagnetics by Constantine A. Balanis
Advanced Engineering Mathematics 8 Edition By Erwin Kreyszig
Advanced Engineering Mathematics 9 Edition By Erwin Kreyszig
Advanced Modern Engineering Mathematics 3rd Edition by Glyn James
Aircraft Structures for Engineering Students Fourth Edition by T. H.
G. Megson (2007)
Algebra and Trigonometry and Precalculus, 3rd Edition by Penna 
Bittinger Beecher
An introduction to database systems 8th edition By C J Date
An Introduction to Ordinary Differential Equations By James C.
Robinson (with Matlab files)
An Introduction to Signals and Systems By John Stuller
An Introduction to The Finite Element Method (Third Edition) By  J. N.
REDDY
Analysis and design of analog integrated circuits 4th edition by
Srikanth Vaidianathan and Haoyuee Wang
Analytical Mechanics, 7th Edition By Fowles  Cassiday
Antenna Theory Analysis and Design, 2nd Edition Balanis
Antennas for all Applications 3rd edition by John D. Kraus  Ronald J.
Marhefka
Anton Calculus 8th edition, Exercises solutions
Applied Numerical Analysis 7th Edition By Curtis F. Gerald,Patrick O.
Wheatley
Applied Partial Differential Equations with Fourier Series and
Boundary Value Problems 4th Edition by Richard Haberman
Applied Quantum Mechanics by  A. F. J. Levi
Applied Statistics And Probability For Engineers 3rd edition By
Montgomery,Runger
Applied Statistics And Probability For Engineers 4th edition By
Montgomery,Runger
Applied Strength of Materials 4th Edition By Robert L. Mott
Artificial Intelligence A ModernApproach 2nd edition by StuartJ.
Russelland, Peter Norvig
Assembly Language for Intel-Based Computers,3ed, by Kip R. Irvine
Automatic Control Systems 8th edition By Kuo and Golnaraghi

Basic Electrical Engineering By Nagrath, D P Kothari, Nagrath D P
Kothari I J Nagrath, I J Nagrath, 2002
Basic Engineering Circuit Analysis 7th Ed. by J. David Irwin (Selected
Problems)
Basic Engineering Circuit Analysis 8th Edition By J. David Irwin

C++ How to Program, 3rd Ed by  Harvey M. Deitel, Paul J. Deitel
C++ How to Program, 3rd edition By Deitel  Nieto
Calculus 5th Edition By James Stewart
Calculus A Complete Course 6th Edition by R.A. Adams
Calculus Early Transcendentals 5th Edition By Stewart
Calculus early transcendentals 7th edition By Anton Bivens Davis
calculus multivariable 4th edition Deborah Hughes-Hallett, Andrew M.
Gleason, et al
Calculus Single Variable Hughes-Hallett, Gleason, McCallum, et al
Chemical and Engineering Thermodynamics 3rd Ed. by Stanley I. Sandler
Chemical Enginering Vol 6 4th edition by Coulson and Richardson
Classical Dynamics A Contemporary Approach by Jorge V. Jose, Eugene J.
Saletan
Classical Dynamics of Particles and Systems 5th edition by Stephen T.
Thornton, Jerry B. Marion
Classical Electrodynamics 2nd Edition by John David Jackson by Kasper
van Wijk
Classical Mechanics - An Undergraduate Text by R. Douglas Gregory
Classical Mechanics 2nd edition By Goldstein  Safko
CMOS Digital Integrated Circuits 3rd edition By Sung-Mo Kang,Yusuf
Leblebici
CMOS VLSI Design 3e by ananymous

Re: Question about name scope

2012-02-01 Thread Ethan Furman

Ian Kelly wrote:

On Wed, Feb 1, 2012 at 3:24 PM, Ethan Furman et...@stoneleaf.us wrote:

Definitely should rely on it, because in CPython 3 exec does not un-optimize
the function and assigning to locals() will not actually change the
functions variables.


Well, the former is not surprising, since exec was changed from a
statement to a built-in.  I don't see any difference in the way
locals() behaves, though:

Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win
32
Type help, copyright, credits or license for more information.

def f(x, y):

... locals()[x] = y
... print(vars())
... exec('print(' + x + ')')
...

f('a', 42)

{'y': 42, 'x': 'a', 'a': 42}
42

That still seems to work as I described it.  You couldn't directly
reference it as 'a', though, since the result would be either that it
would try to look up a global with that name, or the compiler would
consider it a local, optimize it, and then you could no longer assign
it via locals().

Cheers,
Ian


-- def f(x, y):
... locals()[x] = y
... print(vars())
... exec('print (' + x + ')')
... print(x)
...
-- f('a', 42)
{'y': 42, 'x': 'a', 'a': 42}
42
a

Indeed -- the point to keep in mind is that locals() can become out of 
sync with the functions actual variables.  Definitely falls in the camp 
of if you don't know *exactly* what you are doing, do not play this way!


~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list


Re: Question about name scope

2012-02-01 Thread Ian Kelly
On Wed, Feb 1, 2012 at 4:41 PM, Ethan Furman et...@stoneleaf.us wrote:
 I'm not sure what you mean by temporary:

 -- def f(x, y):

 ...     frob = None
 ...     loc = locals()
 ...     loc[x] = y
 ...     print(loc)
 ...     print(locals())
 ...     print(loc)
 ...     print(locals())
 ...
 --
 -- f('frob', 19)
 {'y': 19, 'x': 'frob', 'frob': 19}
 {'y': 19, 'x': 'frob', 'frob': None, 'loc': {...}}
 {'y': 19, 'x': 'frob', 'frob': None, 'loc': {...}}
 {'y': 19, 'x': 'frob', 'frob': None, 'loc': {...}}

 Seems to be stuck that way.

The first print is the one that is incorrect.  It suggests that the
local 'frob' has been changed to 19 as it has in the dict, but the
actual value of the local is still None.  The second print on
accurately reflect that.
-- 
http://mail.python.org/mailman/listinfo/python-list


solutions books

2012-02-01 Thread solutions for student
solutions for student


solutions(dot)for(dot)student(at)hotmail(dot)com

We're a team for providing solution manuals to help students in their
study.
We sell the books in a soft copy, PDF format.

We will find any book or solution manual for you.

Just email us:

s o l u t i o n s . f o r . s t u d e n t @ h o t m a i l . c o m

List of some books we have
=

A Course in Modern Mathematical Physics by Peter Szekeres
A First Course in Abstract Algebra By  John B. Fraleigh
A first course in probability 6th edition by Ross
A First Course in String Theory by Barton Zwiebach
A Practical Introduction to Data Structures and Algorithm Analysis
Second Edition by Clifford A. Shaffer
A Quantum Approach to Condensed Matter Physics by Philip L. Taylor
A Short Introduction to Quantum Information and Quantum Computation by
Michel Le Bellac
Accompany Digital Systems Principles and Applications, 10th Edition By
Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss
Accompany Electric Machinery and Power System Fundamentals, First
Edition by Stephen J. Chapman
Accompany Electronic Devices and Circuit Theory, 8Ed By Robert L.
Boylestad; Louis Nashelsky; Franz J. Monseen
Accompany Elementary Statistics Ninth Edition by  MILTON LOYER
Accompany Engineering circuit analysis, 6th edition By Hayt
Accompany Foundations of Electromagnetic Theory 2nd Ed. by John R.
Reitz, Frederick J. Milford
Accompany Fundamentals of Fluid Mechanics, 5th Edition by Bruce R.
Munson, Donald F. Young, Theodore H. Okiishi
Accompany Introduction to algorithms By  Sussman J
Accompany Physics for Poets Second Edition By Robert H. March
Accompany Principles of geotechnical engineering, sixth edition by
braja M. DAS
Adaptive Control, 2nd Edition, By Karl Johan Astrom,Bjorn Wittenmark
Adaptive filter thoery 4th edition By Simon Haykin
Advanced Digital Design with the Verilog HDL by Michael D. Ciletti
(Selected problems)
Advanced engineering electromagnetics by Constantine A. Balanis
Advanced Engineering Mathematics 8 Edition By Erwin Kreyszig
Advanced Engineering Mathematics 9 Edition By Erwin Kreyszig
Advanced Modern Engineering Mathematics 3rd Edition by Glyn James
Aircraft Structures for Engineering Students Fourth Edition by T. H.
G. Megson (2007)
Algebra and Trigonometry and Precalculus, 3rd Edition by Penna 
Bittinger Beecher
An introduction to database systems 8th edition By C J Date
An Introduction to Ordinary Differential Equations By James C.
Robinson (with Matlab files)
An Introduction to Signals and Systems By John Stuller
An Introduction to The Finite Element Method (Third Edition) By  J. N.
REDDY
Analysis and design of analog integrated circuits 4th edition by
Srikanth Vaidianathan and Haoyuee Wang
Analytical Mechanics, 7th Edition By Fowles  Cassiday
Antenna Theory Analysis and Design, 2nd Edition Balanis
Antennas for all Applications 3rd edition by John D. Kraus  Ronald J.
Marhefka
Anton Calculus 8th edition, Exercises solutions
Applied Numerical Analysis 7th Edition By Curtis F. Gerald,Patrick O.
Wheatley
Applied Partial Differential Equations with Fourier Series and
Boundary Value Problems 4th Edition by Richard Haberman
Applied Quantum Mechanics by  A. F. J. Levi
Applied Statistics And Probability For Engineers 3rd edition By
Montgomery,Runger
Applied Statistics And Probability For Engineers 4th edition By
Montgomery,Runger
Applied Strength of Materials 4th Edition By Robert L. Mott
Artificial Intelligence A ModernApproach 2nd edition by StuartJ.
Russelland, Peter Norvig
Assembly Language for Intel-Based Computers,3ed, by Kip R. Irvine
Automatic Control Systems 8th edition By Kuo and Golnaraghi

Basic Electrical Engineering By Nagrath, D P Kothari, Nagrath D P
Kothari I J Nagrath, I J Nagrath, 2002
Basic Engineering Circuit Analysis 7th Ed. by J. David Irwin (Selected
Problems)
Basic Engineering Circuit Analysis 8th Edition By J. David Irwin

C++ How to Program, 3rd Ed by  Harvey M. Deitel, Paul J. Deitel
C++ How to Program, 3rd edition By Deitel  Nieto
Calculus 5th Edition By James Stewart
Calculus A Complete Course 6th Edition by R.A. Adams
Calculus Early Transcendentals 5th Edition By Stewart
Calculus early transcendentals 7th edition By Anton Bivens Davis
calculus multivariable 4th edition Deborah Hughes-Hallett, Andrew M.
Gleason, et al
Calculus Single Variable Hughes-Hallett, Gleason, McCallum, et al
Chemical and Engineering Thermodynamics 3rd Ed. by Stanley I. Sandler
Chemical Enginering Vol 6 4th edition by Coulson and Richardson
Classical Dynamics A Contemporary Approach by Jorge V. Jose, Eugene J.
Saletan
Classical Dynamics of Particles and Systems 5th edition by Stephen T.
Thornton, Jerry B. Marion
Classical Electrodynamics 2nd Edition by John David Jackson by Kasper
van Wijk
Classical Mechanics - An Undergraduate Text by R. Douglas Gregory
Classical Mechanics 2nd edition By Goldstein  Safko
CMOS Digital Integrated Circuits 3rd edition By Sung-Mo Kang,Yusuf
Leblebici
CMOS VLSI Design 3e by ananymous

Re: Question about name scope

2012-02-01 Thread Ethan Furman

Ian Kelly wrote:

On Wed, Feb 1, 2012 at 4:41 PM, Ethan Furman et...@stoneleaf.us wrote:

I'm not sure what you mean by temporary:

-- def f(x, y):

... frob = None
... loc = locals()
... loc[x] = y
... print(loc)
... print(locals())
... print(loc)
... print(locals())
...
--
-- f('frob', 19)
{'y': 19, 'x': 'frob', 'frob': 19}
{'y': 19, 'x': 'frob', 'frob': None, 'loc': {...}}
{'y': 19, 'x': 'frob', 'frob': None, 'loc': {...}}
{'y': 19, 'x': 'frob', 'frob': None, 'loc': {...}}

Seems to be stuck that way.


The first print is the one that is incorrect.  It suggests that the
local 'frob' has been changed to 19 as it has in the dict, but the
actual value of the local is still None.  The second print on
accurately reflect that.


Ah.  Thanks for the explanations.

~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list


Re: Generator problem: parent class not seen

2012-02-01 Thread Russell Owen
On Feb 1, 2012, at 3:35 PM, Arnaud Delobelle wrote:
 On Feb 1, 2012 9:01 PM, Russell E. Owen ro...@uw.edu wrote:
 
  I have an odd and very intermittent problem in Python script.
  Occasionally it fails with this error:
 
  Traceback (most recent call last):
   File
  /Applications/APO/TTUI.app/Contents/Resources/lib/python2.7/TUI/Base/Bas
  eFocusScript.py, line 884, in run
   File
  /Applications/APO/TTUI.app/Contents/Resources/lib/python2.7/TUI/Base/Bas
  eFocusScript.py, line 1690, in initAll
  TypeError: unbound method initAll() must be called with BaseFocusScript
  instance as first argument (got ScriptClass instance instead)
  self=ScriptClass object at 0x2066b410; class hierarchy=[(class
  'TUI.Base.BaseFocusScript.ImagerFocusScript', (class
  'TUI.Base.BaseFocusScript.BaseFocusScript',)), [(class 'ScriptClass',
  (class 'TUI.Base.BaseFocusScript.ImagerFocusScript',))]]
 
 
 Looks like you have loaded the same module twice.  So you have two versions 
 of your class hierarchies. You can check by printing the ids of your classes. 
 You will get classes with the same name but different ids.
 
 Arnaud
 

Yes! I was reloading BaseFocusScript. Oops.

In detail: script files are dynamically loaded when first requested and can be 
reloaded for debugging. I think that's safe because script files are 
self-contained (e.g. the classes in them are never subclassed or anything like 
that). But I went too far: I had my focus scripts reload BaseFocusScript, which 
is shared code, so that I could tweak BaseFocusScript while debugging focus 
scripts.

Thank you very much!

-- Russell-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Registry entries set up by the Windows installer

2012-02-01 Thread Mark Hammond

On 2/02/2012 2:09 AM, Paul Moore wrote:

I'm trying to get information on what registry entries are set up by
the Python Windows installer, and what variations exist. I don't know
enough about MSI to easily read the source, so I'm hoping someone who
knows can help :-)

As far as I can see on my PC, the installer puts entries

HKLM\Software\Python\PythonCore\x.y

with various bits underneath. I think I've seen indications that
sometimes these are in HKCU, presumably for a per user install? If I
manually hack around in the registry, and have both HKLM and HKCU,
which one will Python use?


For setting PYTHONPATH it uses both - HKEY_CURRENT_USER is added before 
HKEY_LOCAL_MACHINE.  I can't recall which one distutils generated 
(bdist_wininst) installers will use - it may even offer the choice.



Furthermore, more of a Windows question than Python, but there's a
similar question with regard to the .py and .pyw file associations -
they can be in HKLM\Software\Classes or HKCU\Software\Classes. Which
takes precedence?


No idea I'm afraid, but I'd expect it to use HKCU


I assume that the installer writes to HKLM for all
users and HKCU for per-user installs.


Yep, I think that is correct.


Is there anything else I've missed?


I'm also not sure which one the pylauncher project will prefer, which 
may become relevant should that get rolled into Python itself.



The reason I ask, is that I'm starting to work with virtualenv, and I
want to see what would be involved in (re-)setting the registry
entries to match the currently active virtualenv. virtualenvwrapper-
powershell seems to only deal with HKCU (which is a big plus on
Windows 7, as it avoids endless elevation requests :-)) but that
doesn't work completely cleanly with my all-users install. (Note: I'm
not entirely sure that changing global settings like this to patch a
per-console virtualenv is a good idea, but I'd like to know how hard
it is before dismissing it...)


Out of interest, what is the reason forcing you to look at that - 
bdist_wininst installers?  FWIW, my encounters with virtualenv haven't 
forced me to hack the registry - I just install bdist_wininst packages 
into the parent Python which isn't ideal but works fine for me.  This 
was a year or so ago, so the world might have changed since then.


Mark
--
http://mail.python.org/mailman/listinfo/python-list


Re: Question about name scope

2012-02-01 Thread Ethan Furman

Ian Kelly wrote:

Sure, but that's not actually out of sync.  The argument of your exec
evaluates to 'print (a)'.  You get two different results because
you're actually printing two different variables.


Ah -- thanks, I missed that.



You can get the dict temporarily out of sync:


def f(x, y):

... frob = None
... loc = locals()
... loc[x] = y
... print(loc)
... print(locals())
... print(loc)
...

f('frob', 42)

{'y': 42, 'x': 'frob', 'frob': 42, 'loc': {...}}
{'y': 42, 'x': 'frob', 'frob': None, 'loc': {...}}
{'y': 42, 'x': 'frob', 'frob': None, 'loc': {...}}

In this case, 'frob' is updated to 42 in the dict, but the optimized
local is not updated.  Calling locals() again refreshes the dict.


I'm not sure what you mean by temporary:

-- def f(x, y):
... frob = None
... loc = locals()
... loc[x] = y
... print(loc)
... print(locals())
... print(loc)
... print(locals())
...
--
-- f('frob', 19)
{'y': 19, 'x': 'frob', 'frob': 19}
{'y': 19, 'x': 'frob', 'frob': None, 'loc': {...}}
{'y': 19, 'x': 'frob', 'frob': None, 'loc': {...}}
{'y': 19, 'x': 'frob', 'frob': None, 'loc': {...}}

Seems to be stuck that way.

Here is a better example I was thinking of:

-- def f(x, y):
... locals()[x] = y
... locals()['x'] = 17
... print(locals())
... print(x)
... print(y)
...
-- f('a', 42)
{'y': 42, 'x': 'a', 'a': 42}
a
42

So locals() was updated with 'a', but not with the assignment to 'x'. 
And of course, if we tried to 'print(a)' we'd get a NameError.


~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list


Re: TypeError

2012-02-01 Thread Steven D'Aprano
Hello Katie,

When posting to technical news groups like this, can you please send 
plain text emails rather than so-called rich text (actually HTML code) 
email? Or at least, don't use Microsoft Word as your email editor. Many 
people will be reading your posts using text applications and will see 
line after line of very bad HTML like this:

 p class=MsoNormalHello,o:p/o:p/p p
 class=MsoNormalo:pnbsp;/o:p/p p class=MsoNormalI am new to
 python and am trying to correct the follow error:o:p/o:p/p p
 class=MsoNormalo:pnbsp;/o:p/p p
 class=MsoNormalbTypeError: sequence item 1: expected string,
 NoneType foundo:p/o:p/b/p [...]

and that's the sort of thing that makes programmers grumpy and less 
inclined to help.

To answer your question:


On Wed, 01 Feb 2012 16:53:41 +, Clark, Kathleen wrote:
 I am new to python and am trying to correct the follow error:
 
 TypeError: sequence item 1: expected string, NoneType found

It is best, if possible, to post the entire traceback starting with the 
line Traceback (most recent call last) rather than just the last line. 
In this case, the error is simple enough to work out that it may not 
matter, but in general it often does matter.


 The error message is referencing line 86 of my code:
 
 ws.cell(row=row, column=1).value = ','.join([str(ino), fn, ln, sdob])

In this case, one of the variables fn, ln and sdob is None instead of a 
string.


 If I'm understanding this correctly, the code is expecting a string, but
 not finding it.  I'm wondering, what is meant by a string and also how
 I can figure out the problem and correct it.

If you are new enough to programming that you need to ask what is a 
string, you might find the Python tutor mailing list a more useful place 
than here. 

http://mail.python.org/mailman/listinfo/tutor

String is short for string of characters, that is, text, and in 
Python strings are created with quotation marks or the str() function. So:

a = this is a string
b = 'so is this'
c = str(some_variable)  # and so is this

To fix the problem, there is a quick and dirty way, and the proper way. 
The quick and dirty way is to just force all items in the list to be 
strings, regardless of what they currently are. Your line:

ws.cell(row=row, column=1).value = ','.join([str(ino), fn, ln, sdob])

becomes:

ws.cell(row=row, column=1).value = ','.join(
[str(ino), str(fn), str(ln), str(sdob)])


While this might work, the fact that one or more of fn, ln and sdob is 
None may be a bug in your code, and converting to a string may very well 
just obscure the source of the bug and make it harder to solve in the 
long run. So the proper way to fix the problem is:

(1) Identify which variable is not a string.
(2) Find out why it becomes set to None.
(3) Fix it.

The first part is easy: insert this line before line 86:

print(fn, ln, sdob:, fn, ln, sdob)

and see what it says. Fixing it means working backwards from that point, 
finding out where the variable gets set to None, and fixing that bug.

Good luck!


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


Re: Question about name scope

2012-02-01 Thread Steven D'Aprano
On Wed, 01 Feb 2012 14:53:09 -0800, Ethan Furman wrote:

 Indeed -- the point to keep in mind is that locals() can become out of
 sync with the functions actual variables.  Definitely falls in the camp
 of if you don't know *exactly* what you are doing, do not play this
 way!

And if you *do* know exactly what you are doing, you will probably decide 
not to play this way also!


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


Re: Question about name scope

2012-02-01 Thread Ethan Furman

Ethan Furman wrote:

Ethan Furman wrote:

Ian Kelly wrote:

I am not a dev, but I believe it works because assigning to locals()
and assigning via exec are not the same thing.  The problem with
assigning to locals() is that you're fundamentally just setting a
value in a dictionary, and even though it happens to be the locals
dict for the stack frame, Python can't figure out that it should go
and update the value of the optimized local to match.  exec, on the
other hand, compiles and executes an actual STORE_NAME operation.  Of
course, if the particular local variable hasn't been optimized by the
compiler, then updating locals() works just fine (although you
probably should not rely on this):


def f(x, y):

... locals()[x] = y
... print locals()[x]
... exec 'print ' + x
...

f('a', 42)

42
42


Definitely should rely on it, because in CPython 3 exec does not 
un-optimize the function and assigning to locals() will not actually 
change the functions variables.



Ouch, that should have been *not* rely on it; not because it doesn't 
work (exec uses locals() if one is not specified), but because it is 
easy for the names in the function to get out of sync with the names in 
the functions locals() (or __dict__).


I should stop answering now  :(  Ignore the __dict__ comment, it is 
incorrect.


~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list


Re: changing sys.path

2012-02-01 Thread Steven D'Aprano
On Wed, 01 Feb 2012 17:47:22 +, Andrea Crotti wrote:

 Yes they are exactly the same, because in that file I just write exactly
 the same list,
 but when modifying it at run-time it doesn't work, while if at the
 application start
 there is this file everything works correctly...
 
 That's what really puzzles me.. What could that be then?


Are you using IDLE or WingIDE or some other IDE which may not be 
honouring sys.path? If so, that's a BAD bug in the IDE.

Are you changing the working directory manually, by calling os.chdir? If 
so, that could be interfering with the import somehow. It shouldn't, but 
you never know...

Are you adding absolute paths or relative paths?

You say that you get an ImportError, but that covers a lot of things 
going wrong. Here's a story. Could it be correct? I can't tell because 
you haven't posted the traceback.

When you set site-packages/my_paths.pth you get a sys path that looks 
like ['a', 'b', 'fe', 'fi', 'fo', 'fum']. You then call import spam 
which locates b/spam.py and everything works.

But when you call sys.path.extend(['a', 'b']) you get a path that looks 
like ['fe', 'fi', 'fo', 'fum', 'a', 'b']. Calling import spam locates 
some left over junk file, fi/spam.py or fi/spam.pyc, which doesn't 
import, and you get an ImportError.


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


simple system for building packages for multiple platforms?

2012-02-01 Thread Dan Goodman

Hi all,

Until recently, our package has been pure Python, so distributing it has 
been straightforward. Now, however, we want to add some extension 
modules in C++. We're happy to provide source only distributions on 
Linux because almost all Linux users will have all the required 
compilers and so forth already installed. But we also want to support 
Windows users who may not have C++ compilers available, which means 
providing built distributions. But, we're faced with this problem, there 
are three versions of Python we're supporting (2.5-2.7) and two 
architectures (32 and 64 bit), which means 6 possible platforms to build 
for (and maybe more in future if we upgrade to Python 3). Is there a 
straightforward way to set up a semi-automated build system for this?


At the moment, I'm thinking about either having a bunch of virtual 
machines or Amazon EC2 instances and submitting build jobs to these, but 
setting that up looks to be a lot of work and I guess many people have 
had this problem before. So, what do other people do?


Also, once we have a build system up, I guess it can also be used for a 
more extensive testing system on these multiple platforms?


Dan

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


Re: copy on write

2012-02-01 Thread John O'Hagan
On Fri, 13 Jan 2012 10:40:47 -0800
Ethan Furman et...@stoneleaf.us wrote:

 Steven D'Aprano wrote:
  Normally this is harmless, but there is one interesting little
  glitch you can get:
  
  t = ('a', [23])
  t[1] += [42]
  Traceback (most recent call last):
File stdin, line 1, in module
  TypeError: 'tuple' object does not support item assignment
  t
  ('a', [23, 42])

IMHO, this is worthy of bug-hood: shouldn't we be able to conclude from the 
TypeError that the assignment failed?

 There is one other glitch, and possibly my only complaint:
 
 -- a = [1, 2, 3]
 -- b = 'hello, world'
 -- a = a + b
 Traceback (most recent call last):
File stdin, line 1, in module
 TypeError: can only concatenate list (not str) to list
 -- a += b
 -- a
 [1, 2, 3, 'h', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r', 'l', 'd']
 
 IMO, either both + and += should succeed, or both should fail.
 
 ~Ethan~


This also happens for tuples, sets, generators and range objects (probably any 
iterable), AFAIK only when the left operand is a list. Do lists get special 
treatment in terms of implicitly converting the right-hand operand?

The behaviour of the in-place operator could be more consistent across types:

 a=[1,2]
 a+=(3,4)
 a
[1, 2, 3, 4]
 a=(1,2)
 a+=(3,4)
 a
(1, 2, 3, 4)
 a=(1,2)
 a+=[3,4]
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: can only concatenate tuple (not list) to tuple


John
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: copy on write

2012-02-01 Thread Rick Johnson
On Jan 13, 10:48 am, Devin Jeanpierre jeanpierr...@gmail.com wrote:
 On Fri, Jan 13, 2012 at 10:13 AM, Grant Edwards inva...@invalid.invalid 
 wrote:
  On 2012-01-13, Devin Jeanpierre jeanpierr...@gmail.com wrote:
  On Fri, Jan 13, 2012 at 7:30 AM, Chris Angelico ros...@gmail.com wrote:
 There's a bit of a feeling
 that code should do what it looks like and be sort of understandable
 without exactly understanding everything.

Yeah there's a word for that; INTUITIVE, And I've been preaching its
virtues (sadly in vain it seems!) to these folks for some time now.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: xhtml encoding question

2012-02-01 Thread Tim Arnold

On 2/1/2012 3:26 AM, Stefan Behnel wrote:

Tim Arnold, 31.01.2012 19:09:

I have to follow a specification for producing xhtml files.
The original files are in cp1252 encoding and I must reencode them to utf-8.
Also, I have to replace certain characters with html entities.
-
import codecs, StringIO
from lxml import etree
high_chars = {
0x2014:'mdash;', # 'EM DASH',
0x2013:'ndash;', # 'EN DASH',
0x0160:'Scaron;',# 'LATIN CAPITAL LETTER S WITH CARON',
0x201d:'rdquo;', # 'RIGHT DOUBLE QUOTATION MARK',
0x201c:'ldquo;', # 'LEFT DOUBLE QUOTATION MARK',
0x2019:rsquo;, # 'RIGHT SINGLE QUOTATION MARK',
0x2018:lsquo;, # 'LEFT SINGLE QUOTATION MARK',
0x2122:'trade;', # 'TRADE MARK SIGN',
0x00A9:'copy;',  # 'COPYRIGHT SYMBOL',
}
def translate(string):
s = ''
for c in string:
if ord(c) in high_chars:
c = high_chars.get(ord(c))
s += c
return s


I hope you are aware that this is about the slowest possible algorithm
(well, the slowest one that doesn't do anything unnecessary). Since none of
this is required when parsing or generating XHTML, I assume your spec tells
you that you should do these replacements?


I wasn't aware of it, but I am now--code's embarassing now.
The spec I must follow forces me to do the translation.

I am actually working with html not xhtml; which makes a huge 
difference, sorry for that.


Ulrich's line of code for translate is elegant.
for c in string:
s += high_chars.get(c,c)




def reencode(filename, in_encoding='cp1252',out_encoding='utf-8'):
with codecs.open(filename,encoding=in_encoding) as f:
s = f.read()
sio = StringIO.StringIO(translate(s))
parser = etree.HTMLParser(encoding=in_encoding)
tree = etree.parse(sio, parser)


Yes, you are doing something dangerous and wrong here. For one, you are
decoding the data twice. Then, didn't you say XHTML? Why do you use the
HTML parser to parse XML?


I see that I'm decoding twice now, thanks.

Also, I now see that when lxml writes the result back out the entities I 
got from my translate function are resolved, which defeats the whole 
purpose.



result = etree.tostring(tree.getroot(), method='html',
pretty_print=True,
encoding=out_encoding)
with open(filename,'wb') as f:
f.write(result)


Use tree.write(f, ...)


From the all the info I've received on this thread, plus some 
additional reading, I think I need the following code.


Use the HTMLParser because the source files are actually HTML, and use 
output from etree.tostring() as input to translate() as the very last step.


def reencode(filename, in_encoding='cp1252', out_encoding='utf-8'):
parser = etree.HTMLParser(encoding=in_encoding)
tree = etree.parse(filename, parser)
result = etree.tostring(tree.getroot(), method='html',
pretty_print=True,
encoding=out_encoding)
with open(filename, 'wb') as f:
f.write(translate(result))

not simply tree.write(f...) because I have to do the translation at the 
end, so I get the entities instead of the resolved entities from lxml.


Again, it would be simpler if this was xhtml, but I misspoke 
(mis-wrote?) when I said xhtml; this is for html.



Assuming you really meant XHTML and not HTML, I'd just drop your entire
code and do this instead:

   tree = etree.parse(in_path)
   tree.write(out_path, encoding='utf8', pretty_print=True)

Note that I didn't provide an input encoding. XML is safe in that regard.

Stefan



thanks everyone for the help.

--Tim Arnold

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


Re: copy on write

2012-02-01 Thread Steven D'Aprano
On Wed, 01 Feb 2012 19:51:13 -0800, Rick Johnson wrote:

 Yeah there's a word for that; INTUITIVE, And I've been preaching its
 virtues (sadly in vain it seems!) to these folks for some time now.

Intuitive to whom?

Expert Python programmers?

VB coders?

Perl hackers?

School children who have never programmed before?

Mathematicians?

Babies?

Rocket scientists?

Hunter-gatherers from the Kalahari desert?


My intuition tells me you have never even considered that intuition 
depends on who is doing the intuiting. 


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


Re: copy on write

2012-02-01 Thread Devin Jeanpierre
On Wed, Feb 1, 2012 at 10:18 PM, John O'Hagan resea...@johnohagan.com wrote:
 On Fri, 13 Jan 2012 10:40:47 -0800
 Ethan Furman et...@stoneleaf.us wrote:

 Steven D'Aprano wrote:
  Normally this is harmless, but there is one interesting little
  glitch you can get:
 
  t = ('a', [23])
  t[1] += [42]
  Traceback (most recent call last):
    File stdin, line 1, in module
  TypeError: 'tuple' object does not support item assignment
  t
  ('a', [23, 42])

 IMHO, this is worthy of bug-hood: shouldn't we be able to conclude from the 
 TypeError that the assignment failed?

It did fail. The mutation did not.

I can't think of any way out of this misleadingness, although if you
can that would be pretty awesome.

-- Devin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Disable use of pyc file with no matching py file

2012-02-01 Thread Devin Jeanpierre
On Wed, Feb 1, 2012 at 2:53 PM, Terry Reedy tjre...@udel.edu wrote:
 And it bothers me that you imput such ignorance to me. You made what I think
 was a bad analogy and I made a better one of the same type, though still
 imperfect. I acknowledged that the transition will take years.

Ah. It is a common attitude among those that make these sorts of
comments about Python 3, and I hadn't read anything in what you said
that made me think that you were considering more than the superficial
costs of moving. I am sorry that I did not give you the benefit of the
doubt.

-- Devin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: xhtml encoding question

2012-02-01 Thread Stefan Behnel
Tim Arnold, 01.02.2012 19:15:
 On 2/1/2012 3:26 AM, Stefan Behnel wrote:
 Tim Arnold, 31.01.2012 19:09:
 I have to follow a specification for producing xhtml files.
 The original files are in cp1252 encoding and I must reencode them to
 utf-8.
 Also, I have to replace certain characters with html entities.
 -
 import codecs, StringIO
 from lxml import etree
 high_chars = {
 0x2014:'mdash;', # 'EM DASH',
 0x2013:'ndash;', # 'EN DASH',
 0x0160:'Scaron;',# 'LATIN CAPITAL LETTER S WITH CARON',
 0x201d:'rdquo;', # 'RIGHT DOUBLE QUOTATION MARK',
 0x201c:'ldquo;', # 'LEFT DOUBLE QUOTATION MARK',
 0x2019:rsquo;, # 'RIGHT SINGLE QUOTATION MARK',
 0x2018:lsquo;, # 'LEFT SINGLE QUOTATION MARK',
 0x2122:'trade;', # 'TRADE MARK SIGN',
 0x00A9:'copy;',  # 'COPYRIGHT SYMBOL',
 }
 def translate(string):
 s = ''
 for c in string:
 if ord(c) in high_chars:
 c = high_chars.get(ord(c))
 s += c
 return s

 I hope you are aware that this is about the slowest possible algorithm
 (well, the slowest one that doesn't do anything unnecessary). Since none of
 this is required when parsing or generating XHTML, I assume your spec tells
 you that you should do these replacements?

 I wasn't aware of it, but I am now--code's embarassing now.
 The spec I must follow forces me to do the translation.
 
 I am actually working with html not xhtml; which makes a huge difference,

We all learn.


 Ulrich's line of code for translate is elegant.
 for c in string:
 s += high_chars.get(c,c)

Still not efficient because it builds the string one character at a time
and needs to reallocate (and potentially copy) the string buffer quite
frequently in order to do that. You are lucky with CPython, because it has
an internal optimisation that mitigates this overhead on some platforms.
Other Python implementations don't have that, and even the optimisation in
CPython is platform specific (works well on Linux, for example).

Peter Otten presented the a better way of doing it.


 From the all the info I've received on this thread, plus some additional
 reading, I think I need the following code.
 
 Use the HTMLParser because the source files are actually HTML, and use
 output from etree.tostring() as input to translate() as the very last step.
 
 def reencode(filename, in_encoding='cp1252', out_encoding='utf-8'):
 parser = etree.HTMLParser(encoding=in_encoding)
 tree = etree.parse(filename, parser)
 result = etree.tostring(tree.getroot(), method='html',
 pretty_print=True,
 encoding=out_encoding)
 with open(filename, 'wb') as f:
 f.write(translate(result))
 
 not simply tree.write(f...) because I have to do the translation at the
 end, so I get the entities instead of the resolved entities from lxml.

Yes, that's better.

Still one thing (since you didn't show us your final translate() function):
you do the character escaping on a UTF-8 encoded string and made the
encoding configurable. That means that the characters you are looking for
must also be encoded with the same encoding in order to find matches.
However, if you ever choose a different target encoding that doesn't have
the nice properties of UTF-8's byte sequences, you may end up with
ambiguous byte sequences in the output that your translate() function
accidentally matches on, thus potentially corrupting your data.

Assuming that you are using Python 2, you may even be accidentally doing
the replacement using Unicode character strings, which then only happens to
work on systems that use UTF-8 as their default encoding. Python 3 has
fixed this trap, but you have to take care to avoid it in Python 2.

I'd prefer serialising the documents into a unicode string
(encoding='unicode'), then post-processing that and finally encoding it to
the target encoding when writing it out. But you'll have to see how that
works out together with your escaping step, and also how it impacts the
HTML meta tag that states the document encoding.

Stefan

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


Re: How can I verify if the content of a variable is a list or a string?

2012-02-01 Thread Rainer Grimm
You can do it more concise.

 def isListOrString(p):
...return any((isinstance(p,list),isinstance(p,str)))
...
 listOrString(string)
True
 listOrString([1,2,3])
True
 listOrString(2)
False
 listOrString(False)
False

Rainer
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Iterate from 2nd element of a huge list

2012-02-01 Thread Paulo da Silva
Em 01-02-2012 04:55, Cameron Simpson escreveu:
 On 01Feb2012 03:34, Paulo da Silva p_s_d_a_s_i_l_...@netcabo.pt wrote:

 | BTW, iter seems faster than iterating thru mylist[1:]!
 
 I would hope the difference can be attributed to the cost of copying
 mylist[1:]. 
I don't think so. I tried several times and the differences were almost
always consistent.

I put mylist1=mylist[1:] outside the time control. iter still seems a
little bit faster. Running both programs several times (1000
elements list) I only got iter being slower once!

But, of course, most of the difference comes from the copy.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python reliability with EINTR handling in general modules

2012-02-01 Thread oleg korenevich
On Feb 1, 6:07 pm, Dennis Lee Bieber wlfr...@ix.netcom.com wrote:
 On Wed, 1 Feb 2012 06:15:22 -0800 (PST), oleg korenevich









 void.of.t...@gmail.com wrote:
 I have linux board on samsung SoC s3c6410 (ARM11). I build rootfs with
 buildroot: Python 2.7.1, uClibc-0.9.31. Linux kernel: Linux buildroot
 2.6.28.6 #177 Mon Oct 3 12:50:57 EEST 2011 armv6l GNU/Linux

 My app, written on python, in some mysterios conditons raise this
 exceptions:

 1) exception:

  File ./dfbUtils.py, line 3209, in setItemData
 ValueError: (4, 'Interrupted system call')
 code:

 currentPage=int(math.floor(float(rowId)/
 self.pageSize))==self.selectedPage
 2) exception:

 File ./terminalGlobals.py, line 943, in getFirmawareName
 OSError: [Errno 4] Interrupted system call: 'firmware'
 code:

 for fileName in os.listdir('firmware'):
 Some info about app: it have 3-7 threads, listen serial ports via
 'serial' module, use gui implemented via c extension that wrap
 directfb, i can't reproduce this exceptions, they are not predictable.

 I googled for EINTR exceptions in python, but only found that EINTR
 can occur only on slow system calls and python's modules socket,
 subprocess and another one is already process EINTR. So what happens
 in my app? Why simple call of math function can interrupt program at
 any time, it's not reliable at all. I have only suggestions: ulibc
 bug, kernel/hw handling bug. But this suggestions don't show me
 solution.

         I see nothing in your traceback that indicates that the interrupt
 occurred in the math library call -- unless you deleted that line. In
 the first one, I'd be more likely to suspect your C extension/wrapper...
 (are the fields .pageSize and .selectedPage coming from an object
 implemented in C?)

         As for the math stuff... I presume both rowID and .pageSize are
 constrained to be 0 or positive integers. If that is the case, invoking
 math.floor() is just redundant overhead as the documented behavior of
 int() is to truncate towards 0, which for a positive value, is the same
 as floor()



  neg = -3.141592654
  pos = 3.141592654
  int(neg)
 -3
  math.floor(neg)
 -4.0
  int(pos)
 3
  math.floor(pos)
 3.0

         In the second case... Well, os.listdir() is most likely translated
 into some operating system call.

 http://www.gnu.org/software/libc/manual/html_node/Interrupted-Primiti...

 And, while that call is waiting for I/O to complete, some sort of signal
 is being received.
 --
         Wulfraed                 Dennis Lee Bieber         AF6VN
         wlfr...@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Thanks for help. In first case all vars is python integers, maybe
math.floor is redundant, but i'm afraid that same error with math
module call will occur in other places of app, where math is needed.
Strange thing here is that math library call is not a system call, and
strange exception ValueError (all values have right values) and why in
braces i have (4, Interruted system call).

For second case: if python really does some slow system call from
module os, why it doesn't handle EINTR and not restart call. Is
SA_RESTART flag in signal can be solution? But how i can set this
flag? By placing flag for signal handler in c extension (or ctypes
manipulation)?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How can I verify if the content of a variable is a list or a string?

2012-02-01 Thread Steven D'Aprano
On Wed, 01 Feb 2012 23:19:57 -0800, Rainer Grimm wrote:

 You can do it more concise.
 
 def isListOrString(p):
 ...return any((isinstance(p,list),isinstance(p,str)))


Or even more concisely still:

isinstance(p, (list, str))



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


Re: Iterate from 2nd element of a huge list

2012-02-01 Thread Steven D'Aprano
On Thu, 02 Feb 2012 07:23:04 +, Paulo da Silva wrote:

 Em 01-02-2012 04:55, Cameron Simpson escreveu:
 On 01Feb2012 03:34, Paulo da Silva p_s_d_a_s_i_l_...@netcabo.pt
 wrote:
 
 | BTW, iter seems faster than iterating thru mylist[1:]!
 
 I would hope the difference can be attributed to the cost of copying
 mylist[1:].
 I don't think so. I tried several times and the differences were almost
 always consistent.

Yes, actually iterating over a list-iterator appears to be trivially 
faster (although this may not apply to arbitrary iterators):

steve@runes:~$ python -m timeit -s L=range(1) for x in L: pass
1000 loops, best of 3: 280 usec per loop
steve@runes:~$ python -m timeit -s L=range(1) for x in iter(L): 
pass
1000 loops, best of 3: 274 usec per loop


The difference of 6 microseconds would be lost in the noise if the loops 
actually did something useful.

Also keep in mind that for tiny lists, the overhead of creating the 
iterator is probably much greater than the time of iterating over the 
list:

steve@runes:~$ python -m timeit -s L=range(3) for x in L: pass
100 loops, best of 3: 0.238 usec per loop
steve@runes:~$ python -m timeit -s L=range(3) for x in iter(L): pass
100 loops, best of 3: 0.393 usec per loop

But of course the difference is only relatively significant, in absolute 
terms nobody is going to notice an extra 0.1 or 0.2 microseconds.



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


[issue13734] Add a generic directory walker method to avoid symlink attacks

2012-02-01 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

 I think the O(depth) version is fine. The O(1) version is quite more
 complicated, difficult to follow, and it seems less robust (it doesn't
 use try/finally and therefore might leak fds if the generator isn't
 exhausted before being destroyed).

I agree.

 On modern systems you have at least 1024 fds, so the restriction
 shouldn't be a problem.

Actually, I think you're much more likely to run above the max
recursion limit than RLIMIT_NOFILE (OTOH, you don't know how many FDs
are already open at the time of the call).

--

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



[issue13734] Add a generic directory walker method to avoid symlink attacks

2012-02-01 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

I'm also a fan of using the simpler approach unless/until we have solid 
evidence that the file descriptor limit could be a problem in practice.

A comment in the code mentioning the concern, along with the fact that there's 
an alternate algorithm attached to this tracker issue that avoids it would 
probably be appropriate though.

--

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



[issue13719] bdist_msi upload fails

2012-02-01 Thread Ralf Schmitt

Ralf Schmitt python-b...@systemexit.de added the comment:

It's a bug in bdist_msi not in the upload command. You can check that 
distribution.dist_files point to valid files after running the command.

--

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



[issue13917] Python 2.7.2 and 3.2.2 execl crash

2012-02-01 Thread Carlo Di Dato

New submission from Carlo Di Dato shin...@autistici.org:

These lines make Python 2.7.2 and 3.2.2 crash

import os
os.execl(cmd.exe, )

Regards

--
components: Windows
messages: 152428
nosy: shinnai
priority: normal
severity: normal
status: open
title: Python 2.7.2 and 3.2.2 execl crash
type: crash
versions: Python 2.7, Python 3.1

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



[issue13917] Python 2.7.2 and 3.2.2 execl crash

2012-02-01 Thread Carlo Di Dato

Changes by Carlo Di Dato shin...@autistici.org:


--
versions: +Python 3.2 -Python 3.1

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



[issue13917] Python 2.7.2 and 3.2.2 execl crash

2012-02-01 Thread Tim Golden

Tim Golden m...@timgolden.me.uk added the comment:

This is a duplicate of http://bugs.python.org/issue8036

(which I still haven't got around to applying...)

--
nosy: +tim.golden

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



[issue13917] Python 2.7.2 and 3.2.2 execl crash

2012-02-01 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
resolution:  - duplicate
status: open - closed
superseder:  - Interpreter crashes on invalid arg to spawnl on Windows

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



[issue7856] cannot decode from or encode to big5 \xf9\xd8

2012-02-01 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +haypo
versions: +Python 2.7, Python 3.2, Python 3.3 -Python 2.6

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



[issue13918] locale.atof documentation is missing func argument

2012-02-01 Thread Cédric Krier

New submission from Cédric Krier cedric.kr...@b2ck.com:

atof has a func argument used to instantiate the result but it is missing in 
the documentation.

--
assignee: docs@python
components: Documentation
messages: 152430
nosy: ced, docs@python
priority: normal
severity: normal
status: open
title: locale.atof documentation is missing func argument
type: enhancement

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



[issue13868] Add hyphen doc fix

2012-02-01 Thread Boštjan Mejak

Boštjan Mejak bostjan.me...@gmail.com added the comment:

Seriously, how old are you two clowns?

--

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



[issue13868] Add hyphen doc fix

2012-02-01 Thread Sandro Tosi

Sandro Tosi sandro.t...@gmail.com added the comment:

On Wed, Feb 1, 2012 at 15:42, Boštjan Mejak rep...@bugs.python.org wrote:
 Seriously, how old are you two clowns?

I think it's enough: FTR I'm +1 on removing Retro tracker account,
effective immediately (if any admin is around).

--

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



[issue12328] multiprocessing's overlapped PipeConnection on Windows

2012-02-01 Thread sbt

sbt shibt...@gmail.com added the comment:

I have done an updated patch.  (It does *not* switch to using bytes oriented 
pipes as I suggested in the previous message.)

The patch also adds a wait() function with signature

wait(object_list, timeout=None)

for polling multiple objects at once.  On Unix it is just a wrapper for

select.select(object_list, [], [], timeout)

except that it retries when it gets EINTR.  wait() works with connected 
sockets too, although on Windows it does not work for listening sockets.

The patch removes SentinelReady and changes concurrent.futures to use wait() 
instead.

Polling is now done by issuing zero length overlapped reads.  This means that 
the pipe is not modified except possibly if a zero length message is removed.

I changed ReadFile(), WriteFile() and GetOverlappedResult() to return pairs, 
the second entry of which is zero or an expected error code.  (Unexpected 
errors still raise an exception.)  This avoids the need to ever use 
GetLastError().

--
Added file: http://bugs.python.org/file24388/pipe_poll_fix.patch

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



[issue13868] Add hyphen doc fix

2012-02-01 Thread Boštjan Mejak

Boštjan Mejak bostjan.me...@gmail.com added the comment:

Kiss my ball sac!

--

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



[issue13919] kiss my ball sac

2012-02-01 Thread Boštjan Mejak

Changes by Boštjan Mejak bostjan.me...@gmail.com:


--
assignee: docs@python
components: Documentation
nosy: Retro, docs@python
priority: normal
severity: normal
status: open
title: kiss my ball sac
type: enhancement
versions: Python 2.7

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



  1   2   >