Re: Python best practices

2016-01-15 Thread Steven D'Aprano
On Sat, 16 Jan 2016 12:19 pm, gliesia...@gmail.com wrote: > Are there any good resources on python best practices? e.g., articles If you come from a Java background, you should read these two articles: http://dirtsimple.org/2004/12/python-is-not-java.html http://dirtsimple.org/2004/12/java-is-

Python best practices

2016-01-15 Thread gliesian66
Are there any good resources on python best practices? e.g., articles Thanks, Robert -- https://mail.python.org/mailman/listinfo/python-list

Re: wxpython strange behaviour

2016-01-15 Thread Shiva Upreti
On Saturday, January 16, 2016 at 4:39:12 AM UTC+5:30, Dietmar Schwertberger wrote: > On 15.01.2016 18:05, Shiva Upreti wrote: > > Please help me solve these issues. > Please decide first on which list or forum you want your questions to be > answered. Once people find out that you are asking the

Re: wxpython strange behaviour

2016-01-15 Thread Shiva Upreti
On Saturday, January 16, 2016 at 2:22:24 AM UTC+5:30, Mark Lawrence wrote: > On 15/01/2016 17:05, Shiva Upreti wrote: > > https://gist.github.com/anonymous/4baa67aafd04555eb4e6 > > > > I wrote the above code to display a toasterbox, and I didnt want it to > > display any frames on the screen, just

Re: wxpython strange behaviour

2016-01-15 Thread Shiva Upreti
On Friday, January 15, 2016 at 10:55:59 PM UTC+5:30, Ian wrote: > On Fri, Jan 15, 2016 at 10:05 AM, Shiva Upreti > wrote: > > https://gist.github.com/anonymous/4baa67aafd04555eb4e6 > > > > I wrote the above code to display a toasterbox, and I didnt want it to > > display any frames on the screen

Re: wxpython strange behaviour

2016-01-15 Thread Shiva Upreti
On Friday, January 15, 2016 at 10:55:59 PM UTC+5:30, Ian wrote: > On Fri, Jan 15, 2016 at 10:05 AM, Shiva Upreti > wrote: > > https://gist.github.com/anonymous/4baa67aafd04555eb4e6 > > > > I wrote the above code to display a toasterbox, and I didnt want it to > > display any frames on the screen

Re: wxpython strange behaviour

2016-01-15 Thread Shiva Upreti
On Friday, January 15, 2016 at 10:35:57 PM UTC+5:30, Shiva Upreti wrote: > https://gist.github.com/anonymous/4baa67aafd04555eb4e6 > > I wrote the above code to display a toasterbox, and I didnt want it to > display any frames on the screen, just a toasterbox. The problem with this > code is that

Re: wxpython strange behaviour

2016-01-15 Thread Dietmar Schwertberger
On 15.01.2016 18:05, Shiva Upreti wrote: Please help me solve these issues. Please decide first on which list or forum you want your questions to be answered. Once people find out that you are asking the same questions all over, the support will soon end. Regards, Dietmar -- https://mail.pyt

Re: Stop writing Python 4 incompatible code

2016-01-15 Thread Rick Johnson
On Friday, January 15, 2016 at 2:49:49 PM UTC-6, Gregory Ewing wrote: > > On 1/14/2016 3:55 PM, Rick Johnson wrote: > > > >> And if the owners refuse to sell, no problem, you offer > >> their customers the same services at bargain basement > >> discounts > > But... that would require you to devel

Deploy Python script on Apache using mod_wsgi

2016-01-15 Thread gupta . ashish65901
I am trying to deploy a python script on Apache using mod_wsgi. How to write the wsgi file for mod_wsgi ? I have asked my question here on http://stackoverflow.com/q/33314787/2350219 -- https://mail.python.org/mailman/listinfo/python-list

Re: Stop writing Python 4 incompatible code

2016-01-15 Thread Christopher Reimer
> On Jan 15, 2016, at 10:09 AM, Bernardo Sulzbach > wrote: > >> On Fri, Jan 15, 2016 at 3:02 PM, William Ray Wing wrote: >> >> What Micro$oft was actually sued for was worse. They would approach a small >> company: “We like your product/technology, we think we are interested in >> buying y

Re: Stop writing Python 4 incompatible code

2016-01-15 Thread Rick Johnson
On Friday, January 15, 2016 at 10:23:43 AM UTC-6, Emile van Sebille wrote: > Hmm, sounds like they're stealing plays from Micro$oft. "Stealing plays", hardly, they've stolen the *WHOLE* playbook! Corporations are like drug dealers: First they get you hooked on the free stuff, then they empty your

Re: Writing a stream of bytes

2016-01-15 Thread Gregory Ewing
Mark Lawrence wrote: On 15/01/2016 15:55, jmp wrote: Hi pyple ! In the UK it's "purple", a bit like "color" is wrong, it's "colour". Now, let's not make fun of people with English as a second language. That was obviously written with a Jäger accent: http://girlgenius.wikia.com/wiki/J%C3%A4

Re: Stop writing Python 4 incompatible code

2016-01-15 Thread Gregory Ewing
Chris Angelico wrote: and 3.X would wreak havoc with people's heads. The danger there is that 3.X would sound so cool (everything is cooler with an X in it) that nobody would want to move past it. So after 3.X we would get 3.X.1, ... and then 3.X.X.1, ... At some point people would start abbre

Re: Stop writing Python 4 incompatible code

2016-01-15 Thread Mark Lawrence
On 15/01/2016 18:53, Bernardo Sulzbach wrote: In the end, wouldn't contemporary economies benefit from more "legislative fairness" when it comes to technology-focused businesses? Maybe, but there is as much chance of that happening as Python 2.8 or RickedPython ever getting released, or the R

Re: wxpython strange behaviour

2016-01-15 Thread Mark Lawrence
On 15/01/2016 17:05, Shiva Upreti wrote: https://gist.github.com/anonymous/4baa67aafd04555eb4e6 I wrote the above code to display a toasterbox, and I didnt want it to display any frames on the screen, just a toasterbox. The problem with this code is that it runs fine when I run it the first ti

Re: Stop writing Python 4 incompatible code

2016-01-15 Thread Gregory Ewing
On 1/14/2016 3:55 PM, Rick Johnson wrote: And if the owners refuse to sell, no problem, you offer their customers the same services at bargain basement discounts But... that would require you to develop your own version, which is what you're trying to avoid! -- Greg -- https://mail.python.org

Re: Stop writing Python 4 incompatible code

2016-01-15 Thread Bernardo Sulzbach
On Fri, Jan 15, 2016 at 4:46 PM, Alister wrote: > > Doublespace disk compression springs to mind Does not ring a bell, I was not even born for MS-DOS 6.0. -- Bernardo Sulzbach -- https://mail.python.org/mailman/listinfo/python-list

Re: Stop writing Python 4 incompatible code

2016-01-15 Thread William Ray Wing
> On Jan 15, 2016, at 1:09 PM, Bernardo Sulzbach > wrote: > > On Fri, Jan 15, 2016 at 3:02 PM, William Ray Wing wrote: >> >> What Micro$oft was actually sued for was worse. They would approach a small >> company: “We like your product/technology, we think we are interested in >> buying you

Re: virtualenv: help me decide

2016-01-15 Thread Joel Goldstick
On Fri, Jan 15, 2016 at 1:17 PM, Paulo da Silva < p_s_d_a_s_i_l_v_a...@netcabo.pt> wrote: > Às 05:10 de 15-01-2016, Cameron Simpson escreveu: > > On 15Jan2016 03:37, Paulo da Silva > wrote: > ... > > Virtualenv is so easy to use that i suggest you > > just try it and see. > > > > Thank you very m

Re: Stop writing Python 4 incompatible code

2016-01-15 Thread Bernardo Sulzbach
In the end, wouldn't contemporary economies benefit from more "legislative fairness" when it comes to technology-focused businesses? -- https://mail.python.org/mailman/listinfo/python-list

Re: Stop writing Python 4 incompatible code

2016-01-15 Thread Alister
On 15/01/16 18:09, Bernardo Sulzbach wrote: On Fri, Jan 15, 2016 at 3:02 PM, William Ray Wing wrote: What Micro$oft was actually sued for was worse. They would approach a small company: “We like your product/technology, we think we are interested in buying you out, but we want to see your c

Re: Stop writing Python 4 incompatible code

2016-01-15 Thread Bernardo Sulzbach
On Fri, Jan 15, 2016 at 4:29 PM, Robin Koch wrote: > > Not necessarily. > See TeX. :-) > GvR does not like even an elegant 3.10 and you are implying that we are going to converge to something? LOL. -- Bernardo Sulzbach -- https://mail.python.org/mailman/listinfo/python-list

Re: Stop writing Python 4 incompatible code

2016-01-15 Thread Robin Koch
Am 14.01.2016 um 01:40 schrieb Bernardo Sulzbach: On Wed, Jan 13, 2016 at 10:10 PM, Steven D'Aprano wrote: (...) 4.0 (assuming there is one) Isn't it just a matter of time? Do you think it is even possible not to have Python 4 eventually? Not necessarily. See TeX. :-) -- Robin Koch -- h

Re: virtualenv: help me decide

2016-01-15 Thread Paulo da Silva
Às 05:10 de 15-01-2016, Cameron Simpson escreveu: > On 15Jan2016 03:37, Paulo da Silva wrote: ... > Virtualenv is so easy to use that i suggest you > just try it and see. > Thank you very much Cameron. Being easy, I'll give it a try with a small test program and see how it works. Paulo -- htt

Re: Stop writing Python 4 incompatible code

2016-01-15 Thread Bernardo Sulzbach
On Fri, Jan 15, 2016 at 3:02 PM, William Ray Wing wrote: > > What Micro$oft was actually sued for was worse. They would approach a small > company: “We like your product/technology, we think we are interested in > buying you out, but we want to see your code to be sure it is > modular/well-doc

Re: Stop writing Python 4 incompatible code

2016-01-15 Thread William Ray Wing
> On Jan 15, 2016, at 9:52 AM, Emile van Sebille wrote: > > On 1/14/2016 3:55 PM, Rick Johnson wrote: >> But, when you have almost infinitely deep pockets, like >> Google, you don't need to create *everything* yourself, no, >> you simply wait for someone else to build it, then wait a >> little l

Re: wxpython strange behaviour

2016-01-15 Thread Ian Kelly
On Fri, Jan 15, 2016 at 10:05 AM, Shiva Upreti wrote: > https://gist.github.com/anonymous/4baa67aafd04555eb4e6 > > I wrote the above code to display a toasterbox, and I didnt want it to > display any frames on the screen, just a toasterbox. The problem with this > code is that it runs fine when

wxpython strange behaviour

2016-01-15 Thread Shiva Upreti
https://gist.github.com/anonymous/4baa67aafd04555eb4e6 I wrote the above code to display a toasterbox, and I didnt want it to display any frames on the screen, just a toasterbox. The problem with this code is that it runs fine when I run it the first time, but when I run it next time it shows s

Re: Powerful perl paradigm I don't find in python

2016-01-15 Thread Nathan Hilterbrand
On 01/15/2016 04:24 AM, Charles T. Smith wrote: while ($str != $tail) { $str ~= s/^(head-pattern)//; use ($1); } IDK... maybe the OP is looking for something like this? : import re def do_something(matchobj): print("I found {}".format(matchobj.group(0))) return "" tail =

Re: Writing a stream of bytes

2016-01-15 Thread Peter Otten
Mark Lawrence wrote: > On 15/01/2016 15:55, jmp wrote: >> Hi pyple ! > > In the UK it's "purple", a bit like "color" is wrong, it's "colour". Yeah, you Brits are a deep purple. (I thought I had already exhausted my allowance for lame jokes yesterday. Seems I was wrong ;) -- https://mail.pyth

Re: Writing a stream of bytes

2016-01-15 Thread Mark Lawrence
On 15/01/2016 15:55, jmp wrote: Hi pyple ! In the UK it's "purple", a bit like "color" is wrong, it's "colour". I'd like to write a stream of bytes into a file. I'd like to use the struct (instead of bytearray) module because I will have to write more than bytes. If you'd like to clarify

Re: Writing a stream of bytes

2016-01-15 Thread jmp
On 01/15/2016 05:08 PM, Tim Chase wrote: [sorry, toddler on my lap clicked before I could type] import struct with open('toto', 'wb') as f: f.write(struct.pack('<4B', *[1,2,3,4])) This one does what you want. The problem resides in your check: I always end up with the following bytes on f

Re: Stop writing Python 4 incompatible code

2016-01-15 Thread Emile van Sebille
On 1/14/2016 3:55 PM, Rick Johnson wrote: But, when you have almost infinitely deep pockets, like Google, you don't need to create *everything* yourself, no, you simply wait for someone else to build it, then wait a little longer for them to market it successfully, and when it's jt starti

Re: Writing a stream of bytes

2016-01-15 Thread Tim Chase
[sorry, toddler on my lap clicked before I could type] > import struct > with open('toto', 'wb') as f: f.write(struct.pack('<4B', *[1,2,3,4])) This one does what you want. The problem resides in your check: > I always end up with the following bytes on file: > !hexdump toto > 000 0201 0403

Re: Writing a stream of bytes

2016-01-15 Thread Tim Chase
On 2016-01-15 16:55, jmp wrote: > Hi pyple ! > > > I'd like to write a stream of bytes into a file. I'd like to use > the struct (instead of bytearray) module because I will have to > write more than bytes. > > let's say I want a file with 4 bytes in that order: > > 01 02 03 04 > > None of the

Re: Writing a stream of bytes

2016-01-15 Thread BartC
On 15/01/2016 15:55, jmp wrote: Hi pyple ! I'd like to write a stream of bytes into a file. I'd like to use the struct (instead of bytearray) module because I will have to write more than bytes. let's say I want a file with 4 bytes in that order: 01 02 03 04 None of these work: import struc

Writing a stream of bytes

2016-01-15 Thread jmp
Hi pyple ! I'd like to write a stream of bytes into a file. I'd like to use the struct (instead of bytearray) module because I will have to write more than bytes. let's say I want a file with 4 bytes in that order: 01 02 03 04 None of these work: import struct with open('toto', 'wb') as

Re: Powerful perl paradigm I don't find in python

2016-01-15 Thread me
On 2016-01-15, Ulli Horlacher wrote: > Charles T. Smith wrote: >> while ($str != $tail) { >> $str ~= s/^(head-pattern)//; >> use ($1); >> } > > use() is illegal syntax in Perl. Actually it is not. OP is defnitely thinking of `use` as a placeholder for some general use of the value $1. I

Re: help

2016-01-15 Thread Dave Farrance
sam Rogers wrote: >  I have downloaded python 2.7  with no problem. It works. I am trying to get >pyserial to work. I have tried many different solutions. I am not  sure if it >works or not. How can I be sure? I am using windows 7.  I did not see any help >at python.org. Can you help? >PS my g

Re: Consistent error

2016-01-15 Thread iykeluvzu
On Sunday, January 3, 2016 at 5:59:30 PM UTC+1, cc.fe...@gmail.com wrote: > On Sunday, January 3, 2016 at 5:28:49 PM UTC+1, Ian wrote: > > On Sun, Jan 3, 2016 at 8:59 AM, wrote: > > > Thanks Chris! > > > Don't worry about the indent, will fix it > > > I've rewritten it to this- > > > > > > def g

Re: Powerful perl paradigm I don't find in python

2016-01-15 Thread Ulli Horlacher
Charles T. Smith wrote: > while ($str != $tail) { > $str ~= s/^(head-pattern)//; > use ($1); > } use() is illegal syntax in Perl. -- Ullrich Horlacher Server und Virtualisierung Rechenzentrum IZUS/TIK E-Mail: horlac...@tik.uni-stuttgart.de Universitaet Stuttgart

help

2016-01-15 Thread sam Rogers via Python-list
  I have downloaded python 2.7  with no problem. It works. I am trying to get pyserial to work. I have tried many different solutions. I am not  sure if it works or not. How can I be sure? I am using windows 7.  I did not see any help at python.org. Can you help? PS my goal is make this adafruit

Re: Powerful perl paradigm I don't find in python

2016-01-15 Thread Peter Otten
Charles T. Smith wrote: > What the original snippet does is parse *and consume* a string - actually, > to avoid maintaining a cursor traverse the string. The perl feature is > that substitute allows the found pattern to be replaced, but retains the > group after the expression is complete. That

Re: Powerful perl paradigm I don't find in python

2016-01-15 Thread Wolfgang Maier
On 15.01.2016 12:04, Charles T. Smith wrote: On Fri, 15 Jan 2016 11:42:24 +0100, Wolfgang Maier wrote: On 15.01.2016 10:43, Peter Otten wrote: Charles T. Smith wrote: while ($str != $tail) { $str ~= s/^(head-pattern)//; use ($1); } things = [] while some_str != tail:

Re: Turtle

2016-01-15 Thread Alister
On 14/01/16 22:22, Stallone Carl wrote: Dear sir/madam I am currently using python 3.5.0 and I have been trying to write a program using turtle but is not seem to be working. I have followed all tutarial on the web and when i compare it with my code my am duing everything the same way but it stil

Re: Turtle

2016-01-15 Thread Dave Farrance
Stallone Carl wrote: >I am currently using python 3.5.0 and I have been trying to write a program >using turtle but is not seem to be working. I have followed all tutarial on >the web and when i compare it with my code my am duing everything the same >way but it still don't seems to be working I

Py2 + PY3 transform a project (git submodule) to a clean package (with setup.py)

2016-01-15 Thread Gelonida N
Hi, I'm having a git project which contains functionality, that I use in many of my projects. For this posts sake let's call it mylib. if mylib is in the python path, it can be used for quite some convenience function in many of my projects. Examples: from mylib.logging import setupLogging

Re: Turtle

2016-01-15 Thread Bernardo Sulzbach
Maybe the tutorial is using Python 2. Always provide a SSCCE and, when it makes sense, the error message. -- https://mail.python.org/mailman/listinfo/python-list

Re: Stop writing Python 4 incompatible code

2016-01-15 Thread Bernardo Sulzbach
On Fri, Jan 15, 2016 at 2:56 AM, Chris Angelico wrote: > > We would have to skip a few - 3.I and 3.O are too confusing, and 3.X > would wreak havoc with people's heads. But then, so would 3.A... > > Let's do this. Wreak the havoc. Unleash the folly. Dispel the sanity! > There would also be 3.< 3

Re: problem

2016-01-15 Thread eryk sun
On Thu, Jan 14, 2016 at 7:03 PM, Andrew Ongko wrote: > At least, this way, the cmd doesn't close by itself. This phrasing may perpetuate a common misconception that the Windows console is (or is created by) cmd.exe. The cmd.exe shell is just another console client process, no different from pyth

Re: Powerful perl paradigm I don't find in python

2016-01-15 Thread Charles T. Smith
On Fri, 15 Jan 2016 11:42:24 +0100, Wolfgang Maier wrote: > On 15.01.2016 10:43, Peter Otten wrote: >> Charles T. Smith wrote: >> >>> while ($str != $tail) { >>> $str ~= s/^(head-pattern)//; >>> use ($1); >>> } >> > > things = [] > while some_str != tail: > m = re.match(patter

Re: Powerful perl paradigm I don't find in python

2016-01-15 Thread Charles T. Smith
On Fri, 15 Jan 2016 11:04:32 +, Charles T. Smith wrote: > capability, somehow, but that was apparently overlooked. For example, > by storing string state in the match object and having a *sub* method without > a string parameter. -- https://mail.python.org/mailman/listinfo/python-list

Re: Powerful perl paradigm I don't find in python

2016-01-15 Thread Wolfgang Maier
On 15.01.2016 10:43, Peter Otten wrote: Charles T. Smith wrote: while ($str != $tail) { $str ~= s/^(head-pattern)//; use ($1); } For those whose Perl's a little rusty: what does this do? A self-contained example might also be useful... Right, an explanation would certainly get yo

Re: ignoring or replacing white lines in a diff

2016-01-15 Thread Peter Otten
Adriaan Renting wrote: > - print line, did remove the extra newlines, but didn't get rid of the > blank lines. You mean you found that import fileinput for line in fileinput.FileInput("test.xml", inplace=True): if line.strip(): print line, does not remove all blank lines? If the f

Re: ignoring or replacing white lines in a diff

2016-01-15 Thread Adriaan Renting
Thanks for the various people that provided help. Peter Otten provided me with a working solution: I had to split the "-I '^[[:space:]]*$'" into two commands. cmd = ["diff", "-w", "-I", r"^[[:space:]]*$", "./xml/%s.xml" % name, "test.xml"] p = subprocess.Popen(cmd, stdin=open(

Re: Powerful perl paradigm I don't find in python

2016-01-15 Thread Peter Otten
Charles T. Smith wrote: > while ($str != $tail) { > $str ~= s/^(head-pattern)//; > use ($1); > } For those whose Perl's a little rusty: what does this do? A self-contained example might also be useful... -- https://mail.python.org/mailman/listinfo/python-list

Powerful perl paradigm I don't find in python

2016-01-15 Thread Charles T. Smith
while ($str != $tail) { $str ~= s/^(head-pattern)//; use ($1); } -- https://mail.python.org/mailman/listinfo/python-list

Turtle

2016-01-15 Thread Stallone Carl
Dear sir/madam I am currently using python 3.5.0 and I have been trying to write a program using turtle but is not seem to be working. I have followed all tutarial on the web and when i compare it with my code my am duing everything the same way but it still don't seems to be working I tryed repair

ERROR: IDLEs subprocesses did not make a connection...

2016-01-15 Thread Lee, Brandon
Hello! I am running into the following error and need some guidance. Please see the screenshots of the error, the files I currently have in the /python directory. As well as a link to a troubleshooting post on 'stackoverflow'. Thank you! -Brandon http://stackoverflow.com/questions/15888186/