Re: How keep Python 3 moving forward

2014-05-25 Thread wxjmfauth
Le dimanche 25 mai 2014 02:27:11 UTC+2, Terry Reedy a écrit :
 On 5/24/2014 3:49 PM, Marko Rauhamaa wrote:
 
 
 
  Few people have Python 3 as an objective. What I'm saying is that if
 
  Python 3 had something everybody wants and nothing else provides, the
 
  people will come, even the legacy libraries will be ported then.
 
 
 
 I cannot think of anything beyond the core that 'everybody' wants. 
 
 However, Python 3.3 has unicode that works for all characters on all 
 
 platforms, and some people want that.
 
 



Python and unicode: a buggy hobbyist toy.
Voilà. Nothing either good or bad.

jmf

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


WSGI (was: Re: Python CGI)

2014-05-25 Thread Christian
On 05/20/2014 03:52 AM, Tim Chase wrote:
 While Burak addressed your (Fast-)CGI issues, once you have a
 test-script successfully giving you output, you can use the
 standard-library's getpass.getuser() function to tell who your script
 is running as.

LoadModule wsgi_module modules/mod_wsgi.so
AddHandler wsgi-script .wsgi
WSGIDaemonProcess myproj user=chris threads=3

[root@t-centos1 ~]# ps -ef|grep chris
chris 1201  1199  0 08:47 ?00:00:00 /usr/sbin/httpd

---8---
#!/usr/bin/python
import getpass
def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
output += getpass.getuser()
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)

return [output]
---8---

Hello World!root

Hmm, why is it root?

I'm using Apache and mod_userdir. Can I define WSGIDaemonProcess for
each user?

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


Re: Make Python Compilable, convert to Python source to Go

2014-05-25 Thread wxjmfauth
My opinions about Go.

i) go build XXX that creates an exe, one can put on
a usb stick and run (distribute) it, is a feature hard
to beat.

I do not know, if it will be rendered correctly.

D:\jm\jmgohello3.exe
ASCII abcde xyz
Germanäöü ÄÖÜ ß
Polishąęźżńł
Russian   абвгдеж эюя
CJK   你好
Frenchœÿéà
Misc  ሴé€㑖Ѓ⌴*

D:\jm\jmgo

ii) From a unicode perspective, excellent, coherent and
very well constructed, but...

iii) Having to work with an utf-8 arithmetic
(strings - runes conversion), no thanks.

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


WSGI (was: Re: Python CGI)

2014-05-25 Thread Chris
On 05/20/2014 03:52 AM, Tim Chase wrote:
 While Burak addressed your (Fast-)CGI issues, once you have a
 test-script successfully giving you output, you can use the
 standard-library's getpass.getuser() function to tell who your script
 is running as.

LoadModule wsgi_module modules/mod_wsgi.so
AddHandler wsgi-script .wsgi
WSGIDaemonProcess myproj user=chris threads=3

[root@t-centos1 ~]# ps -ef|grep chris
chris 1201  1199  0 08:47 ?00:00:00 /usr/sbin/httpd

---8---
#!/usr/bin/python
import getpass
def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
output += getpass.getuser()
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)

return [output]
---8---

Hello World!root

Hmm, why is it root?

I'm using Apache and mod_userdir. Can I define WSGIDaemonProcess for
each user?

- Chris

-- 
Gruß,
Christian
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Make Python Compilable, convert to Python source to Go

2014-05-25 Thread bookaa bookaa
On Sunday, May 25, 2014 12:47:27 PM UTC+8, Chris Angelico wrote:
 On Sun, May 25, 2014 at 1:06 PM, bookaa wrote:
 
  This tool can be called 'Python to GoLang', which translate Python source 
  to Golang source. And then you can compile the Go files to executable 
  binary. (btw: Go is a new C-like compilable language, open source).
 
 
 Sounds like you're writing a Python implementation that uses a Go
 backend. As Pythons go, this is comparable to using Java, or Mono, or
 RPython, or C, or anything else. So there are two questions:
 
 1) How compatible is your Python-to-Golang converter with all the
 nuances of Python code? Does it work perfectly on any arbitrary Python
 script? And, what version of Python is it aimed at?

I try to support all Python syntax, any arbitray script. From the example
 attached,you can see I translate all import system libraries needed and 
produce up to 17 lines of Go. Up to now, only support Python 2.7.6. 
Maybe I will work on Python 3 later.

 2) What's performance like? Presumably significantly better than
 CPython, as that's what you're boasting here. Have you run a
 standardized benchmark? How do the numbers look?
 
I must admit that after automaticaly convert Python source to Go, compile 
to EXE, the running speed is just as before. For compatible reason, I must 
make it behave just as it before, support any Python feathers. Take a 
example, if we find a function call func1(2), I can not simply convert it 
to Go function call as func1_in_go(2), but something like this: 
current_module_scope.GetAttributeString(func1).CallObject(2)
because func1 maybe overwrited.

I think the significance of Python to Go, is it give us opportunity to 
make Python project run fast. We may edit the output Go source. or We 
may add some Python decorator to tell the converter its safe to convert 
it in simple form.
 

 If the answer is It'll work on anything, but it's only faster if you
 restrict yourself to a specific subset of Python syntax, that's still
 useful. But we'd need to see figures that tell us when it's worth
 adding a separate dependency and another translation layer (after all,
 every layer adds its own bug potential).
 
 ChrisA

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


compiled cx_freeze

2014-05-25 Thread Nagy László Zsolt
Anyone knows where to get a compiled cx_freeze that has already has this 
patch?


http://hg.python.org/cpython/rev/7d20e30bd540
https://bitbucket.org/anthony_tuininga/cx_freeze/issue/81/python-34-venv-importlib-attributeerror

The installer on the sourceforge site still has this bug. :-( I don't 
have the tools to compile it, and I cannot find any other place to 
download the patched version.


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


Re: Make Python Compilable, convert to Python source to Go

2014-05-25 Thread Chris Angelico
On Sun, May 25, 2014 at 6:17 PM, bookaa bookaa rors...@gmail.com wrote:
 1) How compatible is your Python-to-Golang converter with all the
 nuances of Python code? Does it work perfectly on any arbitrary Python
 script? And, what version of Python is it aimed at?

 I try to support all Python syntax, any arbitray script. From the example
  attached,you can see I translate all import system libraries needed and
 produce up to 17 lines of Go. Up to now, only support Python 2.7.6.
 Maybe I will work on Python 3 later.

 2) What's performance like? Presumably significantly better than
 CPython, as that's what you're boasting here. Have you run a
 standardized benchmark? How do the numbers look?

 I must admit that after automaticaly convert Python source to Go, compile
 to EXE, the running speed is just as before. For compatible reason, I must
 make it behave just as it before, support any Python feathers. Take a
 example, if we find a function call func1(2), I can not simply convert it
 to Go function call as func1_in_go(2), but something like this: 
 current_module_scope.GetAttributeString(func1).CallObject(2)
 because func1 maybe overwrited.

 I think the significance of Python to Go, is it give us opportunity to
 make Python project run fast. We may edit the output Go source. or We
 may add some Python decorator to tell the converter its safe to convert
 it in simple form.

This is extremely unsurprising. Everyone who says Python is so slow
is comparing against a less dynamic language. Python lets you change
any name *at any time*, so all lookups must be done at the time
they're asked for. (By comparison, Pike binds all global names at
compile time - effectively, when you import the module. If you want to
change one, you need to reimport code that's using it. C, of course,
binds everything early, and that's that.)

There have been a variety of proposals to remove some of Python's
dynamism with markers saying This is read-only. Victor Stinner
started a thread on python-ideas this week with some serious proposals
and decent argument (backed by a POC fork of CPython 3.5). Also, I'm
not 100% sure but I suspect that PyPy quite possibly optimizes on the
basis of this probably hasn't changed the meaning of len(), and does
a quick check (if len has been rebound, go to the slow path,
otherwise run the fast path) rather than checking each time. Both of
these options are viable, both have their trade-offs... and neither
requires actually compiling via an unrelated language.

I have never liked any system that involves converting code from one
language to another and then hand-editing the resulting code. There is
a reason the languages are different; they have different strengths
and different weaknesses. There's always going to be something that's
messy in the target language. Sometimes you don't care (you can
probably write an 8086 Assembler interpreter in Python and have it run
at 4.77MHz as long as the Python interpreter is running on fast enough
hardware), but if your goal is an overall speed improvement, you're up
against a number of Python interpreters that have specifically looked
at performance (I know CPython may be considered slow, but the devs do
care about running time; and PyPy touts running times of 16% of
CPython's), so you're going to have to boast some pretty good numbers.

Strong recommendation: If you want to move forward with this, compare
against Python 3.x. New projects want to be written for Py3 rather
than Py2, and you're limiting your project's usefulness if it's
compatible only with Py2. As an added bonus, Py3 is currently a bit
slower than Py2 in a lot of benchmarks, so you get yourself a slightly
easier target :)

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


Re: How keep Python 3 moving forward - suds Python 3

2014-05-25 Thread Jurko Gospodnetić

  Hi Roy.

On 24.5.2014. 1:57, Roy Smith wrote:

You need 19 projects to transition to Python 3.
Of those 19 projects, 17 have no direct dependencies blocking their
transition:

[...snipped...]
   suds


That's a big list.  A few of those we could probably work around or
replace with a different module without too much pain.  But, between
gevent, boto, fabric, and suds, any idea of migrating is a total
non-starter for us.  I imagine they're all working on ports, but I'll
check back in a year and see how things stand.


  FYI, the suds-jurko fork works on Python 3. And since I'm not aware 
of any other actively maintained fork, should I find more free time in 
the future I might rename it to suds and try to convert it to a formal 
successor to suds.


  Hope this helps.

  Best regards,
Jurko Gospodnetić


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


Re: How keep Python 3 moving forward

2014-05-25 Thread Stefan Behnel
Roy Smith, 24.05.2014 01:57:
 I installed and ran caniusepython3.  It tells me:
 
 Finding and checking dependencies ...
 [WARNING] rpclib not found

 You need 19 projects to transition to Python 3.
 Of those 19 projects, 17 have no direct dependencies blocking their 
 transition:

   beanstalkc
   dateglob
   diamond
   django-multi-sessions
   django-timedeltafield
   dnspython
   ecks
   fabric
   gevent (which is blocking grequests)
   hash_ring
   httmock
   jellyfish
   boto (which is blocking mrjob)
   paste
   pyephem
   python-cjson
   suds
 
 That's a big list.  A few of those we could probably work around or 
 replace with a different module without too much pain.  But, between 
 gevent, boto, fabric, and suds, any idea of migrating is a total 
 non-starter for us.  I imagine they're all working on ports, but I'll 
 check back in a year and see how things stand.

Ubuntu provides a (partial) Py3 port of boto. And I don't really see why
you would consider fabric a dependency that keeps you from switching to
Py3. In many cases, you can just keep running it in Py2 as you did before.

Taking a closer look at the big list that caniusepython3 spits out will
usually make it shrink to a manageable size. Meaning, the blind size of
that list is not an excuse for anything.

Stefan


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


Re: Make Python Compilable, convert to Python source to Go

2014-05-25 Thread Stefan Behnel
bookaa bookaa, 25.05.2014 10:17:
 I think the significance of Python to Go, is it give us opportunity to 
 make Python project run fast.

You shouldn't make that your only goal, because you'll have a really hard
time achieving it (to put it mildly).

Stefan


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


Re: WSGI (was: Re: Python CGI)

2014-05-25 Thread alister
On Sun, 25 May 2014 09:06:18 +0200, Chris wrote:

 On 05/20/2014 03:52 AM, Tim Chase wrote:
 While Burak addressed your (Fast-)CGI issues, once you have a
 test-script successfully giving you output, you can use the
 standard-library's getpass.getuser() function to tell who your script
 is running as.
 
 LoadModule wsgi_module modules/mod_wsgi.so AddHandler wsgi-script .wsgi
 WSGIDaemonProcess myproj user=chris threads=3
 
 [root@t-centos1 ~]# ps -ef|grep chris chris 1201  1199  0 08:47 ?   
 00:00:00 /usr/sbin/httpd
 
 ---8---
 #!/usr/bin/python import getpass def application(environ,
 start_response):
 status = '200 OK'
 output = 'Hello World!'
 output += getpass.getuser()
 response_headers = [('Content-type', 'text/plain'),
 ('Content-Length', str(len(output)))]
 start_response(status, response_headers)
 
 return [output]
 ---8---
 
 Hello World!root
 
 Hmm, why is it root?
 
 I'm using Apache and mod_userdir. Can I define WSGIDaemonProcess for
 each user?
 
 - Chris

is your apache server running as root?
if so it probably should be corrected


-- 
Why is it taking so long for her to bring out all the good in you?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: compiled cx_freeze

2014-05-25 Thread Никола Вукосављевић
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 25.5.2014 10:11, Nagy László Zsolt wrote:
 Anyone knows where to get a compiled cx_freeze that has already has
 this patch?
 
 http://hg.python.org/cpython/rev/7d20e30bd540 
 https://bitbucket.org/anthony_tuininga/cx_freeze/issue/81/python-34-venv-importlib-attributeerror

 
 
 The installer on the sourceforge site still has this bug. :-( I
 don't have the tools to compile it, and I cannot find any other
 place to download the patched version.
 
 Thanks
Actually, I've built cx_freeze 4.3.2 (the current version is 4.3.3)
with that patch some time ago. I'm not sure how would I distribute it
to you. `setup.py install` still requires a compiler for building
extensions (even though they're already built), while wheels (and
eggs) don't distribute the scripts (cxfreeze, cxfreeze-postinstall,
cxfreeze-quickstart) needed to run cx_freeze. I guess you could
install the wheel, manually run cxfreeze-postinstall and then add the
.py extension to cxfreeze.

Here are the files:
https://www.dropbox.com/sh/ka8jyt5shyqn4t9/AACLTHMXHpsPsn5YeXCrWEBma
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.19 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJTgb94AAoJEB1x37R9kdwnmWcQAMg73yM9hDzAH3yJjDHtxlHP
PIBaOvg+7tNovAEjMXne3IBczZ7SrtwJW0smUT8j/GBMiGSSxUz4rydqAl2hAZ2A
EPGyOiIFEvQMutjvtyMRNTUT9G0IUXbCXy9+tnHcK9pIUbNOV9QGSfY5jlxNGH4P
ckssgi8GPYDUABwzxBlsrT2UZbSR2ef9JqPGgDn0c38b3YIWeHE3KYXP0zj4La/j
iw7XjEwe275HNC2QuDcXzFPIBwLTbf4swPHd4v16BtTOM0m476x+wEj/OOTcHzud
C8vMDKmxT3UIrrBxlWHVAQo+s1cUajYB9RuarsR3M6TOv+oMtncm2QJhtXyW/CzX
0SDqzFpekp3Ltpo3jU9aITR+BJHoSFsPp+ff4NoGNBW7zV/WpIS2rMagxHs4BzF5
HMcvknPE5bhCWk/hjF2i/jql8EZUpGi9d7xQIGZqXw+gpy6u0HIJa3nmCgTrruOI
TW3I3KprH1WcyEEIHJI58MUqoQ8C1I60BY/0sPtMIg/tn7wn8PyOCVDNalGJJ7DU
HVyE0r5i0n0cy2CfbZFLEs6D3Q9y0JdA1ITYL4uCQ/svMOR40+AmJhthxMpxF2Wl
5DA4GfNF/i7g6dZlToQcR+BpYSl9bk/6+C8R777q1VraYmL6b87Wg7jC3tG0kHB5
Fd7BNCFEX7Um/wMxIJ5x
=ZaSc
-END PGP SIGNATURE-
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Make Python Compilable, convert to Python source to Go

2014-05-25 Thread Mark Lawrence

On 25/05/2014 09:17, bookaa bookaa wrote:

Maybe I will work on Python 3 later.



That's good to know, it'll save me wasting my time looking at it now.

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


Mark Lawrence

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


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


Re: Make Python Compilable, convert to Python source to Go

2014-05-25 Thread mm0fmf

On 25/05/2014 11:24, Mark Lawrence wrote:

On 25/05/2014 09:17, bookaa bookaa wrote:

Maybe I will work on Python 3 later.



That's good to know, it'll save me wasting my time looking at it now.


OT:
Mark, you've been pro-Python3 enough in your recent postings you have 
forced me to act. I've just upgraded my 1st Python2 app to Python3. 2to3 
did 99.999% of the work and I had to get a more modern version of a 
package which was Python3 compatible.


From Tuesday (Monday is a holiday), all new Python code at work will be 
Python3


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


Re: Make Python Compilable, convert to Python source to Go

2014-05-25 Thread Mark Lawrence

On 25/05/2014 12:02, mm0fmf wrote:

On 25/05/2014 11:24, Mark Lawrence wrote:

On 25/05/2014 09:17, bookaa bookaa wrote:

Maybe I will work on Python 3 later.



That's good to know, it'll save me wasting my time looking at it now.


OT:
Mark, you've been pro-Python3 enough in your recent postings you have
forced me to act. I've just upgraded my 1st Python2 app to Python3. 2to3
did 99.999% of the work and I had to get a more modern version of a
package which was Python3 compatible.

 From Tuesday (Monday is a holiday), all new Python code at work will be
Python3

Andy


I merely think Python 3 is the way to go, and that the Python 2.8 crew 
don't so much have loose screws, but never had them fitted in the first 
place.


FTR I entirely agree with Roy Smith about sticking with Python 2 in his 
situation, strikes me as a complete no brainer.


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


Mark Lawrence

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


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


os.stat and time zones

2014-05-25 Thread Nagy László Zsolt

This might be a silly question. Documentation of os.stat:

The exact meaning and resolution of the st_atime, st_mtime, and 
st_ctime attributes depend on the operating system and the file 
system. For example, on Windows systems using the FAT or FAT32 file 
systems, st_mtime has 2-second resolution, and st_atime has only 1-day 
resolution. See your operating system documentation for details.

So it says that the meaning is platform dependent.

But here is something interesting. Supposedly, os.stat(fpath).st_mtime 
and os.path.getmtime(path) return the same thing. The documentation of 
os.path.getmtime says that it returns the number of seconds since the 
epoch. And the time module says that To find out what the epoch is, 
look at gmtime(0). And the documentation of gmtime says that it 
converts the given value to a struct_time *that is in UTC*.


If the above are true, then as far as I can see, the meaning of st_mtime 
is NOT platform dependent. It always means the number of seconds elapsed 
since the epoch in UTC. (The resolution can be platform dependent, I 
admit that.)


So what is the truth? What other difference can be in the meaning that 
is platform dependent?


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


Re: Numpy Array of Sets

2014-05-25 Thread LJ
Wolfgang, thank you very much for your reply.

Following the example in the link, the problem appears:

 A = [[0]*2]*3
 A
[[0, 0], [0, 0], [0, 0]]
 A[0][0] = 5
 A
[[5, 0], [5, 0], [5, 0]]

Now, if I use a numpy array:

 d=array([[0]*2]*3)
 d
array([[0, 0],
   [0, 0],
   [0, 0]])
 d[0][0]=5
 d
array([[5, 0],
   [0, 0],
   [0, 0]])


What is the difference here?

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


Loop thru the dictionary with tuples

2014-05-25 Thread Igor Korot
Hi, ALL,
I have a following data structure:

my_dict[(var1,var2,var3)] = None
my_dict[(var4,var5,var6)] = 'abc'

What I'm trying to do is this:

for (key,value) in my_dict:
#Do some stuff

but I'm getting an error Too many values to unpack.

What am I doing wrong?

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


RE: compiled cx_freeze

2014-05-25 Thread Joseph L. Casale
 Anyone knows where to get a compiled cx_freeze that has already has this 
 patch?

http://www.lfd.uci.edu/~gohlke/pythonlibs/#cx_freeze
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Loop thru the dictionary with tuples

2014-05-25 Thread Paul Rubin
Igor Korot ikoro...@gmail.com writes:
 for (key,value) in my_dict:
 #Do some stuff

 but I'm getting an error Too many values to unpack.

Use 
for (key,value) in mydict.iteritems(): ...
otherwise you loop through just the keys, whicn in your dictionary 
happens to be 3-tuples.  So you try to unpack a 3-tuple to a 2-tuple
and get a too-many-values error.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Loop thru the dictionary with tuples

2014-05-25 Thread Tim Chase
On 2014-05-25 05:59, Paul Rubin wrote:
 Igor Korot ikoro...@gmail.com writes:
  for (key,value) in my_dict:
  #Do some stuff
 
  but I'm getting an error Too many values to unpack.
 
 Use 
 for (key,value) in mydict.iteritems(): ...

You can even use

  for ((k1,k2,k3), value) in mydict.iteritems():
...

if you need to unpack the key at the same time.

-tkc





signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Loop thru the dictionary with tuples

2014-05-25 Thread Roy Smith
In article mailman.10291.1401022510.18130.python-l...@python.org,
 Igor Korot ikoro...@gmail.com wrote:

 for (key,value) in my_dict:
 #Do some stuff
 
 but I'm getting an error Too many values to unpack.

Several people have already given you the right answer, so I'll just 
suggest a general debugging technique.  Break this down into the 
smallest possible steps and print out the intermediate values.  When you 
write:

 for (key,value) in my_dict:

two things are happening.  One is that you're iterating over my_dict, 
the other is that you're unpacking the iterated-over things.  So break 
those up into individual steps:

for thing in my_dict:
(key, value) = thing

and see what that gives you.  Do you still get an error?  If so, does it 
occur on the for line or on the assignment line?  Hint: in this case, 
it will happen on the assignment line, so, your next step is to print 
everything out and see what's going on:

for thing in my_dict:
print thing
(key, value) = thing

At this point, it should be obvious what's going on, but just in case 
it's not, sometimes I find it useful to be even more verbose:

for thing in my_dict:
print type(thing), repr(thing)
(key, value) = thing
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Numpy Array of Sets

2014-05-25 Thread Peter Otten
LJ wrote:

 Wolfgang, thank you very much for your reply.
 
 Following the example in the link, the problem appears:
 
 A = [[0]*2]*3

You can see this as a shortcut for

value = 0
inner = [value, value]
A = [inner, inner, inner]

When the value is mutable (like your original set) a modification of the 
value shows in all six entries. Likewise if you change the `inner` list the 
modification shows in all three rows.

 A
 [[0, 0], [0, 0], [0, 0]]
 A[0][0] = 5
 A
 [[5, 0], [5, 0], [5, 0]]
 
 Now, if I use a numpy array:
 
 d=array([[0]*2]*3)
 d
 array([[0, 0],
[0, 0],
[0, 0]])
 d[0][0]=5
 d
 array([[5, 0],
[0, 0],
[0, 0]])
 
 
 What is the difference here?

Basically a numpy array doesn't reference the lists, it uses them to 
determine the required shape of the array. A simplified implementation might 
be

class Array:
def __init__(self, data):
self.shape = (len(data), len(data[0]))
self._data = []
for row in data: self._data.extend(row)
def __getitem__(self, index):
y, x = index
return self._data[y * self.shape[1] + x]

With that approach you may only see simultaneous changes of multiple entries 
when using mutable values.

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


Re: compiled cx_freeze

2014-05-25 Thread Nagy László Zsolt




Anyone knows where to get a compiled cx_freeze that has already has this
patch?

http://www.lfd.uci.edu/~gohlke/pythonlibs/#cx_freeze
Unfortunately, this is buggy too. Here is a test output from a compiled 
console exe created with the above version of cx freeze:



Traceback (most recent call last):
  File 
C:\Python34\lib\site-packages\cx_Freeze\initscripts\Console.py, line 
27, in moduleexec(code, m.__dict__)

  File backup.py, line 6, in module
  File X:\Python34\lib\importlib\_bootstrap.py, line 2214, in 
_find_and_load
  File X:\Python34\lib\importlib\_bootstrap.py, line 2203, in 
_find_and_load_unlocked
  File X:\Python34\lib\importlib\_bootstrap.py, line 1191, in 
_load_unlocked
  File X:\Python34\lib\importlib\_bootstrap.py, line 1161, in 
_load_backward_compatible

AttributeError: 'module' object has no attribute '_fix_up_module'

This is clearly the aforementioned bootstrap bug.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Loop thru the dictionary with tuples

2014-05-25 Thread Ned Batchelder

On 5/25/14 8:55 AM, Igor Korot wrote:

Hi, ALL,
I have a following data structure:

my_dict[(var1,var2,var3)] = None
my_dict[(var4,var5,var6)] = 'abc'

What I'm trying to do is this:

for (key,value) in my_dict:
 #Do some stuff

but I'm getting an error Too many values to unpack.

What am I doing wrong?

Thank you.



You want:

for key, value in my_dict.items():  # or .iteritems()

Iterating over a dictionary gives you its keys.  items() will give you 
key,value pairs.


--
Ned Batchelder, http://nedbatchelder.com

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


Re: Loop thru the dictionary with tuples

2014-05-25 Thread Chris Angelico
On Sun, May 25, 2014 at 11:22 PM, Roy Smith r...@panix.com wrote:
 Hint: in this case,
 it will happen on the assignment line, so, your next step is to print
 everything out and see what's going on:

 for thing in my_dict:
 print thing
 (key, value) = thing

Aside: I know that you (Roy) are still using Python 2, but the OP
could be on either branch. As a matter of safety, I'd put parens
around the print:

for thing in my_dict:
print(thing)
(key, value) = thing

That way, it works on either.

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


Re: Numpy Array of Sets

2014-05-25 Thread LJ
Thank you for the reply.

So, as long as I access and modify the elements of, for example, 

A=array([[set([])]*4]*3)


as (for example):

a[0][1] = a[0][1] | set([1,2])

or:

a[0][1]=set([1,2])

then I should have no problems?
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: compiled cx_freeze

2014-05-25 Thread Joseph L. Casale
 Unfortunately, this is buggy too. Here is a test output from a compiled 
 console exe created with the above version of cx freeze:

Let  Christoph know, he is very responsive and extremely helpful.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Numpy Array of Sets

2014-05-25 Thread Peter Otten
LJ wrote:

 Thank you for the reply.
 
 So, as long as I access and modify the elements of, for example,
 
 A=array([[set([])]*4]*3)
 
 
 as (for example):
 
 a[0][1] = a[0][1] | set([1,2])
 
 or:
 
 a[0][1]=set([1,2])
 
 then I should have no problems?

As long as you set (i. e. replace) elements you're fine, but modifying means 
trouble. You can prevent accidental modification by using immutable values 
-- in your case frozenset:

 b = numpy.array([[frozenset()]*4]*3)
 b[0,0].update(123)
Traceback (most recent call last):
  File stdin, line 1, in module
AttributeError: 'frozenset' object has no attribute 'update'

Or you take the obvious approach and ensure that there are no shared values. 
I don't know if there's a canonical form to do this in numpy, but

 a = numpy.array([[set()]*3]*4) 
 a |= set()

works:

 assert len(set(map(id, a.flat))) == 3*4


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


Re: Numpy Array of Sets

2014-05-25 Thread LJ
Thank you very much!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How keep Python 3 moving forward

2014-05-25 Thread Ethan Furman

On 05/24/2014 11:43 PM, wxjmfa...@gmail.com wrote:


Python and unicode: a buggy hobbyist toy.
Voilà. Nothing either good or bad.


I thought this was a moderated list.  What exactly are the moderators doing?

--
~Ethan~

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


Re: How keep Python 3 moving forward

2014-05-25 Thread Chris Angelico
On Mon, May 26, 2014 at 1:21 AM, Ethan Furman et...@stoneleaf.us wrote:
 On 05/24/2014 11:43 PM, wxjmfa...@gmail.com wrote:


 Python and unicode: a buggy hobbyist toy.
 Voilà. Nothing either good or bad.


 I thought this was a moderated list.  What exactly are the moderators doing?

It's not a moderated list. We just collectively ignore the (few)
people who aren't saying anything worth reading.

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


How to pass variable through scipts

2014-05-25 Thread dimmaim
My code has this structure:
class Example(wx.Frame,listmix.ColumnSorterMixin):
def __init__(self,parent):
wx.Frame.__init__(self,parent)

self.InitUI()

def InitUI(self): 
. some other functions and other stuff

when a button is clicked this function is called and i take the self.id_number 
which is a number

def OnB(self, event):
self.id_number = self.text_ctrl_number.GetValue()
xx = latitude[int(self.id_number)]
yy = longitude[int(self.id_number)]

i want to pass the variables xx and yy to a different script called 
application. This script by calling it with import, automatically  pop up a 
window. I need by clicking the button that is linked with OnB definition to pop 
up the window from the other script as it does when i am running it alone and 
display lets say for example the variables xx and yy, how can i do it
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How keep Python 3 moving forward

2014-05-25 Thread Mark Lawrence

On 25/05/2014 16:21, Ethan Furman wrote:

On 05/24/2014 11:43 PM, wxjmfa...@gmail.com wrote:


Python and unicode: a buggy hobbyist toy.
Voilà. Nothing either good or bad.


I thought this was a moderated list.  What exactly are the moderators
doing?

--
~Ethan~



I don't think the list is moderated.  I do think this guy has had thirty 
strikes rather than three, so isn't it time he was finally given out?


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


Mark Lawrence

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


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


testfixtures 3.1.0 Released!

2014-05-25 Thread Chris Withers

Hi All,

I'm pleased to announce the release of testfixtures 3.1.0. This is a new 
feature and bug fix release featuring the following changes:


- New RoundComparison object for comparing numbers to a given precision

- New 'unless' parameter to ShouldRaise, for situations where an 
exception is raised in Python 2 but not Python 3.


- Fixes for missing imports in fix for rare failures when cleaning up 
TempDirectory instances on Windows.


The package is on PyPI and a full list of all the links to docs, issue 
trackers and the like can be found here:


http://www.simplistix.co.uk/software/python/testfixtures

Any questions, please do ask on the Testing in Python list or on the 
Simplistix open source mailing list...


cheers,

Chris

--
Simplistix - Content Management, Batch Processing  Python Consulting
   - http://www.simplistix.co.uk
--
https://mail.python.org/mailman/listinfo/python-list


Re: How to pass variable through scipts

2014-05-25 Thread Chris Angelico
On Mon, May 26, 2014 at 2:01 AM,  dimm...@gmail.com wrote:
 i want to pass the variables xx and yy to a different script called 
 application. This script by calling it with import, automatically  pop up a 
 window. I need by clicking the button that is linked with OnB definition to 
 pop up the window from the other script as it does when i am running it alone 
 and display lets say for example the variables xx and yy, how can i do it


When you import another script, you gain access to its functions and
classes and such. All you need to do is write your function to take a
couple of arguments, and then pass xx and yy as those arguments.

I recommend you read and work through the Python tutorial - one of
these, depending on which version of Python you use:

https://docs.python.org/2/tutorial/
https://docs.python.org/3/tutorial/

It'll explain a lot of these sorts of things.

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


Shared web hosting where python is *not* a second class citizen

2014-05-25 Thread memilanuk

Right now we have a fairly basic shared hosting plan via bluehost.com,
running WordPress for a club web site.  I've looked at setting up python
on this account, but the default is the version of python that comes
with the OS (CentOS 5.x currently).  There are some basic instructions 
on upgrading that at a user level to 2.7... but nothing for python3, and 
most of the python posts in their user forums go unanswered.  Not 
exactly confidence inspiring!  The irony is that one of my web searches 
included a review of shared hosting and listed BlueHost as the number 
one recommendation!


So I'm left wondering if there is someplace that people here would 
recommend (for this kind of plan or others) where python isn't a second 
class citizen.  Really not interested (for my current uses) in a VPS.  I 
just want some place where it doesn't feel like python support is some 
sort of bone thrown out there just to say that they 'support' python.


Monte

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


Re: Shared web hosting where python is *not* a second class citizen

2014-05-25 Thread Tim Golden

On 25/05/2014 18:25, memilanuk wrote:

Right now we have a fairly basic shared hosting plan via bluehost.com,
running WordPress for a club web site.  I've looked at setting up python
on this account, but the default is the version of python that comes
with the OS (CentOS 5.x currently).  There are some basic instructions
on upgrading that at a user level to 2.7... but nothing for python3, and
most of the python posts in their user forums go unanswered.  Not
exactly confidence inspiring!  The irony is that one of my web searches
included a review of shared hosting and listed BlueHost as the number
one recommendation!

So I'm left wondering if there is someplace that people here would
recommend (for this kind of plan or others) where python isn't a second
class citizen.  Really not interested (for my current uses) in a VPS.  I
just want some place where it doesn't feel like python support is some
sort of bone thrown out there just to say that they 'support' python.



Webfaction. Without a doubt

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


Re: Shared web hosting where python is *not* a second class citizen

2014-05-25 Thread Chris “Kwpolska” Warrick
On Sun, May 25, 2014 at 7:25 PM, memilanuk memila...@gmail.com wrote:
 Right now we have a fairly basic shared hosting plan via bluehost.com,
 running WordPress for a club web site.  I've looked at setting up python
 on this account, but the default is the version of python that comes
 with the OS (CentOS 5.x currently).  There are some basic instructions on
 upgrading that at a user level to 2.7... but nothing for python3, and most
 of the python posts in their user forums go unanswered.  Not exactly
 confidence inspiring!  The irony is that one of my web searches included a
 review of shared hosting and listed BlueHost as the number one
 recommendation!

 So I'm left wondering if there is someplace that people here would recommend
 (for this kind of plan or others) where python isn't a second class citizen.
 Really not interested (for my current uses) in a VPS.  I just want some
 place where it doesn't feel like python support is some sort of bone thrown
 out there just to say that they 'support' python.

Heroku, Google App Engine, or pretty much any other
Platform-as-a-Service provider.

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


Re: How keep Python 3 moving forward

2014-05-25 Thread Rustom Mody
On Sunday, May 25, 2014 8:51:18 PM UTC+5:30, Ethan Furman wrote:
 On 05/24/2014 11:43 PM, jmf wrote:
 
  Python and unicode: a buggy hobbyist toy.
  Voil�. Nothing either good or bad.
 
 
 I thought this was a moderated list.  What exactly are the moderators doing?


Your unicode is mojibaked  Ethan! Voil�.
You are hereby banished to a lonely island with python 1.5 and jmf for company 
:D
-- 
https://mail.python.org/mailman/listinfo/python-list


win32serviceutil: ImportError: DLL load failed: The specified module could not be found

2014-05-25 Thread Nagy László Zsolt

 import win32service
Traceback (most recent call last):
  File stdin, line 1, in module
ImportError: DLL load failed: The specified module could not be found

I have no problem loading the same module with Python 2.7.

Strange thing is that win32serviceutil.py is part of the pywin32 
distribution, so I guess I should be able to import it, right?


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


Re: How keep Python 3 moving forward

2014-05-25 Thread Roy Smith
In article mailman.10285.1401009964.18130.python-l...@python.org,
 Stefan Behnel stefan...@behnel.de wrote:

 Ubuntu provides a (partial) Py3 port of boto.

As long as the part that's ported includes all the bits of boto we 
currently need, plus all the bits of boto we haven't yet discovered we 
need, but will sometime in the future, we're good :-)

 And I don't really see why you would consider fabric a dependency 
 that keeps you from switching to Py3. In many cases, you can just 
 keep running it in Py2 as you did before.

In theory, that's possible.  In practice, it would mean having to 
maintain two different versions of Python, and test everything against 
both.  That adds a lot of complexity, for very little value.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How keep Python 3 moving forward

2014-05-25 Thread Steven D'Aprano
On Sun, 25 May 2014 10:38:42 -0700, Rustom Mody wrote:

 On Sunday, May 25, 2014 8:51:18 PM UTC+5:30, Ethan Furman wrote:
 On 05/24/2014 11:43 PM, jmf wrote:
 
  Python and unicode: a buggy hobbyist toy. Voil�. Nothing either
  good or bad.
 
 
 I thought this was a moderated list.  What exactly are the moderators
 doing?
 
 
 Your unicode is mojibaked  Ethan! Voil�. You are hereby banished to a
 lonely island with python 1.5 and jmf for company :D

Nope, it's you. Ethan's post is fine. He correctly quotes JMF stating 
Voilà (that's LATIN SMALL LETTER A WITH GRAVE), and Ethan's post 
correctly gives an encoding header:

Content-Type: text/plain; charset=iso-8859-1; format=flowed

(although, boo to Thunderbird for using a legacy encoding instead of 
UTF-8). So his post is fine. Whatever the problem is, it's at your end.



-- 
Steven D'Aprano
http://import-that.dreamwidth.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: WSGI

2014-05-25 Thread Chris
On 05/25/2014 12:04 PM, alister wrote:
 is your apache server running as root?
 if so it probably should be corrected

One is running as chris, the others as apache:

[root@t-centos1 ~]# ps -ef|grep httpd
root  1199 1  0 08:47 ?00:00:01 /usr/sbin/httpd
chris 1293  1199  0 09:47 ?00:00:00 /usr/sbin/httpd
apache1294  1199  0 09:47 ?00:00:00 /usr/sbin/httpd
apache1295  1199  0 09:47 ?00:00:00 /usr/sbin/httpd
apache1296  1199  0 09:47 ?00:00:00 /usr/sbin/httpd
apache1297  1199  0 09:47 ?00:00:00 /usr/sbin/httpd
apache1298  1199  0 09:47 ?00:00:00 /usr/sbin/httpd
apache1299  1199  0 09:47 ?00:00:00 /usr/sbin/httpd
apache1300  1199  0 09:47 ?00:00:00 /usr/sbin/httpd
apache1301  1199  0 09:47 ?00:00:00 /usr/sbin/httpd
root  1578  1566  0 14:21 pts/000:00:00 grep httpd


-- 
Gruß,
Christian
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How keep Python 3 moving forward

2014-05-25 Thread Tim Chase
On 2014-05-25 18:17, Steven D'Aprano wrote:
 On Sun, 25 May 2014 10:38:42 -0700, Rustom Mody wrote:
  Your unicode is mojibaked  Ethan! Voil�. You are hereby
  banished to a lonely island with python 1.5 and jmf for company :D
 
 Nope, it's you. Ethan's post is fine. He correctly quotes JMF
 stating Voilà (that's LATIN SMALL LETTER A WITH GRAVE), and
 Ethan's post correctly gives an encoding header:
 
 Content-Type: text/plain; charset=iso-8859-1; format=flowed

I corroborate Steven's findings, that Ethan's post was correctly
encoded  displayed.

 (although, boo to Thunderbird for using a legacy encoding instead
 of UTF-8). So his post is fine. Whatever the problem is, it's at
 your end.

Thunderbird does offer the ability to change default character
encodings (Edit - Preferences - Display - Formatting tab -
Advanced...) for sending and receiving, but you have to go out of your
way to change them to something like UTF-8.  On the same preferences
screen TB provides the option to when possible, use the default
character encoding in replies.

-tkc



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


Re: How keep Python 3 moving forward

2014-05-25 Thread Ethan Furman

On 05/25/2014 10:38 AM, Rustom Mody wrote:


Your unicode is mojibaked  Ethan! Voil�.
You are hereby banished to a lonely island with python 1.5 and jmf for company 
:D


1.5 I could live with.  :(  Surely the company would count as cruel and 
unusual punishment?


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


Re: How keep Python 3 moving forward

2014-05-25 Thread Mark Lawrence

On 25/05/2014 19:34, Ethan Furman wrote:

On 05/25/2014 10:38 AM, Rustom Mody wrote:


Your unicode is mojibaked  Ethan! Voil�.
You are hereby banished to a lonely island with python 1.5 and jmf for
company :D


1.5 I could live with.  :(  Surely the company would count as cruel and
unusual punishment?

--
~Ethan~


The latter is definitely true, but does being king make up for it, on 
the grounds that he's clearly blind? :)


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


Mark Lawrence

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


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


Re: How keep Python 3 moving forward

2014-05-25 Thread Ethan Furman

On 05/25/2014 11:56 AM, Tim Chase wrote:


Thunderbird does offer the ability to change default character
encodings (Edit - Preferences - Display - Formatting tab -
Advanced...) for sending and receiving, but you have to go out of your
way to change them to something like UTF-8.  On the same preferences
screen TB provides the option to when possible, use the default
character encoding in replies.


Thanks, fixed.  :)

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


Re: win32serviceutil: ImportError: DLL load failed: The specified module could not be found

2014-05-25 Thread Terry Reedy

On 5/25/2014 1:40 PM, Nagy László Zsolt wrote:

  import win32service
Traceback (most recent call last):
   File stdin, line 1, in module
ImportError: DLL load failed: The specified module could not be found

I have no problem loading the same module with Python 2.7.


So the above is with ???


Strange thing is that win32serviceutil.py is part of the pywin32
distribution, so I guess I should be able to import it, right?


Make sure you have a pywin32 that matches ???. Matching includes python 
version and bitness.


--
Terry Jan Reedy


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


Re: How keep Python 3 moving forward

2014-05-25 Thread Mark Lawrence

On 25/05/2014 23:22, Dennis Lee Bieber wrote:

On Sun, 25 May 2014 11:34:59 -0700, Ethan Furman et...@stoneleaf.us
declaimed the following:


On 05/25/2014 10:38 AM, Rustom Mody wrote:


Your unicode is mojibaked  Ethan! Voil�.
You are hereby banished to a lonely island with python 1.5 and jmf for company 
:D


1.5 I could live with.  :(  Surely the company would count as cruel and
unusual punishment?


company... Or emergency rations?



I suspect that chewing razor blades would be preferable to listening to 
the permanent rant about what's wrong with the FSR.


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


Mark Lawrence

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


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


Re: Shared web hosting where python is *not* a second class citizen

2014-05-25 Thread memilanuk

On 05/25/2014 10:29 AM, Tim Golden wrote:

On 25/05/2014 18:25, memilanuk wrote:

So I'm left wondering if there is someplace that people here would
recommend (for this kind of plan or others) where python isn't a second
class citizen.  Really not interested (for my current uses) in a VPS.  I
just want some place where it doesn't feel like python support is some
sort of bone thrown out there just to say that they 'support' python.



Webfaction. Without a doubt



Wow!  Webfaction looks like it is *exactly* what I'm looking for.

Thanks,

Monte


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


Re: How keep Python 3 moving forward

2014-05-25 Thread Chris Angelico
On Mon, May 26, 2014 at 8:22 AM, Dennis Lee Bieber
wlfr...@ix.netcom.com wrote:
 On Sun, 25 May 2014 11:34:59 -0700, Ethan Furman et...@stoneleaf.us
 declaimed the following:

On 05/25/2014 10:38 AM, Rustom Mody wrote:

 Your unicode is mojibaked  Ethan! Voil�.
 You are hereby banished to a lonely island with python 1.5 and jmf for 
 company :D

1.5 I could live with.  :(  Surely the company would count as cruel and
unusual punishment?

 company... Or emergency rations?

Unfortunately not as effective as these guys:

http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=46017

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


Re: How keep Python 3 moving forward

2014-05-25 Thread Ethan Furman

On 05/25/2014 03:22 PM, Dennis Lee Bieber wrote:

On Sun, 25 May 2014 11:34:59 -0700, Ethan Furman et...@stoneleaf.us
declaimed the following:


On 05/25/2014 10:38 AM, Rustom Mody wrote:


Your unicode is mojibaked  Ethan! Voilà.
You are hereby banished to a lonely island with python 1.5 and jmf for company 
:D


1.5 I could live with.  :(  Surely the company would count as cruel and
unusual punishment?


company... Or emergency rations?


Well, the thought had crossed my mind... I guess the deciding factor 
would have to be if I had any ketchup.


--
~Ethan~

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


Re: How keep Python 3 moving forward

2014-05-25 Thread Terry Reedy

On 5/25/2014 6:20 PM, Dennis Lee Bieber wrote:

the mailing
list and gmane group may have some spam filters in place but no real
moderation.


They *do* have spam, structure, and source filters. Please do not 
mis-inform people that they post most anything to python-list without 
consequence.


--
Terry Jan Reedy

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


confused about the different built-in functions in Python

2014-05-25 Thread Deb Wyatt




I am confused about how various built-in functions are called. Some are called with dot notationeach_item.isalpha()and some are called like 'normal'sum(numlist)How do you know/remember which way to call them?TIA,Deb in WA, USA

Free Online Photosharing - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!




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


Re: How keep Python 3 moving forward

2014-05-25 Thread Gene Heskett
On Sunday 25 May 2014 18:22:11 Dennis Lee Bieber did opine
And Gene did reply:
 On Sun, 25 May 2014 11:34:59 -0700, Ethan Furman et...@stoneleaf.us
 
 declaimed the following:
 On 05/25/2014 10:38 AM, Rustom Mody wrote:
  Your unicode is mojibaked  Ethan! Voilï؟½.
  You are hereby banished to a lonely island with python 1.5 and jmf
  for company :D
 
 1.5 I could live with.  :(  Surely the company would count as cruel
 and unusual punishment?
 
   company... Or emergency rations?

Humm, now thats a thought...

Cheers, Gene Heskett
-- 
There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order.
-Ed Howdershelt (Author)
Genes Web page http://geneslinuxbox.net:6309/gene
US V Castleman, SCOTUS, Mar 2014 is grounds for Impeaching SCOTUS
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Loop thru the dictionary with tuples

2014-05-25 Thread Dave Angel
Ned Batchelder n...@nedbatchelder.com Wrote in message:
 On 5/25/14 8:55 AM, Igor Korot wrote:
 Hi, ALL,
 I have a following data structure:

 my_dict[(var1,var2,var3)] = None
 my_dict[(var4,var5,var6)] = 'abc'

 What I'm trying to do is this:

 for (key,value) in my_dict:
  #Do some stuff

 but I'm getting an error Too many values to unpack.

 What am I doing wrong?

 Thank you.

 
 You want:
 
  for key, value in my_dict.items():  # or .iteritems()
 
 Iterating over a dictionary gives you its keys.  items() will give you 
 key,value pairs.


Or, if the dict is large,  you might want

for key in my_dict:
value = my_dict [key]
...


-- 
DaveA

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


Re: confused about the different built-in functions in Python

2014-05-25 Thread Ned Batchelder

On 5/25/14 7:55 PM, Deb Wyatt wrote:

I am confused about how various built-in functions are called.  Some are
called with dot notation

each_item.isalpha()

and some are called like 'normal'

sum(numlist)

How do you know/remember which way to call them?

TIA,
Deb in WA, USA


It can be confusing.  Generally, built-in functions (like sum, len, etc) 
are used when the operation could apply to many different types.  For 
example, sum() can be used with any iterable that produces addable things.


Operations that are defined only for a single type (like .isalpha as a 
string operation) are usually defined as methods on the type.


This is not a black/white distinction, I'm sure there are interesting 
counter-examples.  But this is the general principle.


--
Ned Batchelder, http://nedbatchelder.com

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


Re: Loop thru the dictionary with tuples

2014-05-25 Thread Ned Batchelder

On 5/25/14 10:09 PM, Dave Angel wrote:

Ned Batchelder n...@nedbatchelder.com Wrote in message:

On 5/25/14 8:55 AM, Igor Korot wrote:

Hi, ALL,
I have a following data structure:

my_dict[(var1,var2,var3)] = None
my_dict[(var4,var5,var6)] = 'abc'

What I'm trying to do is this:

for (key,value) in my_dict:
  #Do some stuff

but I'm getting an error Too many values to unpack.

What am I doing wrong?

Thank you.



You want:

  for key, value in my_dict.items():  # or .iteritems()

Iterating over a dictionary gives you its keys.  items() will give you
key,value pairs.



Or, if the dict is large,  you might want

for key in my_dict:
 value = my_dict [key]
 ...


For a large dict, .iteritems (Python 2) or .items (Python 3) are 
perfectly fine and don't have a cost to avoid.   .items (Python 2) 
produces a list, which would be bad.


--
Ned Batchelder, http://nedbatchelder.com

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


Re: confused about the different built-in functions in Python

2014-05-25 Thread Cameron Simpson

On 25May2014 15:55, Deb Wyatt codemon...@inbox.com wrote:

I am confused about how various built-in functions are called.  Some are
called with dot notation

each_item.isalpha()

and some are called like 'normal'

sum(numlist)

How do you know/remember which way to call them?


Documentation.

However, some context:

each_item.isalpha() is not a builtin function as such. It is a method of the 
str class.


Whereas sum _is_ a builtin function, a globally known name which can be 
accessed and used without explicitly importing any module.


There's an explicit list of the builtin functions in the Python doco.

For a class, you can look at the doco for the class (String methods in the 
python doco, for the str class), or run:


  help(str)

at the interactive Python prompt.

Cheers,
Cameron Simpson c...@zip.com.au

Steinbach's Law: 2 is not equal to 3 -- even for large values of 2.
--
https://mail.python.org/mailman/listinfo/python-list


Re: os.stat and time zones

2014-05-25 Thread Cameron Simpson

On 25May2014 13:47, Nagy László Zsolt gand...@shopzeus.com wrote:

This might be a silly question. Documentation of os.stat:

The exact meaning and resolution of the st_atime, st_mtime, and 
st_ctime attributes depend on the operating system and the file 
system. For example, on Windows systems using the FAT or FAT32 file 
systems, st_mtime has 2-second resolution, and st_atime has only 
1-day resolution. See your operating system documentation for 
details.

So it says that the meaning is platform dependent.

But here is something interesting. Supposedly, os.stat(fpath).st_mtime 
and os.path.getmtime(path) return the same thing. The documentation of 
os.path.getmtime says that it returns the number of seconds since the 
epoch. And the time module says that To find out what the epoch is, 
look at gmtime(0). And the documentation of gmtime says that it 
converts the given value to a struct_time *that is in UTC*.


If the above are true, then as far as I can see, the meaning of 
st_mtime is NOT platform dependent. It always means the number of 
seconds elapsed since the epoch in UTC.


You have conflated two things here.

The offset since the epoch is a number of seconds since a (platform 
dependent) epoch: the start of time for the OS time counters on that system.


It has _nothing_ to do with UTC.

As far as st_atime and friends go, the epoch itself is platform dependent and 
so is the resolution (FAT filesystems having lower precision than might seem 
sane, probably to get a longer time range from a small field).


The field names come from POSIX, which comes from UNIX. The .st_atime etc field 
names are still presented on Windows to make code more portable. But Windows 
has a different epoch (UNIX time starts at the beginning of 1 January 1970; 
that is its epoch).


The gmtime() function takes the platform dependent offset-from-epoch and gives 
you a struct_time, which has human friendly date and hours/minutes/etc fields.  
These necessarily must be in a timezone, and UTC is a common frame of reference 
and the zone returned by gmtime() (gmt means GMT, Greenwich Mean Time, which 
is close to a synonym for UTC).


Between Windows and UNIX, the differences are the resolution and the epoch.

UTC is not platform dependent and not called so by the doco. That also makes it 
a useful zone to pass around in some contexts.


Cheers,
Cameron Simpson c...@zip.com.au
--
https://mail.python.org/mailman/listinfo/python-list


Build tools, and Python 3 dependencies (was: How keep Python 3 moving forward)

2014-05-25 Thread Ben Finney
Roy Smith r...@panix.com writes:

 Stefan Behnel stefan...@behnel.de wrote:

  And I don't really see why you would consider fabric a dependency
  that keeps you from switching to Py3. In many cases, you can just
  keep running it in Py2 as you did before.

 In theory, that's possible. In practice, it would mean having to
 maintain two different versions of Python

Why would using Fabric – a build tool – require you to “maintain two
different versions of Python”? You only need to maintain the build
scripts, not Python itself.

 and test everything against both.

That makes even less sense. The build system runs under whatever version
of Python it needs, and your code runs under whatever version of Python
you like. The two don't affect each other at run time, and don't affect
each other's testing dependencies.

How would Fabric's dependency on Python 2 require you to “test
everything against both [Python 2 and Python 3]”? Fabric needs Python 2
(for now), but your code doesn't.

At least one of us seems to be misunderstanding what is required.

-- 
 \   “Science and religion are incompatible in the same sense that |
  `\   the serious pursuit of knowledge of reality is incompatible |
_o__)   with bullshit.” —Paul Z. Myers, 2010-03-14 |
Ben Finney

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


Re: Make Python Compilable, convert to Python source to Go

2014-05-25 Thread Ben Finney
bookaa bookaa rors...@gmail.com writes:

 Generally, people consider Python as a script language.

Count me as one who does not. Python is a general-purpose language.

 It has high development efficiency

True.

 but run too slowly

Which Python implementation are you talking about? Run time is not a
property of the language. It is a property of the language
implementation.

 interpret running, and can not compile.

Python is always compiled in order to run. The process of turning Python
source into Python bytecode *is* compilation.

 It depends to Python environment, can not employ alone.

True.

 For years, many people have do a lot of job try to improve running
 speed of Python, include Pypy, Cython. But all of these are not
 satisfied.

I don't know what this sweeping statement means. Who is not satisfied?
There are a great many people who are satisfied with Python for many
general purpose needs.

Python is not “a scripting language”, it's general purpose. It is
compiled. It has many implementations and some are faster than others.
So I think you'll need to work on your arguments some more, in order to
justify what points you're making.

-- 
 \“… it's best to confuse only one issue at a time.” —Brian W. |
  `\Kernighan and Dennis M. Ritchie, _The C programming language_, |
_o__) 1988 |
Ben Finney

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


Re: os.stat and time zones

2014-05-25 Thread Ben Finney
Nagy László Zsolt gand...@shopzeus.com writes:

 This might be a silly question. Documentation of os.stat:

  The exact meaning and resolution of the st_atime, st_mtime, and
  st_ctime attributes depend on the operating system and the file
  system. For example, on Windows systems using the FAT or FAT32 file
  systems, st_mtime has 2-second resolution, and st_atime has only
  1-day resolution. See your operating system documentation for
  details.

 So it says that the meaning is platform dependent.

It says what it means: “The exact meaning and resolution of the
st_atime, st_mtime, and st_ctime attributes depend on the operating
system and the file system.”

That doesn't mean quite what you've said in your paraphrase.

 But here is something interesting. Supposedly, os.stat(fpath).st_mtime
 and os.path.getmtime(path) return the same thing.

The implementation of ‘os’ is platform-dependent. So, the meaning of the
return value of ‘os.stat’ and of ‘os.path.getmtime’ will also be
platform-dependent.

 If the above are true, then as far as I can see, the meaning of
 st_mtime is NOT platform dependent.

You've missed the part where the ‘os’ module is platform-dependent, and
hence the ‘os.stat’ behaviour is platform-dependent.

 It always means the number of seconds elapsed since the epoch in UTC.

The time elapsed doesn't change in meaning. The meaning of “modification
time” (and “creation time”, and “access time”) is what changes, because
different filesystems and different operating systems have different
meanings for those.

 So what is the truth? What other difference can be in the meaning that
 is platform dependent?

Read up on the different filesystems implemented on the operating
systems and filesystems relevant to you, and what meanings are assigned
by each specific filesystem to those timestamps.

-- 
 \   Moriarty: “Forty thousand million billion dollars? That money |
  `\must be worth a fortune!” —The Goon Show, _The Sale of |
_o__)   Manhattan_ |
Ben Finney

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


[issue21552] String length overflow in Tkinter

2014-05-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a little simpler patch. Instead of checking string length in custom 
converter, it is checked after invocation of PyArg_ParseTuple. Also added 
bigmem tests.

--
Added file: http://bugs.python.org/file35345/tkinter_strlen_overflow_alt.patch

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



[issue21343] os.path.relpath returns inconsistent types

2014-05-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Why you should check the type? There is no difference between '.' and u'.'.

--

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



[issue21331] Reversing an encoding with unicode-escape returns a different result

2014-05-25 Thread Serhiy Storchaka

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


--
status: open - pending

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



[issue20197] Support WebP image format detection in imghdr module

2014-05-25 Thread Serhiy Storchaka

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


--
assignee:  - serhiy.storchaka

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



[issue8743] set() operators don't work with collections.Set instances

2014-05-25 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Attaching a draft patch with tests.

--
Added file: http://bugs.python.org/file35346/fix_set_abc.diff

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



[issue20197] Support WebP image format detection in imghdr module

2014-05-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4fd17e28d4bf by Serhiy Storchaka in branch 'default':
Issue #20197: Added support for the WebP image type in the imghdr module.
http://hg.python.org/cpython/rev/4fd17e28d4bf

--
nosy: +python-dev

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



[issue20197] Support WebP image format detection in imghdr module

2014-05-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your contribution Fabrice and Claudiu.

--
resolution:  - fixed
stage: commit review - resolved
status: open - closed

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



[issue21574] Port image types detections from PIL to the imghdr module

2014-05-25 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

It would be good to add support of all image types which are supported in PIL 
to the imghdr module.

--
components: Library (Lib)
keywords: easy
messages: 219078
nosy: Claudiu.Popa, effbot, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: Port image types detections from PIL to the imghdr module
type: enhancement
versions: Python 3.5

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



[issue21574] Port image types detections from PIL to the imghdr module

2014-05-25 Thread Claudiu.Popa

Claudiu.Popa added the comment:

Sounds good, I'll create a patch.

--

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



[issue19925] Add unit test for spwd module

2014-05-25 Thread Serhiy Storchaka

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


--
assignee:  - serhiy.storchaka
nosy: +serhiy.storchaka
type:  - enhancement
versions: +Python 2.7, Python 3.5

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



[issue18918] help('FILES') finds no documentation

2014-05-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3fa76139c908 by Serhiy Storchaka in branch '3.4':
Issue #18918: Removed non-existing topic from a list of available topics.
http://hg.python.org/cpython/rev/3fa76139c908

New changeset e5bac5b2f38d by Serhiy Storchaka in branch 'default':
Issue #18918: Removed non-existing topic from a list of available topics.
http://hg.python.org/cpython/rev/e5bac5b2f38d

--
nosy: +python-dev

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



[issue18918] help('FILES') finds no documentation

2014-05-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Fixed in Python 3. Thanks Claudiu.

But it is not clear why this topic is absent in 2.7.

--
nosy: +serhiy.storchaka
versions:  -Python 3.3, Python 3.4

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



[issue19925] Add unit test for spwd module

2014-05-25 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Thanks, Serhiy, for the review! Here is the updated patch.

--
Added file: http://bugs.python.org/file35347/unittest_for_spwd_v3.patch

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



[issue19385] dbm.dumb should be consistent when the database is closed

2014-05-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There is no need to speed up methods which do IO (__getitem__, __setitem__, 
__delitem__). However method which works only with an index (keys, iterkeys, 
__contains__, __len__) can be optimized. In the __contains__ method an 
exception can be raised not only by nen-existent __contains__ of None, but from 
__hash__ or __eq__ methods of a key, so we should distinguish these cases.

--
stage: resolved - patch review
versions: +Python 3.4
Added file: http://bugs.python.org/file35348/issue19385_speed_2.patch

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



[issue20766] reference leaks in pdb

2014-05-25 Thread Xavier de Gaye

Xavier de Gaye added the comment:

An improved patch with a test case.

--
Added file: http://bugs.python.org/file35349/refleak_2.patch

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



[issue21575] list.sort() should show arguments in tutorial

2014-05-25 Thread Jan-Philip Gehrcke

New submission from Jan-Philip Gehrcke:

Currently, the tutorial for the list sort method does not show allowed 
arguments:


list.sort()
Sort the items of the list in place.

(see e.g. https://docs.python.org/3.4/tutorial/datastructures.html)

Is there a reason why we do not show the arguments there? For simplicity? One 
should note that a web search for Python's list methods ranks that page pretty 
high. We could list the defaults, as in the built-in help:

 L.sort(cmp=None, key=None, reverse=False)

And could link to https://docs.python.org/2/library/functions.html#sorted for 
an explanation.

--
assignee: docs@python
components: Documentation
messages: 219085
nosy: docs@python, eric.araujo, ezio.melotti, georg.brandl, jgehrcke
priority: normal
severity: normal
status: open
title: list.sort() should show arguments in tutorial
versions: Python 2.7, Python 3.4, Python 3.5

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



[issue21565] multiprocessing: use contex-manager protocol for synchronization primitives

2014-05-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9724eb19f6d0 by Charles-François Natali in branch 'default':
Issue #21565: multiprocessing: use contex-manager protocol for synchronization
http://hg.python.org/cpython/rev/9724eb19f6d0

--
nosy: +python-dev

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



[issue19925] Add unit test for spwd module

2014-05-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c35274fe5b35 by Serhiy Storchaka in branch '2.7':
Issue #19925: Added tests for the spwd module. Original patch by Vajrasky Kok.
http://hg.python.org/cpython/rev/c35274fe5b35

New changeset 9bdbe0b08dff by Serhiy Storchaka in branch '3.4':
Issue #19925: Added tests for the spwd module. Original patch by Vajrasky Kok.
http://hg.python.org/cpython/rev/9bdbe0b08dff

New changeset 4b187f5aa960 by Serhiy Storchaka in branch 'default':
Issue #19925: Added tests for the spwd module. Original patch by Vajrasky Kok.
http://hg.python.org/cpython/rev/4b187f5aa960

--
nosy: +python-dev

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



[issue21561] help() on enum34 enumeration class creates only a dummy documentation

2014-05-25 Thread Andy Maier

Andy Maier added the comment:

The pydoc.py of Python 3.4 that supposedly has been fixed has a lot of changes 
compared to 2.7, but the place where I applied my fix in TextDoc.docclass() 
is unchanged.

So it seems that my fix should be regarded only to be a quick fix, and the real 
fix would be somewhere in the 3.4 pydoc.py. I tried to understand the changes 
but gave up after a while. My quick fix (with a better text than one that 
contains TBD) is still better than not having it fixed, but more ideally the 
real fix should be rolled back to the 2.7 pydoc.py.

Is there anything else I can do to help with this bug?

--

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



[issue19925] Add unit test for spwd module

2014-05-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Committed with some changes. geteuid() is used instead getuid(), and checked 
that os.geteuid exists (see test_shutil). Checked deprecated attributes sp_nam 
and sp_pwd. Added tests for the calling getspnam() with wrong number of 
arguments and with bytes (on 3.x) or unicode (2.7) name.

Thank you Vajrasky for your contribution.

--
resolution:  - fixed
stage:  - resolved
status: open - closed

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



[issue21576] Overwritten (custom) uuid inside dictionary

2014-05-25 Thread beta

New submission from beta:

Results:
Block: 2d = {'Blocks': 3, 'Name': 'Fregatten', 'uuid': 0} same as {'Blocks': 3, 
'Name': 'Fregatten', 'uuid': 0}
Block: 2e = {'Blocks': 3, 'Name': 'Fregatten', 'uuid': 0} same as {'Blocks': 3, 
'Name': 'Fregatten', 'uuid': 0}
Block: 2f = {'Blocks': 3, 'Name': 'Fregatten', 'uuid': 0} same as {'Blocks': 3, 
'Name': 'Fregatten', 'uuid': 0}
Block: 8c = {'Blocks': 2, 'Name': 'Mijnenveger', 'uuid': 1} same as {'Blocks': 
2, 'Name': 'Mijnenveger', 'uuid': 1}
Block: 8d = {'Blocks': 2, 'Name': 'Mijnenveger', 'uuid': 1} same as {'Blocks': 
2, 'Name': 'Mijnenveger', 'uuid': 1}
Block: 4e = {'Blocks': 4, 'Name': 'Kruiser', 'uuid': 2} same as {'Blocks': 4, 
'Name': 'Kruiser', 'uuid': 2}
Block: 4f = {'Blocks': 4, 'Name': 'Kruiser', 'uuid': 2} same as {'Blocks': 4, 
'Name': 'Kruiser', 'uuid': 2}
Block: 4g = {'Blocks': 4, 'Name': 'Kruiser', 'uuid': 2} same as {'Blocks': 4, 
'Name': 'Kruiser', 'uuid': 2}
Block: 4h = {'Blocks': 4, 'Name': 'Kruiser', 'uuid': 2} same as {'Blocks': 4, 
'Name': 'Kruiser', 'uuid': 2}
Block: 6d = {'Blocks': 2, 'Name': 'Mijnenveger', 'uuid': 3} same as {'Blocks': 
2, 'Name': 'Mijnenveger', 'uuid': 3}
Block: 6e = {'Blocks': 2, 'Name': 'Mijnenveger', 'uuid': 3} same as {'Blocks': 
2, 'Name': 'Mijnenveger', 'uuid': 3}
Block: d3 = {'Blocks': 3, 'Name': 'Fregatten', 'uuid': 4} same as {'Blocks': 3, 
'Name': 'Fregatten', 'uuid': 4}
Block: d4 = {'Blocks': 3, 'Name': 'Fregatten', 'uuid': 4} same as {'Blocks': 3, 
'Name': 'Fregatten', 'uuid': 4}
Block: d5 = {'Blocks': 3, 'Name': 'Fregatten', 'uuid': 4} same as {'Blocks': 3, 
'Name': 'Fregatten', 'uuid': 4}
Block: 10h = {'Blocks': 3, 'Name': 'Fregatten', 'uuid': 5} same as {'Blocks': 
3, 'Name': 'Fregatten', 'uuid': 5}
Block: 10i = {'Blocks': 3, 'Name': 'Fregatten', 'uuid': 5} same as {'Blocks': 
3, 'Name': 'Fregatten', 'uuid': 5}
Block: 10j = {'Blocks': 3, 'Name': 'Fregatten', 'uuid': 5} same as {'Blocks': 
3, 'Name': 'Fregatten', 'uuid': 5}
Block: j3 = {'Blocks': 4, 'Name': 'Kruiser', 'uuid': 6} same as {'Blocks': 4, 
'Name': 'Kruiser', 'uuid': 6}
Block: j4 = {'Blocks': 4, 'Name': 'Kruiser', 'uuid': 6} same as {'Blocks': 4, 
'Name': 'Kruiser', 'uuid': 6}
Block: j5 = {'Blocks': 4, 'Name': 'Kruiser', 'uuid': 6} same as {'Blocks': 4, 
'Name': 'Kruiser', 'uuid': 6}
Block: j6 = {'Blocks': 4, 'Name': 'Kruiser', 'uuid': 6} same as {'Blocks': 4, 
'Name': 'Kruiser', 'uuid': 6}
Block: 10d = {'Blocks': 4, 'Name': 'Kruiser', 'uuid': 7} same as {'Blocks': 4, 
'Name': 'Kruiser', 'uuid': 7}
Block: 10e = {'Blocks': 4, 'Name': 'Kruiser', 'uuid': 7} same as {'Blocks': 4, 
'Name': 'Kruiser', 'uuid': 7}
Block: 10f = {'Blocks': 4, 'Name': 'Kruiser', 'uuid': 7} same as {'Blocks': 4, 
'Name': 'Kruiser', 'uuid': 7}
Block: 10g = {'Blocks': 4, 'Name': 'Kruiser', 'uuid': 7} same as {'Blocks': 4, 
'Name': 'Kruiser', 'uuid': 7}

Actually SetPositions = {} result:
{   '10d': {'Blocks': 4, 'Name': 'Kruiser', 'uuid': 7},
'10e': {'Blocks': 4, 'Name': 'Kruiser', 'uuid': 7},
'10f': {'Blocks': 4, 'Name': 'Kruiser', 'uuid': 7},
'10g': {'Blocks': 4, 'Name': 'Kruiser', 'uuid': 7},
'10h': {'Blocks': 3, 'Name': 'Fregatten', 'uuid': 5},
'10i': {'Blocks': 3, 'Name': 'Fregatten', 'uuid': 5},
'10j': {'Blocks': 3, 'Name': 'Fregatten', 'uuid': 5},
'2d': {'Blocks': 3, 'Name': 'Fregatten', 'uuid': 5},
'2e': {'Blocks': 3, 'Name': 'Fregatten', 'uuid': 5},
'2f': {'Blocks': 3, 'Name': 'Fregatten', 'uuid': 5},
'4e': {'Blocks': 4, 'Name': 'Kruiser', 'uuid': 7},
'4f': {'Blocks': 4, 'Name': 'Kruiser', 'uuid': 7},
'4g': {'Blocks': 4, 'Name': 'Kruiser', 'uuid': 7},
'4h': {'Blocks': 4, 'Name': 'Kruiser', 'uuid': 7},
'6d': {'Blocks': 2, 'Name': 'Mijnenveger', 'uuid': 3},
'6e': {'Blocks': 2, 'Name': 'Mijnenveger', 'uuid': 3},
'8c': {'Blocks': 2, 'Name': 'Mijnenveger', 'uuid': 3},
'8d': {'Blocks': 2, 'Name': 'Mijnenveger', 'uuid': 3},
'd3': {'Blocks': 3, 'Name': 'Fregatten', 'uuid': 5},
'd4': {'Blocks': 3, 'Name': 'Fregatten', 'uuid': 5},
'd5': {'Blocks': 3, 'Name': 'Fregatten', 'uuid': 5},
'j3': {'Blocks': 4, 'Name': 'Kruiser', 'uuid': 7},
'j4': {'Blocks': 4, 'Name': 'Kruiser', 'uuid': 7},
'j5': {'Blocks': 4, 'Name': 'Kruiser', 'uuid': 7},
'j6': {'Blocks': 4, 'Name': 'Kruiser', 'uuid': 7}}

uuid are overwritten, but where? It seems like a Python bug, but don't really 
know to be sure, so sorry if it isn't one.

--
files: 1.py
messages: 219090
nosy: beta990
priority: normal
severity: normal
status: open
title: Overwritten (custom) uuid inside dictionary
versions: Python 3.4
Added file: http://bugs.python.org/file35350/1.py

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



[issue8743] set() operators don't work with collections.Set instances

2014-05-25 Thread Nick Coghlan

Nick Coghlan added the comment:

Ah, interesting - I completely missed the comparison operators in my patch and 
tests. Your version looks good to me, though.

That looks like a patch against 2.7 - do you want to add 2.7  3.4 back to the 
list of target versions for the fix?

--

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



[issue17679] sysconfig generation uses some env variables multiple times

2014-05-25 Thread Florent Rougon

Changes by Florent Rougon frou...@users.sourceforge.net:


--
nosy: +frougon

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



[issue21343] os.path.relpath returns inconsistent types

2014-05-25 Thread Matt Bachmann

Matt Bachmann added the comment:

There is a difference! '.' is a bytes string and u'.' is a unicode one! 

I found this problem because I work on a project that supports both python2 and 
python3.

In python3 I pass in unicode I get back unicode. In python2.7 I pass in unicode 
and I get back a bytes string. We need to ensure that all data in the system is 
unicode. 

Under 2.7 I get unicode sometimes and bytes other times so I need to do this 
ugly check 

root_rel_path = os.path.relpath(self._cwd, self._root)
if isinstance(root_rel_path, six.binary_type):
root_rel_path = root_rel_path.decode()

in order to ensure that my string is once again of the correct type.

--

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



[issue21565] multiprocessing: use contex-manager protocol for synchronization primitives

2014-05-25 Thread Charles-François Natali

Charles-François Natali added the comment:

Committed (I've added a versionchanged as suggested by Antoine), closing.

--
resolution:  - fixed
stage: patch review - resolved
status: open - closed

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



[issue21343] os.path.relpath returns inconsistent types

2014-05-25 Thread Matt Bachmann

Matt Bachmann added the comment:

Perhaps this is the bug I should be filing but here is why this comes up for 
me. 

I get different output from this function if I pass in two types.

On my machine:
os.path.relpath(u'test_srcl.txt', u'.') returns u'test_src.txt'
os.path.relpath(u'test_srcl.txt', '.') returns 
u'../../Users/bachmann/Code/diff-cover/diff_cover/tests/fixtures/test_src.txt'

I make a couple calls to this function, if the first call gives me back a byte 
string and I pass it to the second call I get the incorrect result. So I need 
to decode.

If the function always gave back the same type as I gave it I would not have 
this issue.

--

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



[issue18381] unittest warnings counter

2014-05-25 Thread Berker Peksag

Berker Peksag added the comment:

I get a test failure when I run the test suite with unittest.patch:

test_Exit (unittest.test.test_program.Test_TestProgram) ... test test_unittest 
crashed -- Traceback (most recent call last):
  File /home/berker/projects/cpython-default/Lib/test/regrtest.py, line 1278, 
in runtest_inner
test_runner()
  File /home/berker/projects/cpython-default/Lib/test/test_unittest.py, line 
8, in test_main
support.run_unittest(unittest.test.suite())
  File /home/berker/projects/cpython-default/Lib/test/support/__init__.py, 
line 1764, in run_unittest
_run_suite(suite)
  File /home/berker/projects/cpython-default/Lib/test/support/__init__.py, 
line 1730, in _run_suite
result = runner.run(suite)
  File /home/berker/projects/cpython-default/Lib/unittest/runner.py, line 
178, in run
test(result)
  File /home/berker/projects/cpython-default/Lib/unittest/suite.py, line 87, 
in __call__
return self.run(*args, **kwds)
  File /home/berker/projects/cpython-default/Lib/unittest/suite.py, line 125, 
in run
test(result)
  File /home/berker/projects/cpython-default/Lib/unittest/suite.py, line 87, 
in __call__
return self.run(*args, **kwds)
  File /home/berker/projects/cpython-default/Lib/unittest/suite.py, line 125, 
in run
test(result)
  File /home/berker/projects/cpython-default/Lib/unittest/suite.py, line 87, 
in __call__
return self.run(*args, **kwds)
  File /home/berker/projects/cpython-default/Lib/unittest/suite.py, line 125, 
in run
test(result)
  File /home/berker/projects/cpython-default/Lib/unittest/suite.py, line 87, 
in __call__
return self.run(*args, **kwds)
  File /home/berker/projects/cpython-default/Lib/unittest/suite.py, line 125, 
in run
test(result)
  File /home/berker/projects/cpython-default/Lib/unittest/case.py, line 647, 
in __call__
return self.run(*args, **kwds)
  File /home/berker/projects/cpython-default/Lib/unittest/case.py, line 597, 
in run
testMethod()
  File 
/home/berker/projects/cpython-default/Lib/unittest/test/test_program.py, line 
119, in test_Exit
testLoader=self.FooBarLoader())
  File /home/berker/projects/cpython-default/Lib/unittest/case.py, line 726, 
in assertRaises
return context.handle('assertRaises', callableObj, args, kwargs)
  File /home/berker/projects/cpython-default/Lib/unittest/case.py, line 173, 
in handle
callable_obj(*args, **kwargs)
  File /home/berker/projects/cpython-default/Lib/unittest/main.py, line 93, 
in __init__
self.runTests()
  File /home/berker/projects/cpython-default/Lib/unittest/main.py, line 244, 
in runTests
self.result = testRunner.run(self.test)
  File /home/berker/projects/cpython-default/Lib/unittest/runner.py, line 
178, in run
test(result)
  File /home/berker/projects/cpython-default/Lib/unittest/suite.py, line 87, 
in __call__
return self.run(*args, **kwds)
  File /home/berker/projects/cpython-default/Lib/unittest/suite.py, line 125, 
in run
test(result)
  File /home/berker/projects/cpython-default/Lib/unittest/suite.py, line 87, 
in __call__
return self.run(*args, **kwds)
  File /home/berker/projects/cpython-default/Lib/unittest/suite.py, line 125, 
in run
test(result)
  File /home/berker/projects/cpython-default/Lib/unittest/case.py, line 647, 
in __call__
return self.run(*args, **kwds)
  File /home/berker/projects/cpython-default/Lib/unittest/case.py, line 597, 
in run
testMethod()
  File 
/home/berker/projects/cpython-default/Lib/unittest/test/test_program.py, line 
60, in testFail
assert False
AssertionError

The new patch (see issue18381.diff) fixes that failure. Other changes:

* Added documentation
* Added a test case for addWarning and TestResult.warnings
* Added print warning feature

--
nosy: +berker.peksag
versions: +Python 3.5 -Python 3.4
Added file: http://bugs.python.org/file35351/issue18381.diff

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



[issue21477] Idle: improve idle_test.htest

2014-05-25 Thread Saimadhav Heblikar

Saimadhav Heblikar added the comment:

Modifications in htest-25052014.diff

1. ClassBrowser, PathBrowser, EditorWindow no longer close parent when closed

2. Sample code in _color_delegator changed to string, instead of reading from 
file.

3. String text change for Tooltip.

4.  Adds htest for FormatParagraph, Percolator, EditorWindow(rather uncomment's 
spec),  StackViewer, KeyBinding

5. Modification to run based on review comments at 
http://bugs.python.org/review/21477/diff/11937/Lib/idlelib/idle_test/htest.py

6. Other cosmetic changes to spec string 'msg' text.

When this diff(subject to passing review and feedback) is pushed, I will make a 
corresponding patch for 2.7

--
Added file: http://bugs.python.org/file35352/htest-25052014.diff

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



[issue21343] os.path.relpath returns inconsistent types

2014-05-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

In Python 2 str is coerced to unicode, so most functions should return the same 
(or compatible) result for str and unicode argument if it contains only 7-bit 
ASCII characters. Of course there are several obvious exceptions, such as 
type() or repr(). And presumably there are several bugs.

Apparently the actual bug in your case is that 
os.path.relpath(u'test_srcl.txt', u'.') and os.path.relpath(u'test_srcl.txt', 
'.') return totally different results.

What are os.getcwd(), os.getcwdu(), ntpath.abspath(ntpath.normpath(p)) for p in 
[u'test_srcl.txt', 'test_srcl.txt', u'.', '.'] in your case?

--

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



[issue8743] set() operators don't work with collections.Set instances

2014-05-25 Thread Raymond Hettinger

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


--
versions: +Python 2.7, Python 3.4

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



[issue8743] set() operators don't work with collections.Set instances

2014-05-25 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Adding tests for non-set iterables as suggested by Serhiy.

--
Added file: http://bugs.python.org/file35353/fix_set_abc2.diff

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



[issue10203] sqlite3.Row doesn't support sequence protocol

2014-05-25 Thread Serhiy Storchaka

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


--
nosy: +serhiy.storchaka

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



[issue10203] sqlite3.Row doesn't support sequence protocol

2014-05-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM. Perhaps it is worth to add a test for negative indices (valid (-1) and 
invalid ( -length)).

--

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



[issue21560] gzip.write changes trailer ISIZE field before type checking - corrupted gz file after trying to write string

2014-05-25 Thread Serhiy Storchaka

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


--
stage: needs patch - test needed

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



[issue21575] list.sort() should show arguments in tutorial

2014-05-25 Thread Éric Araujo

Éric Araujo added the comment:

I assume it is on purpose that the tutorial does not show all methods with all 
their arguments.  It could overwhelm readers with too much information, and 
would also duplicate the full doc that’s in the reference.

A link from this tutorial page to the list reference (and maybe the sorting 
howto) could be a good addition.

--

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



[issue12972] Color prompt + readline

2014-05-25 Thread Damian

Damian added the comment:

Just a quick comment that I ran into this again, but turns out that it's not an 
issue with python. Rather, this is a quirk with how readline works...

https://stackoverflow.com/questions/9468435/look-how-to-fix-column-calculation-in-python-readline-if-use-color-prompt

Color prompts need to be wrapped by RL_PROMPT_START_IGNORE and 
RL_PROMPT_END_IGNORE.

--

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



  1   2   >