Pogo 0.7

2012-04-28 Thread Jendrik Seipp

I am proud to announce a new release of Pogo, probably the simplest and
fastest audio player for Linux.

The tarball and an Ubuntu PPA are available at
http://launchpad.net/pogo


What is Pogo?

Pogo plays your music. Nothing else. It is both fast and easy-to-use. 
The clear interface uses the screen real-estate very efficiently. Other 
features include: Fast search on the harddrive and in the playlist, 
smart album grouping, cover display, desktop notifications and no music 
library.
Pogo is a fork of Decibel Audio Player and supports most common audio 
formats. It is written in Python and uses GTK+ and gstreamer.



What's new in

 0.7 It has a melody both happy and sad (2012-04-27)
==
* Search in home folder if we haven't found anything in the music 
directories.

* Do not search in subdirectories if we already search in parent directory.
* Only show filename and at most one parent dir for each file in search 
results.

* Convert GUI from libglade to gtkbuilder.
* Update translations.

Cheers,
Jendrik





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

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


Re: HTML Code - Line Number

2012-04-28 Thread Tim Roberts
smac2...@comcast.net wrote:

For scrapping purposes, I am having a bit of trouble writing a block
of code to define, and find, the relative position (line number) of a
string of HTML code. I can pull out one string that I want, and then
there is always a line of code, directly beneath the one I can pull
out, that begins with the following:
td align=left valign=top class=body_cols_middle

However, because this string of HTML code above is not unique to just
the information I need (which I cannot currently pull out), I was
hoping there is a way to effectively say if you find the html string
_ in the line of HTML code above, and the string td align=left
valign=top class=body_cols_middle in the line immediately
following, then pull everything that follows this second string.

Regular expression-based screen scraping is extremely delicate.  All it
takes is one tweak to the HTML, and your scraping fails although the page
continues to look the same.

A much better plan is to use sgmllib to write yourself a mini HTML parser.
You can handle td tags with the attributes you want, and count down until
you get to the td tag you want.
-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


int object

2012-04-28 Thread Debashish Saha
Notebook
Actions
Cell
Actions
Format
Output
Insert
Move
Run
Autoindent:
Kernel
Actions
Kill kernel upon exit:
Help
Python IPython Links
NumPy SciPy
MPL SymPy
run selected cell Shift-Enter :
run selected cell in-place Ctrl-Enter :
show keyboard shortcuts Ctrl-m h :
Configuration
Tooltip on tab:
Smart completer:
milliseconds Time before tooltip :
In [4]:

impor

from __future__ import division

from numpy import*

import numpy as np

import matplotlib.pyplot as plt

from scipy.special import jv

from scipy.special import yn





h_cross=1

m=1

E=np.linspace(0.1,10,100)



V0=-100

R=2

K=(2*E)**0.5

K_P=(2*(E-V0))**0.5









'''r=np.linspace(-10,10,1000)

def V(r):

   if r0 and rR:

   return V0

   return 0

V=np.vectorize(V)

ax.set_ylim(-200,10)

plt.plot(r,V(r))'''





def sph_jv(l,r):

return (pi/(2*r))**0.5*jv(l+0.5,r)







def sph_yn(l,r):

return (pi/(2*r))**0.5*yn(l+0.5,r)





def delta_l(K,l):

K_P=(2*(E-V0))**0.5

K=(2*E)**0.5

sph_jv_P=(l*sph_jv(l,K*R)/(K*R))-sph_jv(l,K*R)

sph_yn_P=(l*sph_yn(l,K*R)/(K*R))-sph_yn(l,K*R)

Beta_l=l-(K_P*R(sph_jv(l+1,K_P*R))/(sph_jv(l,K_P*R)))

return 
arctan((K*R*sph_jv_P-Beta_l*sph_jv(l,K*R))/(K*R*sph_yn_P-Beta_l*sph_yn(l,K*R)))





delta_l=np.vectorize(delta_l)



print delta_l(K,0)





---
TypeError Traceback (most recent call last)
/home/deba/ipython-input-4-e1d59e6e732b in module()
 49 delta_l=np.vectorize(delta_l)
 50
--- 51 print delta_l(K,0)
 52

/home/deba/epd-7.2-1-rh5-x86_64/lib/python2.7/site-packages/numpy/lib/function_base.pyc
in __call__(self, *args)
   1860 for arg in args:
   1861 newargs.append(asarray(arg).flat[0])
- 1862 theout = self.thefunc(*newargs)
   1863 if isinstance(theout, tuple):
   1864 self.nout = len(theout)

/home/deba/ipython-input-4-e1d59e6e732b in delta_l(K, l)
 43 sph_jv_P=(l*sph_jv(l,K*R)/(K*R))-sph_jv(l,K*R)
 44 sph_yn_P=(l*sph_yn(l,K*R)/(K*R))-sph_yn(l,K*R)
--- 45 Beta_l=l-(K_P*R(sph_jv(l+1,K_P*R))/(sph_jv(l,K_P*R)))
 46 return
arctan((K*R*sph_jv_P-Beta_l*sph_jv(l,K*R))/(K*R*sph_yn_P-Beta_l*sph_yn(l,K*R)))
 47

TypeError: 'int' object is not callable
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: HTML Code - Line Number

2012-04-28 Thread Jon Clements
On Friday, 27 April 2012 18:09:57 UTC+1, smac...@comcast.net  wrote:
 Hello,
 
 For scrapping purposes, I am having a bit of trouble writing a block
 of code to define, and find, the relative position (line number) of a
 string of HTML code. I can pull out one string that I want, and then
 there is always a line of code, directly beneath the one I can pull
 out, that begins with the following:
 td align=left valign=top class=body_cols_middle
 
 However, because this string of HTML code above is not unique to just
 the information I need (which I cannot currently pull out), I was
 hoping there is a way to effectively say if you find the html string
 _ in the line of HTML code above, and the string td align=left
 valign=top class=body_co SMac2347 at comcast.net writes:

 
 Hello,
 
 I am having some difficulty generating the output I want from web
 scraping. Specifically, the script I wrote, while it runs without any
 errors, is not writing to the output file correctly. It runs, and
 creates the output .txt file; however, the file is blank (ideally it
 should be populated with a list of names).
 
 I took the base of a program that I had before for a different data
 gathering task, which worked beautifully, and edited it for my
 purposes here. Any insight as to what I might be doing wrote would be
 highly appreciated. Code is included below. Thanks!

[quoting reply to first thread]
I would approach it like this...

import lxml.html

QUERY = '//tr[@bgcolor=#F1F3F4][td[starts-with(@class, body_cols)]]'

url = 'http://www.skadden.com/Index.cfm?contentID=44alphaSearch=A'


tree = lxml.html.parse(url).getroot()
trs = tree.xpath(QUERY)
for tr in trs:
   tds = [el.text_content() for el in tr.iterfind('td')]
   print tds


hth

Jon.
[/quote]





 following, then pull everything that follows this second string.
 
 Any thoughts as to how to define a function to do this, or do this
 some other way? All insight is much appreciated! Thanks.

 SMac2347 at comcast.net writes:

 
 Hello,
 
[snip]
 Any thoughts as to how to define a function to do this, or do this
 some other way? All insight is much appreciated! Thanks.
 

[quote in reply to second thread]
Did you not see my reply to your previous thread?

And why do you want the line number?
[/quote]

I'm trying this on GG, as the mailing list gateway one or t'other does nee seem 
to work (mea culpa no doubt).

So may have obscured the issue more with my quoting and snipping, or what not.

Jon.









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


Re: syntax for code blocks

2012-04-28 Thread Kiuhnm
On 4/27/2012 18:07, Steven D'Aprano wrote:
 On Fri, 27 Apr 2012 17:03:19 +0200, Kiuhnm wrote:
 
 On 4/27/2012 16:09, Steven D'Aprano wrote:
 On Fri, 27 Apr 2012 13:24:35 +0200, Kiuhnm wrote:

 I'd like to change the syntax of my module 'codeblocks' to make it
 more pythonic.

 Current Syntax:

with res  func(arg1)  'x, y':
print(x, y)

with res  func(arg1)  block_name  'x, y':
print(x, y)


 I'm sorry, I don't see how this is a code block. Where is the code in
 the block, and how can you pass it to another object to execute it?

 Maybe if you read the entire post...
 
 No, I read the entire post. It made no sense to me. Let me give one
 example. You state:
 
  The full form is equivalent to
   def anon_func(x, y):
   print(x, y)
   res = func(arg1, block_name = anon_func)
 
 but this doesn't mean anything to me. What's func? Where does it come
 from? What's arg1? Why does something called block_NAME have a default
 value of a function instead of a NAME?
 
 How about you give an actual working example of what you mean by a code
 block and how you use it?

The rewriting rules are the following, where X --- Y means that X is rewritten 
as Y on the fly:

1)
  with res  func(args)  'x, y':
  code

  ---

  def anon_func(x, y):
  code
  res = func(args, anon_func)

2)
  with res  func(args)  block_name  'x, y':
  code

  ---

  def anon_func(x, y):
  code
  res = func(args, block_name = anon_func)

That's all.
func is some function which takes a function as a positional argument or as a 
keyword parameter neamed block_name.

Some examples:

1)
  text = Anyone should be able to read this message!
  with ris  re.sub(r'(\w)(\w+)(\w)', string = text)  repl  'm':
  inner_word = list(m.group(2))
  random.shuffle(inner_word)
  _return (m.group(1) + .join(inner_word) + m.group(3))
  print(ris)

which prints (something like):

  Aynnoe shluod be albe to read tihs msgseae!

2)
  numbers = [random.randint(1, 100) for i in range(30)]

  with sorted1  sorted(numbers)  key  'x':
  if x = 50:
  _return(-x)
  else:
  _return(x)

  print(sorted1)

which prints (something like):
  [50, 47, 46, 28, 28, 25, 24, 23, 21, 19, 16, 15, 14, 3, 52, 52, 53, 54, 58, 
62,
63, 69, 70, 72, 74, 78, 84, 86, 90, 97]

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


Re: why () is () and [] is [] work in other way?

2012-04-28 Thread Kiuhnm

On 4/27/2012 19:15, Adam Skutt wrote:

On Apr 27, 11:01 am, Kiuhnmkiuhnm03.4t.yahoo.it  wrote:

On 4/27/2012 1:57, Adam Skutt wrote:

On Apr 26, 6:34 pm, Kiuhnmkiuhnm03.4t.yahoo.itwrote:

If you

understand that your 'a' is not really an object but a reference to it,
everything becomes clear and you see that '==' always do the same thing.



Yes, object identity is implemented almost? everywhere by comparing
the value of two pointers (references)[1]. I've already said I'm not
really sure how else one would go about implementing it.



You might tell me that that's just an implementation detail, but when an
implementation detail is easier to understand and makes more sense than
the whole abstraction which is built upon it, something is seriously wrong.



I'm not sure what abstraction is being built here.  I think you have
me confused for someone else, possibly Steven.


The abstraction is this:
- There are primitives and objects.
- Primitives are not objects. The converse is also true.
- Primitives can become objects (boxing).
- Two primitives x and y are equal iff x == y.
- Two objects x and y are equal iff x.equals(y).
- Two objects are the same object iff x == y.
- If x is a primitive, then y = x is a deep copy.
- If x is an object, then y = x is a shallow copy.
- ...



This is not an abstraction at all, but merely a poor explanation of
how things work in Java.  Your last statement is totally incorrect, as
no copying of the object occurs whatsoever.  The reference is merely
reseated to refer to the new object. If you're going to chide me for
ignoring the difference between the reference and the referent object,
then you shouldn't ignore it either, especially in the one case where
it actually matters!  If we try to extend this to other languages,
then it breaks down completely.


With shallow copy I meant exactly that. I didn't think that my using the 
term with a more general meaning would cause such a reaction.

I don't agree on the other things you said, of course.




The truth:
- Primitives can be references.
- Two primitives are equal iff x == y.
- Operator '.' automatically derefences references.



You have the first statement backwards.  References are a primitive
construct, not the other way around.


So you're saying that I said that Primitive constructs are references. 
Right...



 While true, it's still a bad way
to think about what's going on.  It breaks down once we add C++ /
Pascal reference types to the mix, for example.


?


It's better to think about variables (names) and just recognize that
not all variables have the same semantics.  It avoids details that are
irrelevant to writing actual programs and remains consistent.


Maybe in your opinion. As I said, I don't agree with you.


Equality or equivalence is a relation which is:
- reflexive
- symmetric
- transitive
Everything else... is something else. Call it semi-equality,
tricky-equality or whatever, but not equality, please.


Sure, but then it's illegal to allow the usage of '==' with floating
point numbers, which will never have these properties in any usable
implementation[1].


???


 So we're back to what started this tangent, and we
end up needing 'equals()' methods on our classes to distinguish
between the different forms of equality.  That's precisely what you
want to avoid.

Or we can just accept that '==' doesn't always possess those
properties, which is what essentially every programming language does,
and call it (value) equality.  As long as we don't cross incompatible
meanings, it's hard to believe that this isn't the right thing to do.




If anything, you have that backwards.  Look at Python: all variables
in Python have pointer semantics, not value semantics.


When everything is white, the word white becomes redundant.
So the fact that everything in Python have reference semantics means
that we can't stop thinking about value and reference semantics.


Nope. The behavior of variables is absolutely essential to writing
correct programs.  If I write a program in Python that treats
variables as if they were values, it will be incorrect.


You misunderstood what I said. You wouldn't treat variables as if they 
were values because you wouldn't even know what that means and that 
that's even a possibility.
I've never heard an old C programmer talk about value semantics and 
reference semantics. When everything is a value, your world is pretty 
simple.



  In imperative
languages, pointers have greater utility over value types because not
all types can obey the rules for value types.  For example, I don't
know how to give value semantics to something like a I/O object (e.g,
file, C++ fstream, C FILE), since I don't know how to create
independent copies.


By defining a copy constructor.


Then write me a working one.  I'll wait. To save yourself some time,
you can start with std::fstream.


Will you pay me for my time?

Your problem is that you think that copy semantics requires real 
copying. I really don't 

Re: solutions books

2012-04-28 Thread ali deli
Hi,




I'am a college physics student.




If you have the following document 

SOLUTIONS MANUAL
  TO FUNDAMENTALS OF ENGINEERING ELECTROMAGNETICS, by

DAVID CHENG ,




Could you please send me the document?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: why () is () and [] is [] work in other way?

2012-04-28 Thread Chris Angelico
On Sat, Apr 28, 2012 at 9:26 PM, Kiuhnm
kiuhnm03.4t.yahoo...@mail.python.org wrote:
 Your problem is that you think that copy semantics requires real copying. I
 really don't see any technical difficulty in virtualizing the all thing.

Copy semantics without real copying is an optimization that a
program should never need to be aware of. For instance, you could have
two 16GB strings share their buffers to avoid having to use 32GB of
memory; but to demonstrate copy semantics, they would need to
copy-on-write in some fashion. There's duplicate state but shared
memory. The trouble with duplicating state of a std::fstream is that
it's roughly impossible. You could perhaps simulate it with read-only
file access, but when you write, somehow it has to affect the disk,
and that means either you copy the file (but keep the same file name)
or have both of them affect the same file (meaning we're on Borg
semantics, not copying).

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


Re: why () is () and [] is [] work in other way?

2012-04-28 Thread Kiuhnm

On 4/27/2012 17:39, Adam Skutt wrote:

On Apr 27, 8:07 am, Kiuhnmkiuhnm03.4t.yahoo.it  wrote:

Useful... maybe, conceptually sound... no.
Conceptually, NaN is the class of all elements which are not numbers,
therefore NaN = NaN.


NaN isn't really the class of all elements which aren't numbers.  NaN
is the result of a few specific IEEE 754 operations that cannot be
computed, like 0/0, and for which there's no other reasonable
substitute (e.g., infinity) for practical applications .

In the real world, if we were doing the math with pen and paper, we'd
stop as soon as we hit such an error. Equality is simply not defined
for the operations that can produce NaN, because we don't know to
perform those computations.  So no, it doesn't conceptually follow
that NaN = NaN, what conceptually follows is the operation is
undefined because NaN causes a halt.


Mathematics is more than arithmetics with real numbers. We can use FP 
too (we actually do that!). We can say that NaN = NaN but that's just an 
exception we're willing to make. We shouldn't say that the equivalence 
relation rules shouldn't be followed just because *sometimes* we break them.



This is what programming languages ought to do if NaN is compared to
anything other than a (floating-point) number: disallow the operation
in the first place or toss an exception.  Any code that tries such an
operation has a logic error and must be fixed.

However, when comparing NaN against floating point numbers, I don't
see why NaN == NaN returning false is any less conceptually correct
than any other possible result.  NaN's very existence implicitly
declares that we're now making up the rules as we go along, so we
might as well pick the simplest set of functional rules.

Plus, floating point numbers violate our expectations of equality
anyway, frequently in  surprising ways.  0.1 + 0.1 + 0.1 == 0.3 is
true with pen and paper, but likely false on your computer.


Maybe wrong expectations of equality, since 0.1 (the real number) is 
/not/ a floating point.
Don't confuse the representation of floating points with the floating 
point themselves.



 It's even
potentially possible to compare two floating point variables twice and
get different results each time[1]!


We should look at the specification and not the single implementations.


 As such, we'd have this problem
with defining equality even if NaN didn't exist.  We must treat
floating-point numbers as a special case in order to write useful
working programs.  This includes defining equality in a way that's
different from what works for nearly every other data type.

Adam

[1] Due to register spilling causing intermediate rounding.  This
could happen with the x87 FPU since the registers were 80-bits wide
but values were stored in RAM as 64-bits.  This behavior is less
common now, but hardly impossible.


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


Re: CPython thread starvation

2012-04-28 Thread Roy Smith
In article 7xy5pgqwto@ruckus.brouhaha.com,
 Paul Rubin no.email@nospam.invalid wrote:

 John Nagle na...@animats.com writes:
 I may do that to prevent the stall.  But the real problem was all
  those DNS requests.  Parallizing them wouldn't help much when it took
  hours to grind through them all.
 
 True dat.  But building a DNS cache into the application seems like a
 kludge.  Unless the number of requests is insane, running a caching
 nameserver on the local box seems cleaner.

I agree that application-level name cacheing is wrong, but sometimes 
doing it the wrong way just makes sense.  I could whip up a simple 
cacheing wrapper around getaddrinfo() in 5 minutes.  Depending on the 
environment (both technology and bureaucracy), getting a cacheing 
nameserver installed might take anywhere from 5 minutes to a few days to 
kicking a dead whale down the beach (if you need to involve your 
corporate IT department) to it just ain't happening (if you need to 
involve your corporate IT department).

Doing DNS cacheing correctly is non-trivial.  In fact, if you're 
building it on top of getaddrinfo(), it may be impossible, since I don't 
think getaddrinfo() exposes all the data you need (i.e. TTL values).  
But, doing a half-assed job of cache expiration is better than not 
expiring your cache at all.  I would suggest (from experience) that if 
you build a getaddrinfo() wrapper, you have cache entries time out after 
a fairly short time.  From the problem description, it sounds like using 
a 1-minute timeout would get 99% of the benefit and might keep you from 
doing some bizarre things.

PS -- I've also learned by experience that nscd can mess up.  If DNS 
starts doing stuff that doesn't make sense, my first line of attack is 
usually killing and restarting the local nscd.  Often enough, that 
solves the problem, and it rarely causes any problems that anybody would 
notice.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: CPython thread starvation

2012-04-28 Thread Danyel Lawson
Sprinkle time.sleep(0) liberally throughout your code where you think
natural processing breaks should be.  Even in while loops. It's lame
but is the only way to make Python multithreading task switch fairly.
Your compute intensive tasks need a time.sleep(0) in their loops. This
prevents starvation and makes overall processing and responsiveness
seem properly multithreaded. This is a hand optimization so you have
to play with the location and amount of time.sleep(0)s. You'll know
when you've found a problematic spot when the queues stop
growing/overflowing.

Put the dns lookup on a separate thread pool with it's own growing
queue with lots of time.sleep(0)s sprinkled in. The dns lookups don't
have to be real time and you can easily cache them with a timestamp
attached. This is the thread pool where more is better and threads
should be aggressively terminated for having a long running process
time. This also requires lots of hand tuning for dynamically managing
the number of threads needed to process the queue in a reasonable time
if you find it hard to aggressively kill threads. I think there is a
way to launch threads that only give them a maximum lifetime. The
problem you will hit while tuning may require allocating more file
handles for all the hung sockets.

The DNS lookup is one of those things that may make sense to run as a
separate daemon process that listens on a socket. You make one
connection that feeds in the ip addresses. The daemon process feeds
back ip address/host name combinations out of order. Your main
process/connection thread builds a serialized access dict with
timestamps. The main processes threads make their requests
asynchronously and sleep while waiting for the response to appear in
the dict. They terminate after a certain time if they don't see their
response. Requires hand/algorithmic tweaking for this to work
correctly across different machines.

On Fri, Apr 27, 2012 at 2:54 PM, John Nagle na...@animats.com wrote:
    I have a multi-threaded CPython program, which has up to four
 threads.  One thread is simply a wait loop monitoring the other
 three and waiting for them to finish, so it can give them more
 work to do.  When the work threads, which read web pages and
 then parse them, are compute-bound, I've had the monitoring thread
 starved of CPU time for as long as 120 seconds.
 It's sleeping for 0.5 seconds, then checking on the other threads
 and for new work do to, so the work thread isn't using much
 compute time.

   I know that the CPython thread dispatcher sucks, but I didn't
 realize it sucked that bad.  Is there a preference for running
 threads at the head of the list (like UNIX, circa 1979) or
 something like that?

   (And yes, I know about multiprocessing.  These threads are already
 in one of several service processes.  I don't want to launch even more
 copies of the Python interpreter.  The threads are usually I/O bound,
 but when they hit unusually long web pages, they go compute-bound
 during parsing.)

   Setting sys.setcheckinterval from the default to 1 seems
 to have little effect.  This is on Windows 7.

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


Re: int object

2012-04-28 Thread Emile van Sebille

On 4/27/2012 11:42 PM Debashish Saha said...

  44 sph_yn_P=(l*sph_yn(l,K*R)/(K*R))-sph_yn(l,K*R)


Here you're clearly multiplying by R...


---  45 Beta_l=l-(K_P*R(sph_jv(l+1,K_P*R))/(sph_jv(l,K_P*R)))


... and here you've got R(...) which is attempting to call R() which 
isn't defined as a functions and is not callable.  Looks like you need 
to fix your formula.


Emile




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


Re: CPython thread starvation

2012-04-28 Thread Chris Angelico
On Sat, Apr 28, 2012 at 11:46 PM, Danyel Lawson danyellaw...@gmail.com wrote:
 The DNS lookup is one of those things that may make sense to run as a
 separate daemon process that listens on a socket.

Yeah, it does. One that listens on port 53, TCP and UDP, perhaps. :)

You've just recommended installing a separate caching resolver.

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


Re: why () is () and [] is [] work in other way?

2012-04-28 Thread Adam Skutt
On Apr 28, 7:26 am, Kiuhnm kiuhnm03.4t.yahoo.it wrote:
 On 4/27/2012 19:15, Adam Skutt wrote:
  On Apr 27, 11:01 am, Kiuhnmkiuhnm03.4t.yahoo.it  wrote:
  The abstraction is this:
  - There are primitives and objects.
  - Primitives are not objects. The converse is also true.
  - Primitives can become objects (boxing).
  - Two primitives x and y are equal iff x == y.
  - Two objects x and y are equal iff x.equals(y).
  - Two objects are the same object iff x == y.
  - If x is a primitive, then y = x is a deep copy.
  - If x is an object, then y = x is a shallow copy.
  - ...

  This is not an abstraction at all, but merely a poor explanation of
  how things work in Java.  Your last statement is totally incorrect, as
  no copying of the object occurs whatsoever.  The reference is merely
  reseated to refer to the new object. If you're going to chide me for
  ignoring the difference between the reference and the referent object,
  then you shouldn't ignore it either, especially in the one case where
  it actually matters!  If we try to extend this to other languages,
  then it breaks down completely.

 With shallow copy I meant exactly that. I didn't think that my using the
 term with a more general meaning would cause such a reaction.

It has a very strict, well-defined meaning in these contexts,
especially in languages such as C++.


 So you're saying that I said that Primitive constructs are references.
 Right...

No, still wrong.  What I said is correct, References are a form of
primitive construct.  In C, an int is a primitive but not a
reference.  An int* is a pointer (reference), and is also
(essentially) a primitive.


   While true, it's still a bad way
  to think about what's going on.  It breaks down once we add C++ /
  Pascal reference types to the mix, for example.

 ?

Assignment to a C++ reference (T) effects the underlying object, not
the reference itself.  A reference can never be reseated once it is
bound to an object.  Comparing equality on two references directly is
the same as comparing two values (it calls operator==).  Comparing
identity requires doing (x == y), like one would do with a value.
However, unlike a value, the object is not destroyed when the
reference goes out of scope.  Most importantly, references to base
classes do not slice derived class objects, so virtual calls work
correctly through references.

As a result, normally the right way to think about a value is as a
temporary name for an object and not worry about any of the details
about how the language makes it work.


  Equality or equivalence is a relation which is:
  - reflexive
  - symmetric
  - transitive
  Everything else... is something else. Call it semi-equality,
  tricky-equality or whatever, but not equality, please.

  Sure, but then it's illegal to allow the usage of '==' with floating
  point numbers, which will never have these properties in any usable
  implementation[1].

 ???


The operator == is called the equality operator.  Floating-point
numbers don't really obey those properties in any meaningful fashion.
The result is that portions of your view contradict others.  Either we
must give '==' a different name, meaning what you consider equality is
irrelevant, or we must use method names like 'equals', which you find
objectionable.

  If anything, you have that backwards.  Look at Python: all variables
  in Python have pointer semantics, not value semantics.

  When everything is white, the word white becomes redundant.
  So the fact that everything in Python have reference semantics means
  that we can't stop thinking about value and reference semantics.

  Nope. The behavior of variables is absolutely essential to writing
  correct programs.  If I write a program in Python that treats
  variables as if they were values, it will be incorrect.

 You misunderstood what I said. You wouldn't treat variables as if they
 were values because you wouldn't even know what that means and that
 that's even a possibility.

Well, one hopes that is true.  I think we have a misunderstanding over
language: you said value and reference semantics when you really
meant value vs. reference semantics.

 I've never heard an old C programmer talk about value semantics and
 reference semantics. When everything is a value, your world is pretty
 simple.

Except if that were true, the comp.lang.c FAQ wouldn't have this
question and answer: http://c-faq.com/ptrs/passbyref.html, and several
others.

Much as you may not like it, most code doesn't care about a pointer's
value, doesn't need to know anything about it, and would just as soon
pretend that it doesn't exist.  All it really wants is a controlled
way to mutate objects in different scopes.  Which is precisely why
references are preferred over pointers in C++, as they're a better
expression of programmer intent, and far safe as a result.

Peaking under the covers in an attempt to simplify the definition of
'==' is silly.  As I've hopefully shown by now, it's pretty much a

Re: CPython thread starvation

2012-04-28 Thread Danyel Lawson
I'm glad I thought of it. ;) But the trick is to use port 5353 and set
a really short timeout on responses in the config for the DNS cache.

On Sat, Apr 28, 2012 at 10:15 AM, Chris Angelico ros...@gmail.com wrote:
 On Sat, Apr 28, 2012 at 11:46 PM, Danyel Lawson danyellaw...@gmail.com 
 wrote:
 The DNS lookup is one of those things that may make sense to run as a
 separate daemon process that listens on a socket.

 Yeah, it does. One that listens on port 53, TCP and UDP, perhaps. :)

 You've just recommended installing a separate caching resolver.

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


Re: CPython thread starvation

2012-04-28 Thread Chris Angelico
On Sun, Apr 29, 2012 at 12:27 AM, Danyel Lawson danyellaw...@gmail.com wrote:
 I'm glad I thought of it. ;) But the trick is to use port 5353 and set
 a really short timeout on responses in the config for the DNS cache.

I don't think false timeouts are any better than true ones, if you
actually know the true ones. But sure, whatever you need.

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


Re: beautiful bitch accepts dwarf

2012-04-28 Thread jimmy970
http://python.6.n6.nabble.com/file/n4936643/op4.jpg 

--
View this message in context: 
http://python.6.n6.nabble.com/AMPUTEE-INCEST-MIDGET-2012-tp4708963p4936643.html
Sent from the Python - python-list mailing list archive at Nabble.com.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python id() does not return an address [was Re: why () is () and [] is [] work in other way?]

2012-04-28 Thread OKB (not okblacke)
Adam Skutt wrote:

 You can't treat id() as an address. Did you miss my post when I
 demonstrated that Jython returns IDs generated on demand, starting
 from 1? In general, there is *no way even in principle* to go from
 a Python ID to the memory location (address) of the object with
 that ID, because in general objects *may not even have a fixed
 address*. Objects in Jython don't, because the Java virtual
 machine can move them in memory. 
 
 Yes, there is a way.  You add a function deref() to the language.

This is getting pretty absurd.  By that logic you could say With 
Python, you can end all life on earth!  You just add a function to 
the language called nuclear_winter() that remotely accesses warhead 
launch sites in the US and Russia, enters the appropriate launch codes, 
and launches the entire nuclear arsenal!

-- 
--OKB (not okblacke)
Brendan Barnwell
Do not follow where the path may lead.  Go, instead, where there is
no path, and leave a trail.
--author unknown
-- 
http://mail.python.org/mailman/listinfo/python-list


confusing doc: mutable and hashable

2012-04-28 Thread laymanzheng
I'm just learning Python. The python doc about mutable and hashable is 
confusing to me. 

In my understanding, there is no directly relation between mutable and hashable 
in Python. Any class with __hash__ function is hashable. 

According the wiki: http://en.wikipedia.org/wiki/Immutable_object

In object-oriented and functional programming, an immutable object is an object 
whose state cannot be modified after it is created.[1] This is in contrast to a 
mutable object, which can be modified after it is created.

We surely can define __hash__ function in user-define class and the instance of 
that class can be changed thus mutable. 

But following statement seems correct in practice but not technically. Any 
comments on this?

Thanks,
Andy


http://docs.python.org/py3k/library/stdtypes.html#set-types-set-frozenset:
  Since it is mutable, it has no hash value and cannot be used as either a 
dictionary key or as an element of another set.

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


Re: confusing doc: mutable and hashable

2012-04-28 Thread mwilson
laymanzh...@gmail.com wrote:

 I'm just learning Python. The python doc about mutable and hashable is
 confusing to me.
 
 In my understanding, there is no directly relation between mutable and
 hashable in Python. Any class with __hash__ function is hashable.
 
 According the wiki: http://en.wikipedia.org/wiki/Immutable_object
 
 In object-oriented and functional programming, an immutable object is an
 object whose state cannot be modified after it is created.[1] This is in
 contrast to a mutable object, which can be modified after it is created.
 
 We surely can define __hash__ function in user-define class and the
 instance of that class can be changed thus mutable.
 
 But following statement seems correct in practice but not technically. Any
 comments on this?

Wikipedia has it right.  Mutable objects are objects where significant 
attributes of the object can change value over the lifetime of the object.  
This is useful for data sharing.  If, for example, one part of your program 
knows an object by the name `a`, and another part knows the same object as 
`b` (or if they can access the object in any other distinct ways), they can 
communicate by changing values of attributes of the shared object. 

In practice, hashable means that the hashable object can be used as a key in 
a dict.  Looking up an item in a dict means that 1) the hash of the lookup 
key has to match the hash of the stored key, and 2) the lookup key has to be 
equal to the stored key according to the `==` operator.  These requirements 
are easy to meet if the keys are immutable.  Otherwise for classes you 
create, you can (if you're careful) create __hash__ and __eq__ methods to 
meet the requirements, even if significant attributes of your instances can 
change their values.

Mel.

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


Re: confusing doc: mutable and hashable

2012-04-28 Thread Chris Rebert
On Sat, Apr 28, 2012 at 11:09 AM,  laymanzh...@gmail.com wrote:
 I'm just learning Python. The python doc about mutable and hashable is 
 confusing to me.

 In my understanding, there is no directly relation between mutable and 
 hashable in Python. Any class with __hash__ function is hashable.

 According the wiki: http://en.wikipedia.org/wiki/Immutable_object

 In object-oriented and functional programming, an immutable object is an 
 object whose state cannot be modified after it is created.[1] This is in 
 contrast to a mutable object, which can be modified after it is created.

 We surely can define __hash__ function in user-define class and the instance 
 of that class can be changed thus mutable.

 But following statement seems correct in practice but not technically. Any 
 comments on this?

Correct. Pedantically, you can define __hash__() on mutable objects;
it's just not very useful or sensible, so people generally don't. As
http://docs.python.org/reference/datamodel.html#object.__hash__ states
[emphasis added]:

If a class defines *mutable* objects and implements a __cmp__() or
__eq__() method, it *should not* implement __hash__(), since hashable
collection implementations require that a object’s hash value is
immutable (if the object’s hash value changes, it will be in the wrong
hash bucket).

 
 http://docs.python.org/py3k/library/stdtypes.html#set-types-set-frozenset:
  Since it is mutable, it has no hash value and cannot be used as either a 
 dictionary key or as an element of another set.
 

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


Re: (3.2) Overload print() using the C API?

2012-04-28 Thread Stefan Behnel
Peter Faulks, 27.04.2012 22:31:
 On 27/04/2012 6:55 PM, Stefan Behnel wrote:
 Peter Faulks, 27.04.2012 10:36:
 On 27/04/2012 5:15 PM, Stefan Behnel wrote:
 Peter Faulks, 26.04.2012 19:57:
 I want to extend an embedded interpreter so that calls to print() are
 automagically sent to a C++ gui (windows exe) via a callback function in
 the DLL.

 Then I'll be able to do this:

 test.py
 import printoverload

 printoverload.set_stdout()
 printoverload.set_stderr()

 print(this will be sent to a C function in printoverload.pyd)
 ---

 Why would you want to divert only print instead of changing
 sys.stdout in
 general? Not all output comes from print calls.

 Because I don't want to have to poll the stdout buffer.

 You don't have to. It's delivered right at your door and even rings the
 bell when it arrives to hand over the parcel in person.


 I want the script
 itself to update a window in the host application (via the extension) every
 time the script calls print().

 Then replace sys.stdout (and maybe also sys.stderr) by another object that
 does what you want whenever its write() method is called.


 But I guess that won't work if the script raises an exception...

 Yep, you better catch those yourself. The C-API function you use for
 executing the Python code in the first place will tell you when there was
 an error.

 BTW, my mention of Cython wasn't just a joke. You might want to look at it
 because it makes these things essentially trivial compared to plain C-API
 code in C.
 
 OK, I _think_ I'm getting warmer... But I wonder, do I need to create new
 sys.stdout / sys.stderr objects? Can I not simply assign a custom C
 function to the write() methods of the existing sys.stdout / sys.stderr
 objects?

You can try it in Python code.

In any case, writing a class that does what you want is likely not more
than a few lines of Cython code, including the interaction with Qt. It's
certainly more involved in C code, but you can still write a part of it in
Python code there and just implement a write() function in C to stick it
into a regular Python class.

Stefan

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


Re: CPython thread starvation

2012-04-28 Thread Paul Rubin
Roy Smith r...@panix.com writes:
 I agree that application-level name cacheing is wrong, but sometimes 
 doing it the wrong way just makes sense.  I could whip up a simple 
 cacheing wrapper around getaddrinfo() in 5 minutes.  Depending on the 
 environment (both technology and bureaucracy), getting a cacheing 
 nameserver installed might take anywhere from 5 minutes to a few days to ...

IMHO this really isn't one of those times.  The in-app wrapper would
only be usable to just that process, and we already know that the OP has
multiple processes running the same app on the same machine.  They would
benefit from being able to share the cache, so now your wrapper gets
more complicated.  If it's not a nameserver then it's something that
fills in for one.  And then, since the application appears to be a large
scale web spider, it probably wants to run on a cluster, and the cache
should be shared across all the machines.  So you really probably want
an industrial strength nameserver with a big persistent cache, and maybe
a smaller local cache because of high locality when crawling specific
sites, etc.

Also, since this is a production application, doing something in 5
minutes is less important than making it solid and configurable.
-- 
http://mail.python.org/mailman/listinfo/python-list


From the crest of Olivet...

2012-04-28 Thread E Bmums

From the crest of Olivet, Jesus looked upon Jerusalem. Fair and 
peaceful was the scene spread out before Him. It was the season of the 
Passover, and from all lands the children of Jacob had gathered there to 
celebrate the great national festival. In the midst of gardens and 
vineyards, and green slopes studded with pilgrims’ tents, rose the 
terraced hills, the stately palaces, and massive bulwarks of Israel’s 
capital. The daughter of Zion seemed in her pride to say, I sit a 
queen, and shall see no sorrow; as lovely then, and deeming herself as 
secure in Heaven’s favor, as when, ages before, the royal minstrel sang, 
Beautiful for situation, the joy of the whole earth, is Mount Zion, 
the city of the great King. Psalm 48:2. In full view were the 
magnificent buildings of the temple. The rays of the setting sun lighted 
up the snowy whiteness of its marble walls, and gleamed from golden gate 
and tower and pinnacle. The perfection of beauty it stood, the pride 
of the Jewish nation. What child of Israel could gaze upon the scene 
without a thrill of joy and admiration! But far other thoughts occupied 
the mind of Jesus. When He was come near, He beheld the city, and wept 
over it. Luke 19:41. Amid the universal rejoicing of the triumphal 
entry, while palm branches waved, while glad hosannas awoke the echoes 
of the hills, and thousands of voices declared Him king, the world’s 
Redeemer was overwhelmed with a sudden and mysterious sorrow. He, the 
Son of God, the Promised One of Israel, whose power had conquered death, 
and called its captives from the grave, was in tears, not of ordinary 
grief, but of intense, irrepressible agony.   

...The Great Controversy Between Christ and Satan


Download the complete book (and Bibles) for free, from the mirrors 
below.


The Great Controversy Between Christ and Satan:

http://i.minus.com/1335372595/0E6HVZrNm7ay0jgHn6IUOA/dbzr787oXlIHFr.pdf
https://rapidshare.com/files/1649741361/The_Great_Controversy.pdf
https://hotfile.com/dl/153737170/594e2f9/The_Great_Controversy.pdf.html
http://www.MegaShare.com/4139813
http://netload.in/dateiynzi7FBtgz/The%20Great%20Controversy.pdf.htm
http://ul.to/25lsg6io
http://www.filefactory.com/file/2uk8o7ertopb/n/The_Great_Controversy_pdf
http://depositfiles.com/files/c7wvwxmlc
http://ifile.it/y6b49zr/The_Great_Controversy.pdf
http://filemonster.net/file/23514/the-great-controversy.pdf.html
http://www.crocko.com/F0F90DF9D43A44529E60EEB4A576E0F6/The_Great_Controv
ersy.pdf
http://www.mediafire.com/?gv4zmzrfrod9z7t
http://www.2shared.com/document/KS-GuN80/The_Great_Controversy.html
http://filevelocity.com/ugq737saizw5/The_Great_Controversy.pdf.html
http://freakshare.com/files/py3p1qtk/The_Great_Controversy.pdf.html
http://www.sendspace.com/file/105rd3
http://www.queenshare.com/66tz8u53sy91
http://www17.zippyshare.com/v/37604967/file.html
http://bayfiles.com/file/8kKT/YDv484/The_Great_Controversy.pdf


Updated King James Version Bible:

http://i.minus.com/1335372623/_-C-jUJbdr3M4lV0JUVdCg/dxqA2tjjwSdKQ.pdf
https://rapidshare.com/files/335715109/Updated_KJV_Bible.pdf
https://hotfile.com/dl/153737253/7ced0dc/Updated_KJV_Bible.pdf.html
http://www.MegaShare.com/4139832
http://netload.in/dateiyR6qK2G4WZ/Updated_KJV_Bible.pdf.htm
http://ul.to/adxm95v1
http://www.filefactory.com/file/tgzxk55g69h/n/Updated_KJV_Bible_pdf
http://depositfiles.com/files/u2rfflkp3
http://ifile.it/ya8dq26/Updated_KJV.pdf
http://filemonster.net/file/23515/updated-kjv.pdf.html
http://www.crocko.com/75C6C5C50B9F4F38A39CFC1207262933/Updated_KJV.pdf
http://www.mediafire.com/?354xtxmotc2s6iv
http://www.2shared.com/document/iw8XU2qR/Updated_KJV.html
http://filevelocity.com/celvp2pcrx5i/Updated_KJV.pdf.html
http://freakshare.com/files/v2g7k9d6/Updated_KJV.pdf.html
http://www.sendspace.com/file/lay7a6
http://www.queenshare.com/7vvv85z8trct
http://www11.zippyshare.com/v/65110611/file.html
http://bayfiles.com/file/8kMx/yuLJqD/Updated_KJV.pdf


NIV Bible:

http://i.minus.com/1335372583/-PZp68TwyHujBc5DFsmLiA/d7ElQRFQHz7ql.pdf
https://rapidshare.com/files/2600857109/NIV_Bible.pdf
https://hotfile.com/dl/153737311/3d73850/NIV_Bible.pdf.html
http://www.MegaShare.com/4139835
http://netload.in/dateiQ2Ew7dYzfx/NIV_Bible.pdf.htm
http://ul.to/58ik4f71
http://www.filefactory.com/file/48o1dxc83bj/n/NIV_Bible_pdf
http://depositfiles.com/files/bf8sz3dfn
http://ifile.it/tup0kg4/NIV.pdf
http://filemonster.net/file/23513/niv.pdf.html
http://www.crocko.com/CC2F7D7D6F124DA8BDA05601F67EFBEE/NIV.pdf
http://www.mediafire.com/?6uh6f2fzexq34lz
http://www.2shared.com/document/XXd3Licj/NIV.html
http://filevelocity.com/3i8kfkjpjiyv/NIV.pdf.html
http://freakshare.com/files/t8wldv5g/NIV.pdf.html
http://www.sendspace.com/file/qdgfvp
http://www.queenshare.com/v0ktceewuhkl
http://www1.zippyshare.com/v/65742413/file.html
http://bayfiles.com/file/8kNN/2zlsl8/NIV.pdf
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: syntax for code blocks

2012-04-28 Thread Ethan Furman

Kiuhnm wrote:
I'd like to change the syntax of my module 'codeblocks' to make it more 
pythonic.


Current Syntax:

with res  func(arg1)  'x, y':
print(x, y)

with res  func(arg1)  block_name  'x, y':
print(x, y)

New Syntax:

with res == func(arg1) .taking_block (x, y):
print(x, y)

with res == func(arg1) .taking_block (x, y) as block_name:
print(x, y)

The full form is equivalent to

def anon_func(x, y):
print(x, y)
res = func(arg1, block_name = anon_func)

Suggestions?


I don't find either the current syntax nor the new syntax pythonic.

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


Re: confusing doc: mutable and hashable

2012-04-28 Thread Kiuhnm

On 4/28/2012 20:09, laymanzh...@gmail.com wrote:

I'm just learning Python. The python doc about mutable and hashable is 
confusing to me.

In my understanding, there is no directly relation between mutable and hashable in 
Python. Any class with __hash__ function is hashable.

According the wiki: http://en.wikipedia.org/wiki/Immutable_object

In object-oriented and functional programming, an immutable object is an object 
whose state cannot be modified after it is created.[1] This is in contrast to a 
mutable object, which can be modified after it is created.

We surely can define __hash__ function in user-define class and the instance of 
that class can be changed thus mutable.

But following statement seems correct in practice but not technically. Any 
comments on this?

Thanks,
Andy


http://docs.python.org/py3k/library/stdtypes.html#set-types-set-frozenset:
   Since it is mutable, it has no hash value and cannot be used as either a 
dictionary key or as an element of another set.



Yes, you're right. Being mutable and hashable are orthogonal properties.
The implication
mutable = non hashable
is just a design choice.

The reason for such a choice is the following. If a key-element pair K:X 
is added to a container C and then K is changed by some external Python 
code without letting C know of this change, C may become inconsistent.
Some containers (e.g. set) assume that K=X and just take X. Modifying X 
is equivalent to modifying K in the example above.

These kinds of problems are avoided if mutable objects can't be keys.
Some containers require that keys be hashable, but since, by design, 
mutable objects can't be keys, there's no reason for them to be hashable 
either.


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


Learn Technical Writing from Unix Man in 10 Days

2012-04-28 Thread Xah Lee
Learn Technical Writing from Unix Man in 10 Days

Quote from man apt-get:

remove
remove is identical to install except that packages are
removed
instead of installed.

Translation:

kicking
kicking is identical to kissing except that receiver is kicked
instead of kissed.

further readings:

• 〈The Idiocy of Computer Language Docs〉
http://xahlee.org/comp/idiocy_of_comp_lang.html

• 〈Why Open Source Documentation is of Low Quality〉
http://xahlee.org/UnixResource_dir/writ/gubni_papri.html

• 〈Python Documentation Problems〉
http://xahlee.org/perl-python/python_doc_index.html



DISAPPEARING URL IN DOC

so, i was reading man git. Quote:

Formatted and hyperlinked version of the latest git documentation
can
be viewed at http://www.kernel.org/pub/software/scm/git/docs/.

but if you go to that url, it shows a list of over one hundred fourty
empty dirs.

I guess unix/linux idiots can't be bothered to have correct
documentation. Inability to write is one thing, but they are unable to
maintain a link or update doc?

does this ever happens to Apple's docs? If it did, i don't ever recall
seeing it from 18 years of using Mac.

more records of careless dead link:

• 〈Hackers: Dead Links and Human Compassion?〉
http://xahlee.org/comp/hacker_dead_links_and_compassion.html

• 〈Why Qi Lisp Fails and Clojure Succeeds〉
http://xahlee.org/UnixResource_dir/writ/qi_lang_marketing.html

• 〈unix: Hunspell Path Pain〉
http://xahlee.org/comp/hunspell_spell_path_pain.html

• 〈Python Doc URL disappearance〉
http://xahlee.org/perl-python/python_doc_url_disappearance.html

• 〈A Record of Frustration in IT Industry; Disappearing FSF URLs〉
http://xahlee.org/emacs/gnu_doc.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: confusing doc: mutable and hashable

2012-04-28 Thread Temia Eszteri
Yes, you're right. Being mutable and hashable are orthogonal properties.
The implication
 mutable = non hashable
is just a design choice.

The reason for such a choice is the following. If a key-element pair K:X 
is added to a container C and then K is changed by some external Python 
code without letting C know of this change, C may become inconsistent.
Some containers (e.g. set) assume that K=X and just take X. Modifying X 
is equivalent to modifying K in the example above.
These kinds of problems are avoided if mutable objects can't be keys.
Some containers require that keys be hashable, but since, by design, 
mutable objects can't be keys, there's no reason for them to be hashable 
either.

Kiuhnm

Well, if worst comes to worst and you wind up in a programming
situation where you needed to make a mutable object as a hash entry,
it's still possible to subclass the object type and have __hash__()
return the object's ID instead, right?

I can only think of a few edge cases where that could even possibly be
required though, such as membership testing for something and having a
callback associated with each set of members...

~Temia
--
When on earth, do as the earthlings do.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Learn Technical Writing from Unix Man in 10 Days

2012-04-28 Thread Temia Eszteri
And what does this have to do with a multiplatform language like
Python? :P

~Temia
--
When on earth, do as the earthlings do.
-- 
http://mail.python.org/mailman/listinfo/python-list


Getting started with PyGTK [Receiving Error]

2012-04-28 Thread Santosh Kumar
System Information

Ubuntu 11.10
Python 2.7.2

Problem


I think my Ubuntu has PyGTK and GTK both already installed. But
however when I am importing gtk in Python interactive mode then I am
getting the following warning:

(.:4126): Gtk-WARNING **: Unable to locate theme engine in
module_path: pixmap,

(.:4126): Gtk-WARNING **: Unable to locate theme engine in
module_path: pixmap,

(.:4126): Gtk-WARNING **: Unable to locate theme engine in
module_path: pixmap,

(.:4126): Gtk-WARNING **: Unable to locate theme engine in
module_path: pixmap,

On the other side, importing PyGTK works well (i.e. I don't receive
any error). What might be error?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Learn Technical Writing from Unix Man in 10 Days

2012-04-28 Thread Chris Angelico
On Sun, Apr 29, 2012 at 8:36 AM, Temia Eszteri lamial...@cleverpun.com wrote:
 And what does this have to do with a multiplatform language like
 Python? :P

Nothing. Xah Lee is a professional troll. You can save yourself some
trouble by ignoring his posts altogether.

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


Re: confusing doc: mutable and hashable

2012-04-28 Thread MRAB

On 28/04/2012 23:30, Temia Eszteri wrote:

Yes, you're right. Being mutable and hashable are orthogonal properties.
The implication
 mutable =  non hashable
is just a design choice.

The reason for such a choice is the following. If a key-element pair K:X
is added to a container C and then K is changed by some external Python
code without letting C know of this change, C may become inconsistent.
Some containers (e.g. set) assume that K=X and just take X. Modifying X
is equivalent to modifying K in the example above.
These kinds of problems are avoided if mutable objects can't be keys.
Some containers require that keys be hashable, but since, by design,
mutable objects can't be keys, there's no reason for them to be hashable
either.

Kiuhnm


Well, if worst comes to worst and you wind up in a programming
situation where you needed to make a mutable object as a hash entry,
it's still possible to subclass the object type and have __hash__()
return the object's ID instead, right?

I can only think of a few edge cases where that could even possibly be
required though, such as membership testing for something and having a
callback associated with each set of members...


If objects x and y of the same class are mutable and you want them to
have the same hash if x == y then having __hash__() return the object's
ID is not what you want.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Learn Technical Writing from Unix Man in 10 Days

2012-04-28 Thread Temia Eszteri
On Sun, Apr 29, 2012 at 8:36 AM, Temia Eszteri lamial...@cleverpun.com wrote:
 And what does this have to do with a multiplatform language like
 Python? :P

Nothing. Xah Lee is a professional troll. You can save yourself some
trouble by ignoring his posts altogether.

ChrisA

Professional? He's boring! I wanted to see if I could poke him into
action. I know, I know, don't feed the trolls. Just wanted to see if
he would actually come up with something interesting.

~Temia
--
When on earth, do as the earthlings do.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Learn Technical Writing from Unix Man in 10 Days

2012-04-28 Thread Andrew Berg
On 4/28/2012 6:45 PM, Temia Eszteri wrote:
 Professional? He's boring!
I agree. Ranting Rick is much more entertaining (usually).

-- 
CPython 3.2.3/3.3.0a2 | Windows NT 6.1.7601.17790
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Getting started with PyGTK [Receiving Error]

2012-04-28 Thread Vincent Vande Vyvre
Le 29/04/12 00:52, Santosh Kumar a écrit :
 System Information
 
 Ubuntu 11.10
 Python 2.7.2

 Problem
 

 I think my Ubuntu has PyGTK and GTK both already installed. But
 however when I am importing gtk in Python interactive mode then I am
 getting the following warning:

 (.:4126): Gtk-WARNING **: Unable to locate theme engine in
 module_path: pixmap,

 (.:4126): Gtk-WARNING **: Unable to locate theme engine in
 module_path: pixmap,

 (.:4126): Gtk-WARNING **: Unable to locate theme engine in
 module_path: pixmap,

 (.:4126): Gtk-WARNING **: Unable to locate theme engine in
 module_path: pixmap,

 On the other side, importing PyGTK works well (i.e. I don't receive
 any error). What might be error?
It's a behaviour of GTK, not an error in your code.

I use PyQt and I've always theses warnings under KDE and Unity, never
under Gnome.

I thing you can ignore it.

-- 
Vincent V.V.
Oqapy https://launchpad.net/oqapy . Qarte+7
https://launchpad.net/qarte+7 . PaQager https://launchpad.net/paqager

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


Communication between C++ server and Python app

2012-04-28 Thread kenk
Hi,

I've got a server process written in C++ running on Unix machine.
On the same box I'd like to run multiple Python scripts that will
communicate with this server.

Can you please suggest what would be best was to achieve this ?

Kind regards and thanks in advance!
M.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Communication between C++ server and Python app

2012-04-28 Thread Chris Angelico
On Sun, Apr 29, 2012 at 10:45 AM, kenk marcin.maksym...@googlemail.com wrote:
 Hi,

 I've got a server process written in C++ running on Unix machine.
 On the same box I'd like to run multiple Python scripts that will
 communicate with this server.

 Can you please suggest what would be best was to achieve this ?

Personally, I would recommend a TCP socket, because that allows the
flexibility of splitting across multiple computers. But for
efficiency, you may want to consider a Unix socket too.

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


Re: Communication between C++ server and Python app

2012-04-28 Thread Roy Smith
In article 
108cb846-6bb9-4600-a984-2fded0c91...@er9g2000vbb.googlegroups.com,
 kenk marcin.maksym...@googlemail.com wrote:

 Hi,
 
 I've got a server process written in C++ running on Unix machine.
 On the same box I'd like to run multiple Python scripts that will
 communicate with this server.
 
 Can you please suggest what would be best was to achieve this ?

There are so many reasonable answers, it's hard to know where to start.  
Perhaps if you could give us some clue as to what the server does, it 
might help.

What kind of data are you passing back and forth?  Text?  Binary?  Is it 
important that the communication be as efficient as possible, or is it 
more important that the code be easy to write?  Are you worried about 
security?  Will you ever need to interoperate with other systems written 
in other languages?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: confusing doc: mutable and hashable

2012-04-28 Thread Terry Reedy

On 4/28/2012 2:09 PM, laymanzh...@gmail.com wrote:


In my understanding, there is no directly relation between mutable
and hashable in Python. Any class with __hash__ function is
hashable.

According the wiki: http://en.wikipedia.org/wiki/Immutable_object

In object-oriented and functional programming, an immutable object is
an object whose state cannot be modified after it is created.[1] This
is in contrast to a mutable object, which can be modified after it is
created.

We surely can define __hash__ function in user-define class and the
instance of that class can be changed thus mutable.


The default hash is based on the immutable value of an object. If you 
base a custom hash on values that do change, it is not useful as a dict key.


--
Terry Jan Reedy

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


Re: Learn Technical Writing from Unix Man in 10 Days

2012-04-28 Thread Steven D'Aprano
On Sat, 28 Apr 2012 14:55:42 -0700, Xah Lee wrote:

 Learn Technical Writing from Unix Man in 10 Days
 
 Quote from man apt-get:
 
 remove
 remove is identical to install except that packages are
 removed
 instead of installed.


Do you also expect the documentation to define except, instead, is, 
to and the?

If you don't know what install and remove means, then you need an 
English dictionary, not a technical manual.



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


Re: Communication between C++ server and Python app

2012-04-28 Thread Rodrick Brown
What interfaces are available on the server process? 

Sent from my iPad

On Apr 28, 2012, at 8:45 PM, kenk marcin.maksym...@googlemail.com wrote:

 Hi,
 
 I've got a server process written in C++ running on Unix machine.
 On the same box I'd like to run multiple Python scripts that will
 communicate with this server.
 
 Can you please suggest what would be best was to achieve this ?
 
 Kind regards and thanks in advance!
 M.
 -- 
 http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue14387] Include\accu.h incompatible with Windows.h

2012-04-28 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

I think the issue is fixed in all affected branches. Georg, can we close it?

--
resolution:  - fixed
stage:  - committed/rejected
status: open - pending

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



[issue14387] Include\accu.h incompatible with Windows.h

2012-04-28 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

I think so, yes.

--
status: pending - closed

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



[issue14448] Mention pytz in datetime's docs

2012-04-28 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 1e5a483248ce by Sandro Tosi in branch '2.7':
Issue #14448: add reference to IANA timezone database; thanks to Georg/Nick 
suggestions
http://hg.python.org/cpython/rev/1e5a483248ce

New changeset a5a0d47e6e78 by Sandro Tosi in branch '3.2':
Issue #14448: add reference to IANA timezone database; thanks to Georg/Nick 
suggestions
http://hg.python.org/cpython/rev/a5a0d47e6e78

New changeset c91ed8dacf38 by Sandro Tosi in branch 'default':
Issue #14448: merge with 3.2
http://hg.python.org/cpython/rev/c91ed8dacf38

--

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



[issue14688] Typos in sorting.rst

2012-04-28 Thread Dionysios Kalofonos

New submission from Dionysios Kalofonos peite...@gmail.com:

Please see the file attached.

--
assignee: docs@python
components: Documentation
files: sorting.diff
keywords: patch
messages: 159513
nosy: dk, docs@python
priority: normal
severity: normal
status: open
title: Typos in sorting.rst
versions: Python 3.3
Added file: http://bugs.python.org/file25389/sorting.diff

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



[issue14689] make PYTHONWARNINGS variable work in libpython

2012-04-28 Thread Peter Eisentraut

New submission from Peter Eisentraut pete...@gmx.net:

The environment variable PYTHONWARNINGS only works with the python interpreter 
binary, but not with programs embedding libpython.  This could be changed by 
moving the code from Modules/main.c to Python/pythonrun.c.  See attached patch 
(compiles cleanly, tests pass, not tested on Windows).

(I have checked all the other environment variables listed on the python man 
page for whether those that could be usable in the library are actually 
processed in the library, and all but PYTHONWARNINGS appear to behave 
reasonably.)

--
components: Interpreter Core
files: py-pythonwarnings-envvar.patch
keywords: patch
messages: 159514
nosy: petere
priority: normal
severity: normal
status: open
title: make PYTHONWARNINGS variable work in libpython
type: enhancement
versions: Python 3.3
Added file: http://bugs.python.org/file25390/py-pythonwarnings-envvar.patch

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



[issue14642] Fix importlib.h build rule to not depend on hg

2012-04-28 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

As I don't fully understand what the original issue was, I can't know for sure 
whether it's fixed now. But yes, there is now a mechanism to bring the time 
stamps in the right order.

--
resolution:  - fixed
status: open - closed

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



[issue14676] DeprecationWarning missing in default warning filters documentation

2012-04-28 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 0ad724738f6a by Sandro Tosi in branch '2.7':
Issue #14676: DeprecationWarning is ignored too; patch by Peter Eisentraut
http://hg.python.org/cpython/rev/0ad724738f6a

--
nosy: +python-dev

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



[issue14676] DeprecationWarning missing in default warning filters documentation

2012-04-28 Thread Sandro Tosi

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

Peter: thanks for the patch!

--
nosy: +sandro.tosi
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

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



[issue14626] os module: use keyword-only arguments for dir_fd and nofollow to reduce function count

2012-04-28 Thread Larry Hastings

Larry Hastings la...@hastings.org added the comment:

Here my first stab at a comprehensive proposal.  Each section represents a 
specific new function argument, and a list of functions that the argument be 
added to.

All new arguments are keyword-only and optional.

All functions mentioned are in the os module.
___

This annotation:
foo [X bar]
means if we add this argument to function foo, we can remove function bar.  
This is because bar is a new function only in trunk and has no installed base.

This annotation:
foo [- bar]
means if we add this argument to function foo, we could theoretically start 
deprecating function bar.  bar shipped in a previous version of Python and we 
can't simply remove it.

However!  I am *not* proposing doing *any* of these deprecations--I suspect the 
right thing to do is to leave all the existing functions in.

___
follow_symlinks=bool (default True)

Allow functions to either follow symlinks (the default) or examine symlinks.

access  [X faccessat]
chflags [- lchflags]
chmod   [- lchmod]
chown   [- lchown]
getxattr[X lgetxattr]
link[X linkat]
listxattr   [X llistxattr]
removexattr [X lremovexattr]
setxattr[X lsetxattr]
stat[- lstat]
utime   [X lutimes]
___
effective_ids=bool (default False)

For functions that take the AT_EACCESS flag or otherwise operate on effective 
uid/gid.

access  [X faccessat]
(this also lets us skip ever adding euidaccess!)
___
dir_fd=int (default None)

For functions that take a dir_fd parameter instead of / in addition to a 
path parameter.

access  [X faccessat]
chmod   [X fchmodat]
chown   [X fchownat]
getxattr[X fgetxattr]
link[X linkat] (note! need two parameters here.)
mkdir   [X mkdirat]
mkfifo  [X mkfifoat]
mknod   [X mknodat]
open[X openat]
readlink[X readlinkat]
rename  [X renameat]
stat[X fstatat]
symlink [X symlinkat]
unlink  [X unlinkat]
utime   [X futimesat utimensat]
___
fd=int (default None)

For functions that take a path parameter and have an f-equivalent that take 
an fd instead.  The path parameter and fd parameters would be exclusive; 
you must specify exactly one, never both.  Both parameters would accept None 
as equivalent to being unspecified.  For the functions that only take one 
parameter (chdir, listdir, stat, statvfs) I propose we give that parameter a 
default of None.

chdir   [- fchmod]
chown   [- fchown]
execve  [X fexecve]
getxattr[X fgetxattr]
listdir [X flistdir]
listxattr   [X flistxattr]
removexattr [X fremovexattr]
setxattr[X fsetxattr]
stat[- fstat]
statvfs [- fstatvfs]
utime   [X futimes futimens]

___
remove_dir=bool (default False)

Allows unlink to behave like rmdir.

unlink  [X unlinkat] [- rmdir]
___


One question:

If we do as I propose, and dir_fd is always a parameter to a pre-existing 
function, can we drop support for AT_FDCWD?  It seems to me that
funlink(../foo, dir_fd=AT_FDCWD)
is equivalent to
unlink(../foo)
but I fear I'm missing something important.

--

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



[issue14369] make __closure__ writable

2012-04-28 Thread Andrew Svetlov

Andrew Svetlov andrew.svet...@gmail.com added the comment:

sbt, looks good for me.

--

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



[issue13916] disallow the surrogatepass handler for non utf-* encodings

2012-04-28 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

I fail to see the problem. If the error handler does not produce meaningful 
results in some context, then just don't use it.

The whole point of error handlers is that they handle errors; using them 
shouldn't ever cause errors/exceptions.

--
nosy: +loewis

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



[issue14689] make PYTHONWARNINGS variable work in libpython

2012-04-28 Thread Antoine Pitrou

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


--
nosy: +brett.cannon
stage:  - patch review

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



[issue14675] make distutils.ccompiler.CCompiler an abstract class

2012-04-28 Thread Ramchandra Apte

Ramchandra Apte maniandra...@gmail.com added the comment:

Well, there is no practical advantage at all.

--

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



[issue14675] make distutils.ccompiler.CCompiler an abstract class

2012-04-28 Thread Ramchandra Apte

Ramchandra Apte maniandra...@gmail.com added the comment:

Please change the priorty of this bug to low.

--

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



[issue14417] dict RuntimeError workaround

2012-04-28 Thread Guido van Rossum

Guido van Rossum gu...@python.org added the comment:

Still no progress on this bug. Should I just check in my simple patch? But 
there's much more to do -- docs, and unittests. Volunteers? It's not hard, just 
work.

--

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



[issue14417] dict RuntimeError workaround

2012-04-28 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 Still no progress on this bug. Should I just check in my simple patch?
 But there's much more to do -- docs, and unittests. Volunteers? It's
 not hard, just work.

Well, in general the person writing the patch should also write the
tests ;-)
I have this bug in my bookmarks somewhere, so I might come to it and
write a patch if nobody does it before, though.

--

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



[issue13916] disallow the surrogatepass handler for non utf-* encodings

2012-04-28 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

The problem is that surrogatepass specific to utf-8 and there is no standard 
way to decode alone surrogates in utf-16.

 \udc80\udc80.encode(utf-16, surrogatepass).decode(utf-16, 
 surrogatepass)
Traceback (most recent call last):
  File stdin, line 1, in module
UnicodeDecodeError: 'utf16' codec can't decode bytes in position 2-3: illegal 
encoding

With utf-32 this works only thanks to the bug -- utf-32 allows alone 
surrogates (issue #12892).

If the surrogatepass worked with utf-16 and utf-32, it would be natural to 
throw ValueError for other encodings.

--

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



[issue14626] os module: use keyword-only arguments for dir_fd and nofollow to reduce function count

2012-04-28 Thread Antoine Pitrou

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


--
nosy: +neologix

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



[issue14666] test_sendall_interrupted hangs on FreeBSD with a zombi multiprocessing thread

2012-04-28 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

This should have fixed it. If now, someone reopen the issue :)

--
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed

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



[issue14689] make PYTHONWARNINGS variable work in libpython

2012-04-28 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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



[issue14675] make distutils.ccompiler.CCompiler an abstract class

2012-04-28 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Well, if there is no reason for this change, it should be closed.

--

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



[issue13916] disallow the surrogatepass handler for non utf-* encodings

2012-04-28 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

I see. The proper reaction for a codec that can't handle a certain error then 
is to raise the original exception. I'm -1 on raising LookupError when trying 
to find the error handler - this would suggest that the error handler does not 
exist, which is not true.

As for simplifying the implementation: it might be reasonable to special-case 
surrogatepass inside the individual codecs, rather than looking up the error 
handler. Then the error handler could just be identical to strict, except 
that UTF-8, UTF-16, and UTF-32 individually special-case this error handler in 
their encoders and decoders.

--

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



[issue14687] Optimize str%tuple for the PEP 393

2012-04-28 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

I see sped up +10% on Intel Atom (but 3.2 still 2x fast).

With non-ascii arguments speed up can be a little bit larger.

--
nosy: +storchaka

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



[issue14304] Implement utf-8-bmp codec

2012-04-28 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

The patch is incorrect, i.e. it deviates from what the command line interface 
does. When you try to write to sys.stdout, and the characters are not supported 
you get UnicodeError. Only when it is interactive mode, and tries to represent 
some result, ascii escaping happens.

--

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



[issue14304] Implement utf-8-bmp codec

2012-04-28 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

I don't see what the patch worse than the current behavior.

Unpatched:
 ''.join(map(chr, [76, 246, 119, 105, 115]))
'Löwis'
 ''.join(map(chr, [76, 246, 119, 105, 115, 65536]))
'L\xf6wis\U0001'

Patched:
 ''.join(map(chr, [76, 246, 119, 105, 115]))
'Löwis'
 ''.join(map(chr, [76, 246, 119, 105, 115, 65536]))
'Löwis\U0001'

In the case of the Cyrillic alphabet all text becomes unreadable, if there are 
some non-bmp characters in it.

--

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



[issue9239] zipfile: truncating comment can corrupt the zipfile

2012-04-28 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

The bug is no longer there. Probably it is fixed in issue14399.

--
nosy: +storchaka

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



[issue1760357] ZipFile.write fails with bad modification time

2012-04-28 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

An alternative is to use the current time, as for stdin.

--
nosy: +storchaka

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



[issue14427] urllib.request.Request get_header and header_items not documented

2012-04-28 Thread Michal Nowikowski

Michal Nowikowski godf...@gmail.com added the comment:

Attached a patch that adds description of get_header and header_items methods 
in Doc/library/urllib.request.rst.

--
keywords: +patch
nosy: +godfryd
Added file: http://bugs.python.org/file25391/doc-urlib-request.patch

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



[issue13050] RLock support the context manager protocol but this is not documented

2012-04-28 Thread Michal Nowikowski

Michal Nowikowski godf...@gmail.com added the comment:

It looks that it is already documented by 76228:2040842626ba changeset.
The bug can be closed.

--
nosy: +godfryd

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



[issue14688] Typos in sorting.rst

2012-04-28 Thread Michal Nowikowski

Michal Nowikowski godf...@gmail.com added the comment:

The changes looks ok.

--
nosy: +godfryd

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



[issue14666] test_sendall_interrupted hangs on FreeBSD with a zombi multiprocessing thread

2012-04-28 Thread STINNER Victor

STINNER Victor victor.stin...@gmail.com added the comment:

 This should have fixed it. If now, someone reopen the issue :)

Thanks!

--

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



[issue14304] Implement utf-8-bmp codec

2012-04-28 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

 In the case of the Cyrillic alphabet all text becomes unreadable, if  
 there are some non-bmp characters in it.

And indeed, that's the correct, desired behavior, as it models what the
interactive shell does.

If you want to change this, you need to also change the interactive console,
which is an issue independent of this one.

--

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



[issue14570] Document json sort_keys parameter properly

2012-04-28 Thread Michal Nowikowski

Michal Nowikowski godf...@gmail.com added the comment:

In json module there are dump/dumps methods which internally instantiate 
encoder class JSONEncoder (or some other user-defined encoder clas).
They look as follows:

json.dump(obj, fp, 
  skipkeys=False,
  ensure_ascii=True,
  check_circular=True, 
  allow_nan=True,
  cls=None,
  indent=None,
  separators=None,
  default=None, 
  **kw)

json.JSONEncoder(skipkeys=False, 
 ensure_ascii=True,
 check_circular=True,
 allow_nan=True,
 sort_keys=False,
 indent=None,
 separators=None,
 default=None)

Some of dump/dumps arguments are passed to encoder class:
- skipkeys
- ensure_ascii
- check_circular
- allow_nan
- indent
- separators
- default

And it looks that sort_keys is just missing in keyword args in dump/dumps 
method.
But it still can be passed implicitly using **kw arg.

I would propose to do:
- add explicitly sort_keys keyword arg to dump/dumps methods
- add passing it to encoder class
- and adjust documentation accordingly.

--
nosy: +godfryd

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



[issue9260] A finer grained import lock

2012-04-28 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Ok, here is a draft patch for the new importlib.
Several issues with this patch:
- introduces a pure Python function (_lock_unlock_module) on the fast import 
path
- synchronization issues due to interruptibility of pure Python code (see 
_ModuleLock.acquire)
- afterfork fix-up necessary
- relies on _thread.RLock for bootstrapping reasons
- module locks are immortal

--
Added file: http://bugs.python.org/file25392/module_locks.patch

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



[issue14304] Implement utf-8-bmp codec

2012-04-28 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

I take that back; the interactive shell uses the backslashescape error handler.

Still, I don't think IDLE should setup a displayhook in the first place. What 
if an application replaces the displayhook?

--

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



[issue14688] Typos in sorting.rst

2012-04-28 Thread Raymond Hettinger

Raymond Hettinger raymond.hettin...@gmail.com added the comment:

The first and last change looks fine.

--
assignee: docs@python - rhettinger
nosy: +rhettinger

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



[issue14304] Implement utf-8-bmp codec

2012-04-28 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

 Still, I don't think IDLE should setup a displayhook in the first place. What 
 if an application replaces the displayhook?

IDLE *is* the application.

If another application that uses the idlelib, replace displayhook, it
must itself to worry about the correct encoding and escaping.

--

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



[issue1739648] zipfile.testzip() using progressive file reads

2012-04-28 Thread Serhiy Storchaka

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


--
nosy: +storchaka

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



[issue14304] Implement utf-8-bmp codec

2012-04-28 Thread Andrew Svetlov

Andrew Svetlov andrew.svet...@gmail.com added the comment:

Serhiy, I like to fix tkinter itself, not only IDLE.
There are other problems like idle is crashing if non-bmp char will be pasted 
from clipboard.
Moreover, non-bmp behavior is different from one Tk widget to other.
I still want to make codec for it and then try to solve tk problems.
Maybe solution will force to extend tkinter interface for process codec errors 
with reasonable well specified default behavior.
Sorry for my silence. I hope to make some progress next weeks.

--

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



[issue14304] Implement utf-8-bmp codec

2012-04-28 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

 IDLE *is* the application.

No, IDLE is the development environment. The application is
whatever is being developed with IDLE.

--

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



[issue14304] Implement utf-8-bmp codec

2012-04-28 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

I don't understand how the utf-8-bmp codec will help to fix the tkinter. To fix 
the tkinter, you need to fix the Tcl/Tk, but it is outside of Python. While Tcl 
does not support non-bmp characters, correct and non-ambiguous working with 
non-bmp characters is not possible. You should choose the method of encoding of 
non-bmp characters and these methods will be different for different 
applications.

--

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



[issue14304] Implement utf-8-bmp codec

2012-04-28 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

 No, IDLE is the development environment. The application is
 whatever is being developed with IDLE.

If the application replaces the displayhook, than it is the development
environment too.

--

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



[issue13241] llvm-gcc-4.2 miscompiles Python (XCode 4.1 on Mac OS 10.7)

2012-04-28 Thread Hynek Schlawack

Changes by Hynek Schlawack h...@ox.cx:


--
nosy: +hynek

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



[issue14428] Implementation of the PEP 418

2012-04-28 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


Added file: http://bugs.python.org/file25393/4ba64ca9abcf.diff

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



[issue9260] A finer grained import lock

2012-04-28 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

New patch gets rid of the reliance on _thread.RLock (uses non-recursive locks 
instead), and should solve the synchronization issue. Other issues remain.

--
Added file: http://bugs.python.org/file25394/module_locks2.patch

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



[issue7707] multiprocess.Queue operations during import can lead to deadlocks

2012-04-28 Thread Hynek Schlawack

Hynek Schlawack h...@ox.cx added the comment:

The proposed patch has been committed as c4dcbe51c2e3 – any reasons why this 
issues is still open?

--
nosy: +hynek

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



[issue7707] multiprocess.Queue operations during import can lead to deadlocks

2012-04-28 Thread Antoine Pitrou

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


--
components: +Documentation -Library (Lib)
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue14428] Implementation of the PEP 418

2012-04-28 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


Removed file: http://bugs.python.org/file25393/4ba64ca9abcf.diff

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



[issue14428] Implementation of the PEP 418

2012-04-28 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


Added file: http://bugs.python.org/file25395/9a93348e98e7.diff

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



[issue14427] urllib.request.Request get_header and header_items not documented

2012-04-28 Thread Senthil Kumaran

Changes by Senthil Kumaran sent...@uthcode.com:


--
assignee: docs@python - orsenthil
nosy: +orsenthil

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



[issue14428] Implementation of the PEP 418

2012-04-28 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


Removed file: http://bugs.python.org/file25395/9a93348e98e7.diff

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



[issue14428] Implementation of the PEP 418

2012-04-28 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


Removed file: http://bugs.python.org/file25254/384190bb0bd5.diff

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



[issue14428] Implementation of the PEP 418

2012-04-28 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


Added file: http://bugs.python.org/file25396/667541bb315c.diff

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



[issue14428] Implementation of the PEP 418

2012-04-28 Thread STINNER Victor

STINNER Victor victor.stin...@gmail.com added the comment:

667541bb315c.diff: Updated patch, last change: is_adjusted key of 
time.get_clock_info() is now mandatory.

--

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



[issue1739648] zipfile.testzip() using progressive file reads

2012-04-28 Thread Alan McIntyre

Alan McIntyre alan.mcint...@gmail.com added the comment:

I'd be glad to do some code reviews or something in exchange for the time of 
somebody with commit rights. :-)  If anybody is interested in getting this 
change committed, please let me know and I'll check that the patch is still 
valid.  Thanks!

--
status: open - languishing

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



[issue14428] Implementation of the PEP 418

2012-04-28 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


Added file: http://bugs.python.org/file25397/4255e3c4daf2.diff

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



[issue14428] Implementation of the PEP 418

2012-04-28 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 76d2e0761d18 by Victor Stinner in branch 'default':
Issue #14428, #14397: Implement the PEP 418
http://hg.python.org/cpython/rev/76d2e0761d18

--
nosy: +python-dev

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



[issue14397] Use GetTickCount/GetTickCount64 instead of QueryPerformanceCounter for monotonic clock

2012-04-28 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 76d2e0761d18 by Victor Stinner in branch 'default':
Issue #14428, #14397: Implement the PEP 418
http://hg.python.org/cpython/rev/76d2e0761d18

--
nosy: +python-dev

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



[issue14428] Implementation of the PEP 418

2012-04-28 Thread STINNER Victor

STINNER Victor victor.stin...@gmail.com added the comment:

Guido van Rossum accepted the PEP, let's commit the implementation.

--
resolution:  - fixed
status: open - closed

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



  1   2   >