Re: OT: Entitlements [was Re: Python usage numbers]

2012-02-17 Thread Ian Kelly
On Fri, Feb 17, 2012 at 6:13 PM, Rick Johnson wrote: > > On Mon, Feb 13, 2012 at 7:23 PM, Ian Kelly > wrote: >> On Mon, Feb 13, 2012 at 2:01 PM, Rick Johnson >> I make a middle-class income and do not feel that I am anywhere near >> being "enslaved" by my income taxes, which amount to less than 1

Re: [OT]: Smartphones and Python?

2012-02-17 Thread Andrew Berg
On 2/17/2012 10:51 PM, 8 Dihedral wrote: > 在 2012年2月18日星期六UTC+8上午9时51分13秒,Michael Torrie写道: >> On 02/16/2012 10:25 PM, 8 Dihedral wrote: >> > Android is a customized linux OS used in mobile phones. I don't think >> > any linux systm has to be locked by JAVA or any JVM to run >> > applicatio

Re: [OT]: Smartphones and Python?

2012-02-17 Thread 88888 Dihedral
在 2012年2月18日星期六UTC+8上午9时51分13秒,Michael Torrie写道: > On 02/16/2012 10:25 PM, 8 Dihedral wrote: > > Android is a customized linux OS used in mobile phones. I don't think > > any linux systm has to be locked by JAVA or any JVM to run > > applications. > > Getting waaa off topic here, but... >

Re: [OT]: Smartphones and Python?

2012-02-17 Thread 88888 Dihedral
-- http://mail.python.org/mailman/listinfo/python-list

Re: Undoing character read from file

2012-02-17 Thread Dave Angel
On 02/17/2012 10:38 PM, Emeka wrote: Hello All, Say I have something like this: mfile = open("cc.txt", "rb") mcount = 0 mset = False while True: c = mfile.read(1) if c == "e" and mset is True and mcount == 0: print c mfile.seek(-1,1) mcount = 1 continue elif c == "e" and mse

Re: Undoing character read from file

2012-02-17 Thread Emeka
Hello All, Say I have something like this: mfile = open("cc.txt", "rb") mcount = 0 mset = False while True: c = mfile.read(1) if c == "e" and mset is True and mcount == 0: print c mfile.seek(-1,1) mcount = 1 continue elif c == "e" and mset is False and mcount == 0: print c

Re: Undoing character read from file

2012-02-17 Thread Emeka
Neil, Thanks. Could you throw a simple example? Regards, \Emeka On Fri, Feb 17, 2012 at 3:12 PM, Neil Cerutti wrote: > On 2012-02-16, MRAB wrote: > > On 16/02/2012 23:10, Emeka wrote: > >> Hello All, > >> > >> I know about seek and tell while using readline. What about if I am > >> using read

Re: OT: Entitlements [was Re: Python usage numbers]

2012-02-17 Thread Mark Lawrence
On 18/02/2012 02:13, Chris Angelico wrote: On Sat, Feb 18, 2012 at 12:13 PM, Rick Johnson wrote: Here is a list of taxes most everyone else will encounter: You forgot the Microsoft Tax and the Stupid Tax. ChrisA This is what I call a tax, some two miles from my home. http://www.bbc.co.uk

Re: OT: Entitlements [was Re: Python usage numbers]

2012-02-17 Thread Chris Angelico
On Sat, Feb 18, 2012 at 12:13 PM, Rick Johnson wrote: > Here is a list of taxes most everyone else will encounter: You forgot the Microsoft Tax and the Stupid Tax. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: [OT]: Smartphones and Python?

2012-02-17 Thread Michael Torrie
On 02/16/2012 10:25 PM, 8 Dihedral wrote: > Android is a customized linux OS used in mobile phones. I don't think > any linux systm has to be locked by JAVA or any JVM to run > applications. Getting waaa off topic here, but... I guess you aren't familiar with what Android is (which is iro

Re: OT: Entitlements [was Re: Python usage numbers]

2012-02-17 Thread Rick Johnson
On Feb 13, 7:37 pm, Chris Angelico wrote: > On Tue, Feb 14, 2012 at 11:39 AM, Rick Johnson > > wrote: > > # Py>=3.0 > > py> sum(earner.get_income(2012) for earner in earners2012) / > > len(earners2012) > > average_income > > > Once you exceed that amount you are robbing your fellow man. How can >

Re: OT: Entitlements [was Re: Python usage numbers]

2012-02-17 Thread Rick Johnson
On Mon, Feb 13, 2012 at 7:23 PM, Ian Kelly wrote: > On Mon, Feb 13, 2012 at 2:01 PM, Rick Johnson > I make a middle-class income and do not feel that I am anywhere near > being "enslaved" by my income taxes, which amount to less than 10% of > my gross income after deductions and credits. Ten per

Re: tkinter.Toplevel

2012-02-17 Thread Rick Johnson
On Feb 16, 8:39 pm, y...@zioup.com wrote: > With a tkinter.Toplevel, how can I "disable" the parent windown and all its > widget, in the same fashion as tkinter.messagebox? The answer lies within the tkSimpleDialog source code; which is pure python. Look in the __init__ method of Dialog class. My

Re: XSLT to Python script conversion?

2012-02-17 Thread Ross Ridge
Ross Ridge writes: > The XSLT language is one of the worst misuses of XML, which puts it way > beyond bad. Stefan Behnel wrote: >Clearly a matter of opinion. No. There's no excuse for using XML as the syntax of a language like XLST. Ross Ridge -- l/

Re: XSLT to Python script conversion?

2012-02-17 Thread Stefan Behnel
Ross Ridge, 17.02.2012 21:37: > Matej Cepl wrote: >> No, the strangness is not that bad (well, it is bad ... almost anything >> feels bad comparing to Python, to be honest, but not the reason I would >> give up; after all I spent couple of years with Javascript). > > The XSLT language is one of

Re: XSLT to Python script conversion?

2012-02-17 Thread Ross Ridge
Matej Cepl wrote: >No, the strangness is not that bad (well, it is bad ... almost anything >feels bad comparing to Python, to be honest, but not the reason I would >give up; after all I spent couple of years with Javascript). The XSLT language is one of the worst misuses of XML, which puts it

RE: OT: Entitlements [was Re: Python usage numbers]

2012-02-17 Thread Prasad, Ramit
>> They also don't need to put up with people who aren't seriously ill - I >> don't know how long your private appointments are, but here in the UK a >> standard doctor's appointment is 5-10 minutes. If they decide you're >> actually ill they may extend that. >Five to ten minutes? Is the doctor an

Re: signed to unsigned

2012-02-17 Thread Dave Angel
On 02/17/2012 02:22 PM, Brad Tilley wrote: 0x& -327681234 3967286062 Very nice! Thanks for that example. Unsigned long longs: 0x& -9151314442815602945 9295429630893948671L Or more generally, use modulo -13452324 % 2^64 -- DaveA -- http://mail.python.org/mailman/l

Re: signed to unsigned

2012-02-17 Thread Brad Tilley
> >>> 0x & -327681234 > > 3967286062 Very nice! Thanks for that example. Unsigned long longs: 0x & -9151314442815602945 9295429630893948671L -- http://mail.python.org/mailman/listinfo/python-list

Re: signed to unsigned

2012-02-17 Thread Brad Tilley
> Pack it as the actual type, then unpack it as the desired type: > > Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) > Type "help", "copyright", "credits" or "license" for more information.>>> > from struct import pack, unpack > >>> unpack('=I', pack('=i',-327681234)) > > (3967286062,) > > I wou

Re: signed to unsigned

2012-02-17 Thread Peter Otten
Brad Tilley wrote: > In C or C++, I can do this for integer conversion: > > unsigned int j = -327681234; // Notice this is signed. > > j will equal 3967286062. I thought with Python that I could use struct > to pack the signed int as an unsigned int, but that fails: > x = struct.pack(" Tra

Re: Python code file prototype

2012-02-17 Thread Bruce Eckel
>         Of course, since the OP was talking Windows... the #! line is > ignored no matter where it was Yes, but I use Windows, Mac and Linux so I'm searching for something universal. -- http://mail.python.org/mailman/listinfo/python-list

Re: signed to unsigned

2012-02-17 Thread Chris Rebert
On Fri, Feb 17, 2012 at 10:51 AM, Brad Tilley wrote: > In C or C++, I can do this for integer conversion: > > unsigned int j = -327681234; // Notice this is signed. > > j will equal 3967286062. I thought with Python that I could use struct > to pack the signed int as an unsigned int, but that fail

signed to unsigned

2012-02-17 Thread Brad Tilley
In C or C++, I can do this for integer conversion: unsigned int j = -327681234; // Notice this is signed. j will equal 3967286062. I thought with Python that I could use struct to pack the signed int as an unsigned int, but that fails: >>> x = struct.pack("", line 1, in struct.error: integer ou

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-17 Thread 88888 Dihedral
Check PY2EXE, PYREX and PSYChO. I must use these packages to relase commercial products with my own dll in c. -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-17 Thread Vinay Sajip
On Feb 17, 1:49 pm, Jean-Michel Pichavant wrote: > I can't use it though, I'm still using a vintage 2.5 version :-/ That's a shame. I chose 2.6 as a baseline for this package, because I need it to work on Python 2.x and 3.x with the same code base and minimal work, and that meant supporting Unic

Re: Python code file prototype

2012-02-17 Thread Grant Edwards
On 2012-02-17, John Gordon wrote: > In <66ea0353-02ee-4152-947a-97b44ff3e...@p7g2000yqk.googlegroups.com> Bruce > Eckel writes: > >> There's an option when you do this to insert default file contents, so >> I began searching the web for some kind of prototype Python file that >> would be appropr

Re: Python code file prototype

2012-02-17 Thread Ian Kelly
On Fri, Feb 17, 2012 at 9:20 AM, John Gordon wrote: > Here's what PyScripter inserts in a new python file: > >  #- >  # Name:        module1 >  # Purpose: >  # >  # Author:      $USERNAME >  # >  # Created:     $DATE >  # Copyrigh

Re: Python code file prototype

2012-02-17 Thread John Gordon
In <66ea0353-02ee-4152-947a-97b44ff3e...@p7g2000yqk.googlegroups.com> Bruce Eckel writes: > There's an option when you do this to insert default file contents, so > I began searching the web for some kind of prototype Python file that > would be appropriate to start with. I'm certain I've seen t

Python code file prototype

2012-02-17 Thread Bruce Eckel
I finally figured out how to set up the Windows explorer's right-click "new" so that it will create Python files. Here's how: http://superuser.com/questions/34704/windows-7-add-an-item-to-new-context-menu There's an option when you do this to insert default file contents, so I began searching the

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-17 Thread Jean-Michel Pichavant
Vinay Sajip wrote: Sarge, a cross-platform library which wraps the subprocess module in the standard library, has been released. What does it do? Sarge tries to make interfacing with external programs from your Python applications easier than just using subprocess alone. Sarge

Re: question about function pointer

2012-02-17 Thread 88888 Dihedral
在 2012年2月17日星期五UTC+8下午5时55分11秒,Nobody写道: > On Fri, 17 Feb 2012 16:53:00 +0900, Zheng Li wrote: > > > def method1(a = None): > > print a > > > > i can call it by > > method1(*(), **{'a' : 1}) > > > > I am just curious why it works and how it works? > > and what do *() and **{'a' : 1} mean? >

Re: Undoing character read from file

2012-02-17 Thread Neil Cerutti
On 2012-02-16, MRAB wrote: > On 16/02/2012 23:10, Emeka wrote: >> Hello All, >> >> I know about seek and tell while using readline. What about if I am >> using read, and I want to undo the last character I just read(to return >> it back to the stream). How do I achieve this? >> > Try: > > f.s

Re: Generating class definitions at runtime in memory from XSD or JSON

2012-02-17 Thread Stefan Behnel
Stodge, 17.02.2012 02:15: > Does anyone know of a library to generate class definitions in memory, > at runtime, from XSD or JSON? The question is: why do you want to do that? There may be other ways to do what you *actually* want to do, but we don't know what that is. Stefan -- http://mail.pyt

Re: format a measurement result and its error in "scientific" way

2012-02-17 Thread jmfauth
On 17 fév, 11:03, Daniel Fetchinson wrote: > >> Hi folks, often times in science one expresses a value (say > >> 1.03789291) and its error (say 0.00089) in a short way by parentheses > >> like so: 1.0379(9) > > > Before swallowing any Python solution, you should > > realize, the values (value, err

Re: format a measurement result and its error in "scientific" way

2012-02-17 Thread Ulrich Eckhardt
Am 16.02.2012 01:18, schrieb Daniel Fetchinson: Hi folks, often times in science one expresses a value (say 1.03789291) and its error (say 0.00089) in a short way by parentheses like so: 1.0379(9) Just so that I understand you, the value of the last "digit" is somewhere between 9-9 and 9+9, ri

Re: How to make PyDev pep8 friendly?

2012-02-17 Thread Fabio Zadrozny
On Wed, Feb 8, 2012 at 10:15 PM, Ali Zandi wrote: > Hi, > > I was trying to find a way to configure PyDev e.g. in Eclipse to be > pep8 friendly. > > There are a few configurations like right trim lines, use space after > commas, use space before and after operators, add new line at the end > of fi

Re: Numerical Linear Algebra in arbitrary precision

2012-02-17 Thread Robert Kern
On 2/17/12 6:09 AM, Tim Roberts wrote: Ken wrote: Brand new Python user and a bit overwhelmed with the variety of packages available. Any recommendation for performing numerical linear algebra (specifically least squares and generalized least squares using QR or SVD) in arbitrary precision?

Re: Generating class definitions at runtime in memory from XSD or JSON

2012-02-17 Thread Nobody
On Thu, 16 Feb 2012 17:15:59 -0800, Stodge wrote: > Does anyone know of a library to generate class definitions in memory, > at runtime, from XSD or JSON? I know about PyXB, generateDS and some > others, but they all rely on generating python source files at the > command line, and then using thos

Re: format a measurement result and its error in "scientific" way

2012-02-17 Thread Daniel Fetchinson
>> Hi folks, often times in science one expresses a value (say >> 1.03789291) and its error (say 0.00089) in a short way by parentheses >> like so: 1.0379(9) > > Before swallowing any Python solution, you should > realize, the values (value, error) you are using are > a non sense : > > 1.03789291 +

Re: format a measurement result and its error in "scientific" way

2012-02-17 Thread Daniel Fetchinson
>> Thanks, it's simpler indeed, but gives me an error for value=1.267, >> error=0.08: >> >> Traceback (most recent call last): >> File "/home/fetchinson/bin/format_error", line 26, in >>print format_error( sys.argv[1], sys.argv[2] ) >> File "/home/fetchinson/bin/format_error", line 9, in for

Re: question about function pointer

2012-02-17 Thread Nobody
On Fri, 17 Feb 2012 16:53:00 +0900, Zheng Li wrote: > def method1(a = None): > print a > > i can call it by > method1(*(), **{'a' : 1}) > > I am just curious why it works and how it works? > and what do *() and **{'a' : 1} mean? In a function call, an argument consisting of * followed by

Re: format a measurement result and its error in "scientific" way

2012-02-17 Thread jmfauth
On 16 fév, 01:18, Daniel Fetchinson wrote: > Hi folks, often times in science one expresses a value (say > 1.03789291) and its error (say 0.00089) in a short way by parentheses > like so: 1.0379(9) > Before swallowing any Python solution, you should realize, the values (value, error) you are usin

PHP Tutorials

2012-02-17 Thread Dhrati Singh
R4R provide basic PHP Tutorials with PHP Examples .Through R4R you can develop PHP programming concept. R4R provide PHP Interview Questions with answers.R4R provide PHP programming basic knowledge and related all programming skills. PHP- Hypertext Preprocessor is server side script language like AS

Re: question about function pointer

2012-02-17 Thread Arnaud Delobelle
On 17 February 2012 07:53, Zheng Li wrote: > def method1(a = None): >        print a > > i can call it by > method1(*(), **{'a' : 1}) > > I am just curious why it works and how it works? > and what do *() and **{'a' : 1} mean? > > when I type *() in python shell, error below happens > >  File "",