Re: RE Module Performance

2013-07-29 Thread Antoon Pardon
Op 26-07-13 15:21, wxjmfa...@gmail.com schreef: Hint: To understand Unicode (and every coding scheme), you should understand "utf". The how and the *why*. No you don't. You are mixing the information with how the information is coded. utf is like base64, a way of coding the information that is

PyPI Notifier watches your requirements.txt files

2013-07-29 Thread Cenk Altı
Hello Python, I would like tell you about my project that I have built on my spare time. http://www.pypi-notifier.org/ Basically, you login with your GitHub account and select your Python repositories which have a requirements.txt file. Then, it starts to watch the dependencies listed in require

Re: RE Module Performance

2013-07-29 Thread Antoon Pardon
Op 28-07-13 20:19, Joshua Landau schreef: On 28 July 2013 09:45, Antoon Pardon mailto:antoon.par...@rece.vub.ac.be>> wrote: Op 27-07-13 20:21, wxjmfa...@gmail.com schreef: utf-8 or any (utf) never need and never spend their time in reencoding

Re: programming course

2013-07-29 Thread Chris Angelico
On Sat, Jul 27, 2013 at 1:28 PM, wrote: > Hi, > A good step by step easy book on Python is: "Start Here: Python 3x > Programming Made Fun and Easier," at http://www.quantum-sight.com This is a Usenet group and a mailing list, not a web forum. You do not need to dig up a dozen ancient threads in

Re: RE Module Performance

2013-07-29 Thread Antoon Pardon
Op 28-07-13 21:30, wxjmfa...@gmail.com schreef: To be short, this is *never* the FSR, always something else. Suggestion. Start by solving all these "micro-benchmarks". all the memory cases. It a good start, no? There is nothing to solve. Unicode doesn't force implementations to use the same

Re: RE Module Performance

2013-07-29 Thread Chris Angelico
On Sun, Jul 28, 2013 at 11:14 PM, Joshua Landau wrote: > GC does have sometimes severe impact in memory-constrained environments, > though. See http://sealedabstract.com/rants/why-mobile-web-apps-are-slow/, > about half-way down, specifically > http://sealedabstract.com/wp-content/uploads/2013/05/

Re: [Savoynet] G&S Opera Co: Pirates of Penzance

2013-07-29 Thread Eric S. Johansson
On Sun, 28 Jul 2013 19:49:07 -0400, Ethan Furman wrote: On 07/28/2013 10:57 AM, Chris Angelico wrote: . . . Okay, how did you get confused that this was a Python List question? ;) got_a_little_list["victim must be found"] = http://www.youtube.com/watch?v=1NLV24qTnlg -- http

MyOpenID.com no longer supported

2013-07-29 Thread Ethan Furman
Excerpt from http://meta.stackoverflow.com/q/190442/176681: Janrain no longer actively supports MyOpenID, and announced on Twitter that their users should proceed with caution. This decision was made by Janrain, [snip] I know the Python bug tracker allows MyOpenID logins; if that is your only

Re: MyOpenID.com no longer supported

2013-07-29 Thread Antoine Pitrou
Le Mon, 29 Jul 2013 00:55:53 -0700, Ethan Furman a écrit : > Excerpt from http://meta.stackoverflow.com/q/190442/176681: > > Janrain no longer actively supports MyOpenID, and announced on > Twitter that their users should proceed with caution. > > This decision was made by Janrain, [snip] > > I

substituting proxy

2013-07-29 Thread Robin Becker
Before attempting to reinvent the wheel has anyone created an http(s) proxy that can replace the content for specific requests. Context: I have access to the client's test site, but a lot of the requests are dynamic and save html complete etc etc doesn't work properly. In addition lots of the

Re: Configuraion to run pyhton script on ubuntu 12.04

2013-07-29 Thread Jaiky
Problem solved regarding cgi configuration on ubuntu 12.04 lts Concept:-) file used:-) /etc/apache2/httpd.conf /etc/apache2/sites-available/default steps done 1:-) in /etc/apache2/httpd.conf added line

Re: Critic my module

2013-07-29 Thread Schneider
Hi, lets uses the ls example: the way you do it now implies, that you search your PATH variable until it finds a program called 'ls'. So if we are able to change the PATH variable, and put out own 'ls' somewhere in the (new) paths, calling you ls() will execute whatever we want our own ls' t

Re: Critic my module

2013-07-29 Thread Devyn Collier Johnson
On 07/29/2013 06:58 AM, Schneider wrote: Hi, lets uses the ls example: the way you do it now implies, that you search your PATH variable until it finds a program called 'ls'. So if we are able to change the PATH variable, and put out own 'ls' somewhere in the (new) paths, calling you ls() wil

Generating HTML

2013-07-29 Thread Morten Guldager
'Aloha Friends! Still a bit new to python I'm afraid of choosing an obsolete route when it comes to generate some HTML in a Flask based micro web server. I come from the Perl side where I have been using HTML::Element with great success, and now I would like to know if something similar exists f

Re: FSR and unicode compliance - was Re: RE Module Performance

2013-07-29 Thread wxjmfauth
Le dimanche 28 juillet 2013 22:52:16 UTC+2, Steven D'Aprano a écrit : > On Sun, 28 Jul 2013 12:23:04 -0700, wxjmfauth wrote: > > > > > Do not forget that à la "FSR" mechanism for a non-ascii user is > > > *irrelevant*. > > > > You have been told repeatedly, Python's internals are *full* of A

Re: collections.Counter surprisingly slow

2013-07-29 Thread Stefan Behnel
Steven D'Aprano, 28.07.2013 22:51: > Calling Counter ends up calling essentially this code: > > for elem in iterable: > self[elem] = self.get(elem, 0) + 1 > > (although micro-optimized), where "iterable" is your data (lines). > Calling the get method has higher overhead than dict[key], that

Re: collections.Counter surprisingly slow

2013-07-29 Thread Joshua Landau
On 29 July 2013 07:25, Serhiy Storchaka wrote: > 28.07.13 22:59, Roy Smith написав(ла): > >The input is an 8.8 Mbyte file containing about 570,000 lines (11,000 >> unique strings). >> > > Repeat you tests with totally unique lines. Counter is about ½ the speed of defaultdict in that case (a

Re: FSR and unicode compliance - was Re: RE Module Performance

2013-07-29 Thread Chris Angelico
On Mon, Jul 29, 2013 at 12:43 PM, wrote: > Le dimanche 28 juillet 2013 22:52:16 UTC+2, Steven D'Aprano a écrit : > 3.2 timeit.timeit("r = dir(list)") > 22.300465007102908 > > 3.3 timeit.timeit("r = dir(list)") > 27.13981129541519 3.2: >>> len(dir(list)) 42 3.3: >>> len(dir(list)) 45

Re: collections.Counter surprisingly slow

2013-07-29 Thread Joshua Landau
On 29 July 2013 12:46, Stefan Behnel wrote: > Steven D'Aprano, 28.07.2013 22:51: > > Calling Counter ends up calling essentially this code: > > > > for elem in iterable: > > self[elem] = self.get(elem, 0) + 1 > > > > (although micro-optimized), where "iterable" is your data (lines). > > Calli

Re: FSR and unicode compliance - was Re: RE Module Performance

2013-07-29 Thread Heiko Wundram
Am 29.07.2013 13:43, schrieb wxjmfa...@gmail.com: 3.2 timeit.timeit("r = dir(list)") 22.300465007102908 3.3 timeit.timeit("r = dir(list)") 27.13981129541519 For the record, I do not put your example to contradict you. I was expecting such a result even before testing. Now, if you do not un

Re: Generating HTML

2013-07-29 Thread Burak Arslan
Hi, On 07/29/13 14:41, Morten Guldager wrote: > Something like: > table_struct = ['table', ['tr', ['td', {class=>"red"}, "this is > red"],['td', {class=>"blue"}, "this is not red"]]] > html = struct2html(table_struct) > > Suggestions? > See: http://lxml.de/lxmlhtml.html#creating-html-with-the

Re: FSR and unicode compliance - was Re: RE Module Performance

2013-07-29 Thread Devyn Collier Johnson
On 07/29/2013 08:06 AM, Heiko Wundram wrote: Am 29.07.2013 13:43, schrieb wxjmfa...@gmail.com: 3.2 timeit.timeit("r = dir(list)") 22.300465007102908 3.3 timeit.timeit("r = dir(list)") 27.13981129541519 For the record, I do not put your example to contradict you. I was expecting such a res

AssertionError: Headers already set! Status: 500 Internal Server Error Content-Type: text/plain Content-Length: 59

2013-07-29 Thread Jaiky
learning web concpt in python wrote code in /usr/lib/cgi-bin/hello_world.py ### #!/usr/bin/env python import webapp2 form =""" http://www/google.com/search";> """ class MainPage(webapp2.RequestHa

Re: FSR and unicode compliance - was Re: RE Module Performance

2013-07-29 Thread wxjmfauth
Le lundi 29 juillet 2013 13:57:47 UTC+2, Chris Angelico a écrit : > On Mon, Jul 29, 2013 at 12:43 PM, wrote: > > > Le dimanche 28 juillet 2013 22:52:16 UTC+2, Steven D'Aprano a écrit : > > > 3.2 > > timeit.timeit("r = dir(list)") > > > 22.300465007102908 > > > > > > 3.3 > > timei

Re: PyQt5 and virtualenv problem

2013-07-29 Thread D. Xenakis
Answer here: http://stackoverflow.com/questions/1961997/is-it-possible-to-add-pyqt4-pyside-packages-on-a-virtualenv-sandbox -- http://mail.python.org/mailman/listinfo/python-list

Re: FSR and unicode compliance - was Re: RE Module Performance

2013-07-29 Thread wxjmfauth
Le dimanche 28 juillet 2013 19:36:00 UTC+2, Terry Reedy a écrit : > On 7/28/2013 11:52 AM, Michael Torrie wrote: > > > > > > 3. UTF-8 and UTF-16 encodings, being variable width encodings, mean that > > > slicing a string would be very very slow, > > > > Not necessarily so. See below. > > >

Re: FSR and unicode compliance - was Re: RE Module Performance

2013-07-29 Thread wxjmfauth
Le lundi 29 juillet 2013 13:57:47 UTC+2, Chris Angelico a écrit : > On Mon, Jul 29, 2013 at 12:43 PM, wrote: > > > Le dimanche 28 juillet 2013 22:52:16 UTC+2, Steven D'Aprano a écrit : > > > 3.2 > > timeit.timeit("r = dir(list)") > > > 22.300465007102908 > > > > > > 3.3 > > timei

Re: dynamic type returning NameError:

2013-07-29 Thread Tim O'Callaghan
On Monday, July 29, 2013 1:43:39 AM UTC-4, Steven D'Aprano wrote: > On Sun, 28 Jul 2013 18:38:10 -0700, Tim O'Callaghan wrote: > > > > > Hi, > > > > > > I hope that this hasn't been asked for the millionth time, so my > > > apologies if it has. > > [...] > > > I hope that this was clear en

Re: FSR and unicode compliance - was Re: RE Module Performance

2013-07-29 Thread Chris Angelico
On Mon, Jul 29, 2013 at 3:20 PM, wrote: >>c:\python32\pythonw -u "timitmod.py" > 15.258061416225663 >>Exit code: 0 >>c:\Python33\pythonw -u "timitmod.py" > 17.052203122286194 >>Exit code: 0 >>> len(dir(C)) Did you even think to check that before you posted timings? ChrisA -- http://mail.pytho

Unexpected results comparing float to Fraction

2013-07-29 Thread Steven D'Aprano
Comparing floats to Fractions gives unexpected results: # Python 3.3 py> from fractions import Fraction py> 1/3 == Fraction(1, 3) False but: py> 1/3 == float(Fraction(1, 3)) True I expected that float-to-Fraction comparisons would convert the Fraction to a float, but apparently they do the op

Re: Unexpected results comparing float to Fraction

2013-07-29 Thread Ian Kelly
On Mon, Jul 29, 2013 at 9:43 AM, Steven D'Aprano wrote: > Comparing floats to Fractions gives unexpected results: > > # Python 3.3 > py> from fractions import Fraction > py> 1/3 == Fraction(1, 3) > False > > but: > > py> 1/3 == float(Fraction(1, 3)) > True > > > I expected that float-to-Fraction c

Re: MyOpenID.com no longer supported

2013-07-29 Thread Ethan Furman
On 07/29/2013 02:11 AM, Antoine Pitrou wrote: Le Mon, 29 Jul 2013 00:55:53 -0700, Ethan Furman a écrit : Excerpt from http://meta.stackoverflow.com/q/190442/176681: Janrain no longer actively supports MyOpenID, and announced on Twitter that their users should proceed with caution. This decisi

Re: Unexpected results comparing float to Fraction

2013-07-29 Thread MRAB
On 29/07/2013 16:43, Steven D'Aprano wrote: Comparing floats to Fractions gives unexpected results: # Python 3.3 py> from fractions import Fraction py> 1/3 == Fraction(1, 3) False but: py> 1/3 == float(Fraction(1, 3)) True I expected that float-to-Fraction comparisons would convert the Fract

What do you do when a library is outdated?

2013-07-29 Thread Matt
I'm fairly new to python but have experience in other languages. What do you generally do when a library is outdated? I asked a question on a few forums and everyone has been pointing me to Mechanize, but it will not work with 3.3 What do you do? -- http://mail.python.org/mailman/listinfo/pyt

Re: how to package embedded python?

2013-07-29 Thread David M. Cotter
nooobody knw the trouble a s... -- http://mail.python.org/mailman/listinfo/python-list

Re: Unexpected results comparing float to Fraction

2013-07-29 Thread Chris Angelico
On Mon, Jul 29, 2013 at 5:09 PM, MRAB wrote: > I'm surprised that Fraction(1/3) != Fraction(1, 3); after all, floats > are approximate anyway, and the float value 1/3 is more likely to be > Fraction(1, 3) than Fraction(6004799503160661, 18014398509481984). At what point should it become Fraction(

Re: What do you do when a library is outdated?

2013-07-29 Thread Chris Angelico
On Mon, Jul 29, 2013 at 5:14 PM, Matt wrote: > I'm fairly new to python but have experience in other languages. What do you > generally do when a library is outdated? I asked a question on a few forums > and everyone has been pointing me to Mechanize, but it will not work with 3.3 > > What do yo

Re: FSR and unicode compliance - was Re: RE Module Performance

2013-07-29 Thread wxjmfauth
Le lundi 29 juillet 2013 16:49:34 UTC+2, Chris Angelico a écrit : > On Mon, Jul 29, 2013 at 3:20 PM, wrote: > > >>c:\python32\pythonw -u "timitmod.py" > > > 15.258061416225663 > > >>Exit code: 0 > > >>c:\Python33\pythonw -u "timitmod.py" > > > 17.052203122286194 > > >>Exit code: 0 > > >

Re: AssertionError: Headers already set! Status: 500 Internal Server Error Content-Type: text/plain Content-Length: 59

2013-07-29 Thread Terry Reedy
On 7/29/2013 8:55 AM, Jaiky wrote: learning web concpt in python wrote code in /usr/lib/cgi-bin/hello_world.py ### #!/usr/bin/env python import webapp2 This is an external package. form =""" http://www/google.com/

Re: What do you do when a library is outdated?

2013-07-29 Thread Matt
On Monday, July 29, 2013 12:34:08 PM UTC-4, Chris Angelico wrote: > On Mon, Jul 29, 2013 at 5:14 PM, Matt wrote: > > > I'm fairly new to python but have experience in other languages. What do > > you generally do when a library is outdated? I asked a question on a few > > forums and everyone ha

Re: Unexpected results comparing float to Fraction

2013-07-29 Thread MRAB
On 29/07/2013 17:20, Chris Angelico wrote: On Mon, Jul 29, 2013 at 5:09 PM, MRAB wrote: I'm surprised that Fraction(1/3) != Fraction(1, 3); after all, floats are approximate anyway, and the float value 1/3 is more likely to be Fraction(1, 3) than Fraction(6004799503160661, 18014398509481984).

Re: Unexpected results comparing float to Fraction

2013-07-29 Thread Ian Kelly
On Mon, Jul 29, 2013 at 10:20 AM, Chris Angelico wrote: > On Mon, Jul 29, 2013 at 5:09 PM, MRAB wrote: >> I'm surprised that Fraction(1/3) != Fraction(1, 3); after all, floats >> are approximate anyway, and the float value 1/3 is more likely to be >> Fraction(1, 3) than Fraction(6004799503160661,

Re: Unexpected results comparing float to Fraction

2013-07-29 Thread MRAB
On 29/07/2013 17:40, Ian Kelly wrote: On Mon, Jul 29, 2013 at 10:20 AM, Chris Angelico wrote: On Mon, Jul 29, 2013 at 5:09 PM, MRAB wrote: I'm surprised that Fraction(1/3) != Fraction(1, 3); after all, floats are approximate anyway, and the float value 1/3 is more likely to be Fraction(1, 3)

Re: Unexpected results comparing float to Fraction

2013-07-29 Thread Terry Reedy
On 7/29/2013 11:50 AM, Ian Kelly wrote: On Mon, Jul 29, 2013 at 9:43 AM, Steven D'Aprano wrote: Comparing floats to Fractions gives unexpected results: # Python 3.3 py> from fractions import Fraction py> 1/3 == Fraction(1, 3) False but: py> 1/3 == float(Fraction(1, 3)) True I expected that

Re: Unexpected results comparing float to Fraction

2013-07-29 Thread Chris Angelico
On Mon, Jul 29, 2013 at 5:40 PM, Ian Kelly wrote: > On Mon, Jul 29, 2013 at 10:20 AM, Chris Angelico wrote: >> On Mon, Jul 29, 2013 at 5:09 PM, MRAB wrote: >>> I'm surprised that Fraction(1/3) != Fraction(1, 3); after all, floats >>> are approximate anyway, and the float value 1/3 is more likely

Re: What do you do when a library is outdated?

2013-07-29 Thread Terry Reedy
On 7/29/2013 12:14 PM, Matt wrote: I'm fairly new to python but have experience in other languages. What do you generally do when a library is outdated? I asked a question on a few forums and everyone has been pointing me to Mechanize, but it will not work with 3.3 What do you do? Update it yo

Re: collections.Counter surprisingly slow

2013-07-29 Thread Ian Kelly
On Mon, Jul 29, 2013 at 5:49 AM, Joshua Landau wrote: > Also, couldn't Counter just extend from defaultdict? It could, but I expect the C helper function in 3.4 will be faster since it doesn't even need to call __missing__ in the first place. And the cost (both in terms of maintenance and run-tim

Re: Unexpected results comparing float to Fraction

2013-07-29 Thread Steven D'Aprano
On Mon, 29 Jul 2013 17:48:21 +0100, MRAB wrote: > On 29/07/2013 17:20, Chris Angelico wrote: >> On Mon, Jul 29, 2013 at 5:09 PM, MRAB >> wrote: >>> I'm surprised that Fraction(1/3) != Fraction(1, 3); after all, floats >>> are approximate anyway, and the float value 1/3 is more likely to be >>> Fr

Re: Unexpected results comparing float to Fraction

2013-07-29 Thread Steven D'Aprano
On Mon, 29 Jul 2013 13:08:20 -0400, Terry Reedy wrote: > In other words, there can be multiple unequal Franctions that have the > same float value: for instance, Fraction(1,3) and > Fraction(6004799503160661, 18014398509481984) > > > So from that standpoint it makes sense to me to cast to Fracti

Re: Unexpected results comparing float to Fraction

2013-07-29 Thread Ian Kelly
On Mon, Jul 29, 2013 at 11:04 AM, MRAB wrote: > On 29/07/2013 17:40, Ian Kelly wrote: >> At the point where the float is exactly equal to the value you get >> from the floating-point division 1/3. If it's some other float then >> the user didn't get there by entering 1/3, so it's not worth trying

Re: Unexpected results comparing float to Fraction

2013-07-29 Thread Rotwang
On 29/07/2013 17:40, Ian Kelly wrote: On Mon, Jul 29, 2013 at 10:20 AM, Chris Angelico wrote: On Mon, Jul 29, 2013 at 5:09 PM, MRAB wrote: I'm surprised that Fraction(1/3) != Fraction(1, 3); after all, floats are approximate anyway, and the float value 1/3 is more likely to be Fraction(1, 3)

Re: Unexpected results comparing float to Fraction

2013-07-29 Thread Rotwang
On 29/07/2013 17:20, Chris Angelico wrote: On Mon, Jul 29, 2013 at 5:09 PM, MRAB wrote: I'm surprised that Fraction(1/3) != Fraction(1, 3); after all, floats are approximate anyway, and the float value 1/3 is more likely to be Fraction(1, 3) than Fraction(6004799503160661, 18014398509481984).

Re: Critic my module

2013-07-29 Thread Lele Gaifax
This thread did not mention alternative and existing modules with (almost) the same goal, two come to mind: * https://pypi.python.org/pypi/sh * https://pypi.python.org/pypi/sarge bye, lele. -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad

Re: Unexpected results comparing float to Fraction

2013-07-29 Thread Grant Edwards
On 2013-07-29, MRAB wrote: > On 29/07/2013 17:40, Ian Kelly wrote: >> On Mon, Jul 29, 2013 at 10:20 AM, Chris Angelico wrote: >>> On Mon, Jul 29, 2013 at 5:09 PM, MRAB wrote: I'm surprised that Fraction(1/3) != Fraction(1, 3); after all, floats are approximate anyway, and the float val

Re: [python] email 8bit encoding

2013-07-29 Thread W. Trevor King
On Sun, Jul 28, 2013 at 04:41:27PM -0700, ru...@yahoo.com wrote: > How, using Python-3.3's email module, do I "flatten" (I think > that's the right term) a Message object to get utf-8 encoded > body with the headers: > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: 8bit > wh

Re: Critic my module

2013-07-29 Thread Devyn Collier Johnson
On 07/29/2013 02:36 PM, Lele Gaifax wrote: This thread did not mention alternative and existing modules with (almost) the same goal, two come to mind: * https://pypi.python.org/pypi/sh * https://pypi.python.org/pypi/sarge bye, lele. Thanks everyone for the feedback. Clearly, I should stop my p

timing issue: shutil.rmtree and os.makedirs

2013-07-29 Thread Tim
I have the following function (Python2.7 on FreeBSD) that results in an OSError. My intent is to pass it a directory name or path and if it exists, use shutil.rmtree to remove whatever is there (if it isn't a directory, try to unlink it); then use os.makedirs to create a new directory or path:

Re: Unexpected results comparing float to Fraction

2013-07-29 Thread Serhiy Storchaka
29.07.13 19:09, MRAB написав(ла): I'm surprised that Fraction(1/3) != Fraction(1, 3); after all, floats are approximate anyway, and the float value 1/3 is more likely to be Fraction(1, 3) than Fraction(6004799503160661, 18014398509481984). >>> def approximate_fraction(f): prev_numer, numer

Re: Unexpected results comparing float to Fraction

2013-07-29 Thread Steven D'Aprano
On Mon, 29 Jul 2013 17:20:27 +0100, Chris Angelico wrote: Fraction(0.3) > Fraction(5404319552844595, 18014398509481984) Fraction(0.33) > Fraction(5944751508129055, 18014398509481984) [...] Fraction(0.3) > Fraction(6004799503160661, 18014398509481984) > > Rounding of

Re: Unexpected results comparing float to Fraction

2013-07-29 Thread Ian Kelly
On Mon, Jul 29, 2013 at 12:16 PM, Rotwang wrote: > On 29/07/2013 17:40, Ian Kelly wrote: >> At the point where the float is exactly equal to the value you get >> from the floating-point division 1/3. > > > But the interpreter has no way of knowing that the value 1/3 that's been > passed to the Fra

Re: collections.Counter surprisingly slow

2013-07-29 Thread Serhiy Storchaka
29.07.13 20:19, Ian Kelly написав(ла): On Mon, Jul 29, 2013 at 5:49 AM, Joshua Landau wrote: Also, couldn't Counter just extend from defaultdict? It could, but I expect the C helper function in 3.4 will be faster since it doesn't even need to call __missing__ in the first place. I'm surpris

PEP8 79 char max

2013-07-29 Thread Devyn Collier Johnson
In Python programming, the PEP8 recommends limiting lines to a maximum of 79 characters because "There are still many devices around that are limited to 80 character lines" (http://www.python.org/dev/peps/pep-0008/#code-lay-out). What devices cannot handle 80 or more characters on a line? Would

import syntax

2013-07-29 Thread Devyn Collier Johnson
The PEP8 recommends importing like this: import os import re not like this: import os, re Why is that? Is there a performance advantage to one of the styles? Mahalo, Devyn Collier Johnson devyncjohn...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: import syntax

2013-07-29 Thread Joel Goldstick
On Mon, Jul 29, 2013 at 3:48 PM, Devyn Collier Johnson wrote: > The PEP8 recommends importing like this: > > import os > import re > > not like this: > > import os, re > > Why is that? Is there a performance advantage to one of the styles? > > > Mahalo, > > Devyn Collier Johnson > devyncjohn...@gm

Re: PEP8 79 char max

2013-07-29 Thread Joel Goldstick
On Mon, Jul 29, 2013 at 3:43 PM, Devyn Collier Johnson wrote: > In Python programming, the PEP8 recommends limiting lines to a maximum of 79 > characters because "There are still many devices around that are limited to > 80 character lines" (http://www.python.org/dev/peps/pep-0008/#code-lay-out).

Re: import syntax

2013-07-29 Thread Dave Angel
On 07/29/2013 03:48 PM, Devyn Collier Johnson wrote: The PEP8 recommends importing like this: import os import re not like this: import os, re Why is that? Is there a performance advantage to one of the styles? Pep 8 is not about performance, it's about readability. And unless the two l

Re: import syntax

2013-07-29 Thread Tim Chase
On 2013-07-29 15:48, Devyn Collier Johnson wrote: > The PEP8 recommends importing like this: > > import os > import re > > not like this: > > import os, re > > Why is that? Is there a performance advantage to one of the styles? While I don't believe there's much of a performance difference (if

Re: import syntax

2013-07-29 Thread Tim Chase
On 2013-07-29 16:09, Dave Angel wrote: > On 07/29/2013 03:48 PM, Devyn Collier Johnson wrote: > > The PEP8 recommends importing like this: > > > > import os > > import re > > > > not like this: > > > > import os, re > > I got a bit further, and if I'm only using a couple of functions > from the imp

Re: Unexpected results comparing float to Fraction

2013-07-29 Thread Steven D'Aprano
On Mon, 29 Jul 2013 18:04:19 +0100, MRAB wrote: > I thought that you're not meant to check for equality when using floats. Heavens no. You're only meant to *mostly* not check for equality using floats. As Miracle Max might say: "It just so happens that floats are only MOSTLY inexact. There's a

Re: import syntax

2013-07-29 Thread Devyn Collier Johnson
On 07/29/2013 04:20 PM, Tim Chase wrote: On 2013-07-29 16:09, Dave Angel wrote: On 07/29/2013 03:48 PM, Devyn Collier Johnson wrote: The PEP8 recommends importing like this: import os import re not like this: import os, re I got a bit further, and if I'm only using a couple of functions fr

Re: PEP8 79 char max

2013-07-29 Thread Devyn Collier Johnson
On 07/29/2013 04:08 PM, Joel Goldstick wrote: On Mon, Jul 29, 2013 at 3:43 PM, Devyn Collier Johnson wrote: In Python programming, the PEP8 recommends limiting lines to a maximum of 79 characters because "There are still many devices around that are limited to 80 character lines" (http://www.p

Re: PEP8 79 char max

2013-07-29 Thread Ed Leafe
On Jul 29, 2013, at 3:08 PM, Joel Goldstick wrote: >> Would following >> this recommendation improve script performance? > > Not performance, but human readability IMO, this isn't always the case. There are many lines of code that are broken up to meet the 79 character limit, and as a

Re: PEP8 79 char max

2013-07-29 Thread John Gordon
In Devyn Collier Johnson writes: > (http://www.python.org/dev/peps/pep-0008/#code-lay-out). What devices > cannot handle 80 or more characters on a line? For a start, older fixed-width dumb terminals and printers. And even some very new devices (tablet, smartphone) might have limited screen

Re: Unexpected results comparing float to Fraction

2013-07-29 Thread Ian Kelly
On Jul 29, 2013 1:37 PM, "Serhiy Storchaka" wrote: > > 29.07.13 19:09, MRAB написав(ла): > >> I'm surprised that Fraction(1/3) != Fraction(1, 3); after all, floats >> are approximate anyway, and the float value 1/3 is more likely to be >> Fraction(1, 3) than Fraction(6004799503160661, 180143985094

Re: Unexpected results comparing float to Fraction

2013-07-29 Thread Terry Reedy
On 7/29/2013 1:29 PM, Steven D'Aprano wrote: On Mon, 29 Jul 2013 13:08:20 -0400, Terry Reedy wrote: In other words, there can be multiple unequal Franctions that have the same float value: for instance, Fraction(1,3) and Fraction(6004799503160661, 18014398509481984) > So from that standpoint

Has anyone gotten Pyglet to work

2013-07-29 Thread Devyn Collier Johnson
I tried Pyglet in a Python3 and a Python2 script, but both fail. The error code is below and the script is attached. The 'boot.ogg' file is Ubuntu's default bootup sound. I got my code from this link (http://guzalexander.com/2012/08/17/playing-a-sound-with-python.html). collier@Nacho-Laptop:~$

Re: PEP8 79 char max

2013-07-29 Thread Terry Reedy
On 7/29/2013 3:43 PM, Devyn Collier Johnson wrote: In Python programming, the PEP8 recommends limiting lines to a maximum of 79 characters because "There are still many devices around that are limited to 80 character lines" "plus, limiting windows to 80 characters makes it possible to have sev

Re: PEP8 79 char max

2013-07-29 Thread Steven D'Aprano
On Mon, 29 Jul 2013 15:43:49 -0400, Devyn Collier Johnson wrote: > In Python programming, the PEP8 recommends limiting lines to a maximum > of 79 characters because "There are still many devices around that are > limited to 80 character lines" > (http://www.python.org/dev/peps/pep-0008/#code-lay-o

Re: Has anyone gotten Pyglet to work

2013-07-29 Thread Gary Herron
On 07/29/2013 01:56 PM, Devyn Collier Johnson wrote: I tried Pyglet in a Python3 and a Python2 script, but both fail. The error code is below and the script is attached. The 'boot.ogg' file is Ubuntu's default bootup sound. I got my code from this link (http://guzalexander.com/2012/08/17/playin

Re: Critic my module

2013-07-29 Thread Joshua Landau
On 29 July 2013 19:36, Lele Gaifax wrote: > This thread did not mention alternative and existing modules with > (almost) the same goal, two come to mind: > > * https://pypi.python.org/pypi/sh > * https://pypi.python.org/pypi/sarge Actually, I noted both those and plumbum. -- http://mail.python

Re: PEP8 79 char max

2013-07-29 Thread Skip Montanaro
For the purposes of limiting the length you need to scan between first and last column, I would recommend leaving the recommended line length to ~ 80 columns. Just for grins, I grabbed a non-computer book, Atul Gawande's "Checklist Manifesto," from the pile on my desk and counted the number of cha

Re: PEP8 79 char max

2013-07-29 Thread Steven D'Aprano
On Mon, 29 Jul 2013 15:18:59 -0500, Ed Leafe wrote: > On Jul 29, 2013, at 3:08 PM, Joel Goldstick > wrote: >> Not performance, but human readability > > IMO, this isn't always the case. There are many lines of code that are > broken up to meet the 79 character limit, and as a result

Re: Has anyone gotten Pyglet to work

2013-07-29 Thread Lee Harr
> $ ./pyglet.py > Traceback (most recent call last): >    File "./pyglet.py", line 2, in >      import pyglet >    File "/home/collier/pyglet.py", line 3, in >      song = pyglet.media.load('./boot.ogg') > AttributeError: 'module' object has no attribute 'media' Name your program something othe

Re: how to package embedded python?

2013-07-29 Thread Kevin Walzer
On 7/25/13 5:05 PM, David M. Cotter wrote: what must i include in my app package if i'm embedding python? i tried including *everything* in the "DLLs" directory, but my app still crashes as soon as i attempt to initialize python. this is on a system that does not have python installed, as most

Re: Has anyone gotten Pyglet to work

2013-07-29 Thread Steven D'Aprano
On Mon, 29 Jul 2013 16:56:06 -0400, Devyn Collier Johnson wrote: > collier@Nacho-Laptop:~$ ./pyglet.py Here you are running a module called pyglet, which I assume you wrote. > Traceback (most recent call last): >File "./pyglet.py", line 2, in > import pyglet And here you try to impor

Re: PEP8 79 char max

2013-07-29 Thread Steven D'Aprano
On Mon, 29 Jul 2013 16:24:51 -0400, Devyn Collier Johnson wrote: > So, I can have a script with large lines and not negatively influence > performance on systems that do not use punch cards? You'll negatively influence anyone who has to read, or edit, your code. Very likely including you. But n

Re: Bitwise Operations

2013-07-29 Thread Grant Edwards
On 2013-07-29, Devyn Collier Johnson wrote: > On Python3, how can I perform bitwise operations? For instance, I want > something that will 'and', 'or', and 'xor' a binary integer. http://www.google.com/search?q=python+bitwise+operations -- Grant Edwards grant.b.edwardsYo

Bitwise Operations

2013-07-29 Thread Devyn Collier Johnson
On Python3, how can I perform bitwise operations? For instance, I want something that will 'and', 'or', and 'xor' a binary integer. Mahalo, devyncjohn...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP8 79 char max

2013-07-29 Thread Terry Reedy
On 7/29/2013 5:01 PM, Terry Reedy wrote: On 7/29/2013 3:43 PM, Devyn Collier Johnson wrote: In Python programming, the PEP8 recommends limiting lines to a maximum of 79 characters because "There are still many devices around that are limited to 80 character lines" "plus, limiting windows to 80

Pyglet on Python3.x, problems

2013-07-29 Thread John Ladasky
Hi folks, For whatever reason, the pyglet package is getting a lot of attention on c.l.python these past few days. I am guilty of generating some of that potentially off-topic conversation myself. At the end of my last thread, I reported that I had found the pyglet-users newsgroup, and would

Re: PEP8 79 char max

2013-07-29 Thread Joshua Landau
On 29 July 2013 22:18, Skip Montanaro wrote: > For the purposes of limiting the length you need to scan between first > and last column, I would recommend leaving the recommended line length > to ~ 80 columns. > > Just for grins, I grabbed a non-computer book, Atul Gawande's > "Checklist Manifest

Re: Has anyone gotten Pyglet to work

2013-07-29 Thread Devyn Collier Johnson
On 07/29/2013 05:08 PM, Gary Herron wrote: On 07/29/2013 01:56 PM, Devyn Collier Johnson wrote: I tried Pyglet in a Python3 and a Python2 script, but both fail. The error code is below and the script is attached. The 'boot.ogg' file is Ubuntu's default bootup sound. I got my code from this lin

Re: PEP8 79 char max

2013-07-29 Thread Devyn Collier Johnson
On 07/29/2013 05:42 PM, Steven D'Aprano wrote: On Mon, 29 Jul 2013 16:24:51 -0400, Devyn Collier Johnson wrote: So, I can have a script with large lines and not negatively influence performance on systems that do not use punch cards? You'll negatively influence anyone who has to read, or edit

Re: PEP8 79 char max

2013-07-29 Thread Joshua Landau
On 29 July 2013 22:34, Steven D'Aprano wrote: > On Mon, 29 Jul 2013 15:18:59 -0500, Ed Leafe wrote: > > > On Jul 29, 2013, at 3:08 PM, Joel Goldstick > > wrote: > >> Not performance, but human readability > > > > IMO, this isn't always the case. There are many lines of code > that are > >

Re: import syntax

2013-07-29 Thread Joshua Landau
On 29 July 2013 21:23, Devyn Collier Johnson wrote: > > On 07/29/2013 04:20 PM, Tim Chase wrote: > >> On 2013-07-29 16:09, Dave Angel wrote: >> >>> On 07/29/2013 03:48 PM, Devyn Collier Johnson wrote: >>> The PEP8 recommends importing like this: import os import re no

Re: Has anyone gotten Pyglet to work

2013-07-29 Thread Steven D'Aprano
On Mon, 29 Jul 2013 18:22:02 -0400, Devyn Collier Johnson wrote: > Duh, thanks for the tip (^u^), but I still get an error (different > error). NOTE: this is all python2.7 code because Pyglet supposedly has > issues with Python3. [...] > Traceback (most recent call last): >File "./pymedia.py",

Re: Has anyone gotten Pyglet to work

2013-07-29 Thread Joshua Landau
On 29 July 2013 23:22, Devyn Collier Johnson wrote: > Duh, thanks for the tip (^u^), but I still get an error (different error). > NOTE: this is all python2.7 code because Pyglet supposedly has issues with > Python3. > > collier@Nacho-Laptop:~$ pip install pyglet > Downloading/unpacking pyglet >

Re: PEP8 79 char max

2013-07-29 Thread Ed Leafe
On Jul 29, 2013, at 5:30 PM, Devyn Collier Johnson wrote: > Evidently, it is personal preference. I prefer to read computer code like a > book (yes, I am a weirdo (^u^)). The only time I exced 79 characters is when > I write a set of commands that perform similar tasks. I do not make too many

Re: PEP8 79 char max

2013-07-29 Thread Rhodri James
On Mon, 29 Jul 2013 22:09:10 +0100, Steven D'Aprano wrote: On Mon, 29 Jul 2013 15:43:49 -0400, Devyn Collier Johnson wrote: In Python programming, the PEP8 recommends limiting lines to a maximum of 79 characters because "There are still many devices around that are limited to 80 character l

Re: Pyglet on Python3.x, problems

2013-07-29 Thread Joshua Landau
On 29 July 2013 23:04, John Ladasky wrote: > For whatever reason, the pyglet package is getting a lot of attention on > c.l.python these past few days. I am guilty of generating some of that > potentially off-topic conversation myself. At the end of my last thread, I > reported that I had found

  1   2   >