ANN: firehose-0.2 released

2013-03-26 Thread David Malcolm
firehose is a Python package intended for managing the results from code analysis tools (e.g. compiler warnings, static analysis, linters, etc). It currently provides parsers for the output of gcc, clang-analyzer and cppcheck. These parsers convert the results into a common data model of Python

[ANN] GMPY2 2.0.0 has been released

2013-03-26 Thread casevh
I'm pleased to announce the release of GMPY2 2.0.0. GMPY2 provides access to the GMP/MPIR, MPFR, and MPC arbitrary precision arithmetic libraries. Highlights -- * Support for correctly rounded arbitrary precision real arithmetic, including trigonometric, logarithmic, exponential, and

[RELEASED] Python 3.2.4 rc 1 and Python 3.3.1 rc 1

2013-03-26 Thread Georg Brandl
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On behalf of the Python development team, I am pleased to announce the first release candidates of Python 3.2.4 and 3.3.1. Python 3.2.4 will be the last regular maintenance release for the Python 3.2 series, while Python 3.3.1 is the first

Re: Performance of int/long in Python 3

2013-03-26 Thread Chris Angelico
On Tue, Mar 26, 2013 at 4:01 PM, Steven D'Aprano No string methods? You were lucky. When I were a lad, you couldn't even use delimiters for strings. b string Parsing error: file stdin, line 1: b string ^ Unhandled exception: run-time error: syntax error Python 0.9.1. Well of course

At a loss on python scoping.

2013-03-26 Thread Shiyao Ma
Hi, suppose I have a file like this: class A: r = 5 def func(self, s): self.s = s a = A() print(a.r)# this should print 5, but where does py store the name of r a.func(3) print(a.s)# this should print 3, also where does py store this name. what's the underlying difference

Re: python3 string format

2013-03-26 Thread Ian Kelly
On Mon, Mar 25, 2013 at 10:24 PM, Shiyao Ma i...@introo.me wrote: HI. one thing confuses me. It is said in the pep3101 that {}.format (x) will invoke the method x.__format__ However, I looked at the src of python3 and found: in class str(object), the format simply contains a pass statement

Re: At a loss on python scoping.

2013-03-26 Thread Shiyao Ma
PS, I now python's scoping rule is lexical rule (aka static rule). How does LEGB apply to class? On Tue, Mar 26, 2013 at 2:17 PM, Shiyao Ma i...@introo.me wrote: Hi, suppose I have a file like this: class A: r = 5 def func(self, s): self.s = s a = A() print(a.r)# this

Re: Performance of int/long in Python 3

2013-03-26 Thread Chris Angelico
On Tue, Mar 26, 2013 at 10:35 AM, Cousin Stanley cousinstan...@gmail.com wrote: Chris Angelico wrote: The Python 3 merge of int and long has effectively penalized small-number arithmetic by removing an optimization. The cost is clear. The cost isn't quite as clear under

Re: At a loss on python scoping.

2013-03-26 Thread Chris Angelico
On Tue, Mar 26, 2013 at 5:17 PM, Shiyao Ma i...@introo.me wrote: class A: r = 5 def func(self, s): self.s = s a = A() print(a.r)# this should print 5, but where does py store the name of r What do you mean by the name of r? ChrisA --

[RELEASED] Python 3.2.4 rc 1 and Python 3.3.1 rc 1

2013-03-26 Thread Georg Brandl
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On behalf of the Python development team, I am pleased to announce the first release candidates of Python 3.2.4 and 3.3.1. Python 3.2.4 will be the last regular maintenance release for the Python 3.2 series, while Python 3.3.1 is the first

Re: import in Python3.3

2013-03-26 Thread Terry Reedy
On 3/24/2013 7:12 PM, Fabian von Romberg wrote: Hi, I have a package name collections and inside of my package I want to import the collections package from the standard library, but there is name conflicts. Yes. I strongly advise against trying to do this. How do I import explicitly from

Re: At a loss on python scoping.

2013-03-26 Thread Terry Reedy
On 3/26/2013 2:17 AM, Shiyao Ma wrote: Hi, suppose I have a file like this: class A: r = 5 def func(self, s): self.s = s a = A() print(a.r)# this should print 5, but where does py store the name of r a.func(3) print(a.s)# this should print 3, also where does py store

Re: Separate Rows in reader

2013-03-26 Thread Jiewei Huang
On Tuesday, March 26, 2013 1:48:10 PM UTC+10, MRAB wrote: On 26/03/2013 03:33, Jiewei Huang wrote: On Tuesday, March 26, 2013 11:40:51 AM UTC+10, Dave Angel wrote: On 03/25/2013 09:05 PM, Jiewei Huang wrote: On Monday, March 25, 2013 11:51:51 PM UTC+10, rusi wrote: If you

Re: This mail never gets delivered. Any ideas why?

2013-03-26 Thread Νίκος Γκρ33κ
Τη Τρίτη, 12 Μαρτίου 2013 12:34:50 π.μ. UTC+2, ο χρήστης Thomas Rachel έγραψε: Am 10.03.2013 19:39 schrieb οΏ½οΏ½οΏ½οΏ½οΏ½ οΏ½οΏ½οΏ½33οΏ½: Hey man this worked via Python! [...] if( os.system( 'echo %s | mail -s %s supp...@superhost.gr' % (MESSAGE, FROM) ) ):

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Michael Herrmann
On Monday, March 25, 2013 10:08:53 PM UTC+1, Chris Angelico wrote: ... I kind of like the context manager solution because the indentation makes it very obvious what happens in which window. You are right about our target group though. Also, the with is not as explicit as it probably

Screencast: Creating and deploying an advanced python web application in under 15 minutes!

2013-03-26 Thread timothy crosley
Hi, I've created a screen cast showing how a message board with live-validation and Ajax calls written in python can be built and deployed in under 15 minutes. You can view it here: http://www.youtube.com/watch?v=ucougrZK9wI I hope some of you find it useful, Thanks! Timothy --

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Michael Herrmann
On Tuesday, March 26, 2013 12:11:34 AM UTC+1, Ethan Furman wrote: On 03/25/2013 12:29 PM, Michael Herrmann wrote: ... notepad_1 = start(Notepad) notepad_2 = start(Notepad) notepad_1.write(Hello World!) notepad_1.press(CTRL + 'a', CTRL + 'c') notepad_2.press(CTRL +

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Michael Herrmann
On Tuesday, March 26, 2013 12:40:45 AM UTC+1, Mitya Sirenef wrote: ... I think I would prefer context managers. I don't think it's a big problem for win users because this behaviour would be one of the first things documented in the start guide and would be all over example scripts, so a

Processing user input as it's entered

2013-03-26 Thread Sven
Hello, Is there a way (ideally cross platform but a *nix OS solution would be great) to process user input as they type? What I aim to achieve is to count the number of characters a user has entered and display it while they are typing. The entered text will also need to be captured once the user

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Jean-Michel Pichavant
- Original Message - notepad_1 = start(Notepad) notepad_2 = start(Notepad) notepad_1.write(Hello World!) notepad_1.press(CTRL + 'a', CTRL + 'c') notepad_2.press(CTRL + 'v') The problem with this design is that it effectively duplicates our API: We

Re: At a loss on python scoping.

2013-03-26 Thread Dave Angel
On 03/26/2013 02:17 AM, Shiyao Ma wrote: Hi, suppose I have a file like this: class A: r = 5 def func(self, s): self.s = s a = A() print(a.r)# this should print 5, but where does py store the name of r a.func(3) print(a.s)# this should print 3, also where does py

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Dave Angel
On 03/26/2013 05:06 AM, Michael Herrmann wrote: On Tuesday, March 26, 2013 12:11:34 AM UTC+1, Ethan Furman wrote: On 03/25/2013 12:29 PM, Michael Herrmann wrote: ... notepad_1 = start(Notepad) notepad_2 = start(Notepad) notepad_1.write(Hello World!)

Re: This mail never gets delivered. Any ideas why?

2013-03-26 Thread Νίκος Γκρ33κ
Because Python 3 doesnt support MySQLdb moudle yet i decided to use mypysql-0.5.5.tar.gz which i found in google. problem is that i dont know how to run this file in my webost account so it cant be utilized and so i can pass to Python 3 at last. i ahve uplaoded the file viua cPnael in webhost

JES account balance function help urgent!

2013-03-26 Thread kidoman3
I am supposed to complete the following five functions, i have no idea how to do this. I will greatly appreciate any help The following five functions allow you to maintain the running balance of an account and print out lines relating to each transaction. You'll also need a global variable

Re: At a loss on python scoping.

2013-03-26 Thread Shiyao Ma
Sorry for my obscure description. the name of r , AFAIK, everything in python is just a reference. For example, a = 3, means a points to a small integer; b= [] means b points to a list somewhere in the memory. So I call r as the name of r. To clarify my question. say I wanna look up a.r I guess

Re: python3 string format

2013-03-26 Thread Shiyao Ma
Thx for your reply. I am using pycharm and simply press go to declaration which directs me to a py file, containing the following code: def format(*args, **kwargs): # known special case of str.format S.format(*args, **kwargs) - string Return a formatted version of S,

Re: JES account balance function help urgent!

2013-03-26 Thread Dave Angel
On 03/26/2013 06:30 AM, kidom...@gmail.com wrote: I am supposed to complete the following five functions, i have no idea how to do this. I will greatly appreciate any help The following five functions allow you to maintain the running balance of an account and print out lines relating to each

Re: At a loss on python scoping.

2013-03-26 Thread Shiyao Ma
Thx, really a nice and detailed explanation. On Tue, Mar 26, 2013 at 6:07 PM, Dave Angel da...@davea.name wrote: On 03/26/2013 02:17 AM, Shiyao Ma wrote: Hi, suppose I have a file like this: class A: r = 5 def func(self, s): self.s = s a = A() print(a.r)# this

Re: At a loss on python scoping.

2013-03-26 Thread Shiyao Ma
After read Dave's answer, I think I confused LEGB with attribute lookup. So, a.r has nothing to do with LEGB. On Tue, Mar 26, 2013 at 7:03 PM, Shiyao Ma i...@introo.me wrote: Thx, really a nice and detailed explanation. On Tue, Mar 26, 2013 at 6:07 PM, Dave Angel da...@davea.name wrote: On

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Chris Angelico
On Tue, Mar 26, 2013 at 7:53 PM, Michael Herrmann michael.herrm...@getautoma.com wrote: On Monday, March 25, 2013 10:08:53 PM UTC+1, Chris Angelico wrote: ... I kind of like the context manager solution because the indentation makes it very obvious what happens in which window. You are

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Chris Angelico
On Tue, Mar 26, 2013 at 8:38 PM, Michael Herrmann michael.herrm...@getautoma.com wrote: What do you think of designs #3 and #4? notepad_1 = start(Notepad) notepad_2 = start(Notepad) switch_to(notepad_1) write(Hello World!) press(CTRL + 'a', CTRL +

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Michael Herrmann
On Tuesday, March 26, 2013 11:07:45 AM UTC+1, Jean-Michel Pichavant wrote: - Original Message - notepad_1 = start(Notepad) notepad_2 = start(Notepad) notepad_1.write(Hello World!) notepad_1.press(CTRL + 'a', CTRL + 'c') notepad_2.press(CTRL + 'v') The

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Chris Angelico
On Tue, Mar 26, 2013 at 10:52 PM, Michael Herrmann michael.herrm...@getautoma.com wrote: Doesn't the IPython do auto-completion for global functions? Even if it does, it'll be polluted with every other global. Methods don't have that problem. On the flip side, since presumably this is (will be)

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Michael Herrmann
On Tuesday, March 26, 2013 11:26:30 AM UTC+1, Dave Angel wrote: ... Seems to me that the official interface should all be methods. However, you could have a new object which always represents the focus window. Then the USER could define trivial functions: def write(*args):

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Michael Herrmann
On Tuesday, March 26, 2013 12:38:35 PM UTC+1, Chris Angelico wrote: ... Fundamental point: As I understand the API, it doesn't *actually* tie to a window. You don't locate the Notepad window and send it keys - you switch focus to Notepad and then send keys to the whole system. Is this

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Jean-Michel Pichavant
- Original Message - On Tuesday, March 26, 2013 11:07:45 AM UTC+1, Jean-Michel Pichavant wrote: - Original Message - notepad_1 = start(Notepad) notepad_2 = start(Notepad) notepad_1.write(Hello World!) notepad_1.press(CTRL + 'a', CTRL + 'c')

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Michael Herrmann
On Tuesday, March 26, 2013 12:43:18 PM UTC+1, Chris Angelico wrote: On Tue, Mar 26, 2013 at 8:38 PM, Michael Herrmann What do you think of designs #3 and #4? notepad_1 = start(Notepad) notepad_2 = start(Notepad) switch_to(notepad_1) write(Hello

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Michael Herrmann
On Tuesday, March 26, 2013 12:57:21 PM UTC+1, Chris Angelico wrote: On Tue, Mar 26, 2013 at 10:52 PM, Michael Herrmann Doesn't the IPython do auto-completion for global functions? Even if it does, it'll be polluted with every other global. Methods don't have that problem. On the flip side,

[WSGI] Tell Python to listen to LAN interface?

2013-03-26 Thread Gilles
Hello I'm following this tutorial to learn about writing Python apps in WSGI: http://webpython.codepoint.net/wsgi_tutorial On a Linux host with Python 2.6.6 installed, I launched the Environment dictionary sample, but can't connect to it from my remote Windows host since the application only

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Michael Herrmann
On Tuesday, March 26, 2013 1:16:56 PM UTC+1, Jean-Michel Pichavant wrote: - Original Message - notepad_1 = start(Notepad) notepad_2 = start(Notepad) notepad_1.write(Hello World!) notepad_1.press(CTRL + 'a', CTRL + 'c')

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Dave Angel
On 03/26/2013 08:04 AM, Michael Herrmann wrote: On Tuesday, March 26, 2013 11:26:30 AM UTC+1, Dave Angel wrote: ... Seems to me that the official interface should all be methods. However, you could have a new object which always represents the focus window. Then the USER could define

Re: At a loss on python scoping.

2013-03-26 Thread Steven D'Aprano
On Tue, 26 Mar 2013 14:19:21 +0800, Shiyao Ma wrote: PS, I now python's scoping rule is lexical rule (aka static rule). How does LEGB apply to class? It doesn't. Python does not use the same lookup rules for attributes and unqualified names. Attribute lookups follow inheritance rules.

Re: [WSGI] Tell Python to listen to LAN interface?

2013-03-26 Thread Chris Angelico
On Tue, Mar 26, 2013 at 11:26 PM, Gilles nos...@nospam.com wrote: Hello I'm following this tutorial to learn about writing Python apps in WSGI: http://webpython.codepoint.net/wsgi_tutorial I'm guessing you're using the initialization code from here?

Re: [WSGI] Tell Python to listen to LAN interface?

2013-03-26 Thread Gilles
On Tue, 26 Mar 2013 23:50:36 +1100, Chris Angelico ros...@gmail.com wrote: According to the docstring, the first argument to make_server() is the host name to bind to. Using localhost means you're bound to 127.0.0.1, as you see. Use your LAN IP address there, or to bind to all local addresses -

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Steven D'Aprano
On Tue, 26 Mar 2013 05:04:43 -0700, Michael Herrmann wrote: On Tuesday, March 26, 2013 11:26:30 AM UTC+1, Dave Angel wrote: ... Seems to me that the official interface should all be methods. However, you could have a new object which always represents the focus window. Then the USER

Re: Performance of int/long in Python 3

2013-03-26 Thread Roy Smith
In article 51512bb5$0$29973$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Mon, 25 Mar 2013 20:55:03 -0400, Roy Smith wrote: In article 5150e900$0$29998$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Mitya Sirenef
On 03/26/2013 05:38 AM, Michael Herrmann wrote: On Tuesday, March 26, 2013 12:40:45 AM UTC+1, Mitya Sirenef wrote: ... I think I would prefer context managers. I don't think it's a big problem for win users because this behaviour would be one of the first things documented in the start

Re: Performance of int/long in Python 3

2013-03-26 Thread Cousin Stanley
Chris Angelico wrote: Interesting, so your 3.x sum() is optimizing something somewhere. Strange. Are we both running the same Python ? I got those from apt-get I also installed python here under Debian Wheezy via apt-get and our versions look to be the same -sk-

Re: Performance of int/long in Python 3

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 12:38 AM, Cousin Stanley cousinstan...@gmail.com wrote: Chris Angelico wrote: Interesting, so your 3.x sum() is optimizing something somewhere. Strange. Are we both running the same Python ? I got those from apt-get I also installed python here under Debian

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Neil Cerutti
On 2013-03-25, Mitya Sirenef msire...@lightbird.net wrote: I think I would prefer context managers. I don't think it's a big problem for win users because this behaviour would be one of the first things documented in the start guide and would be all over example scripts, so a new user missing

Is it me or is the python-vobject documentation rather lacking?

2013-03-26 Thread cl
I'm trying to use the python vobject package instead of what I use at the moment (the icalendar package) because it's more widely supported and available from my Linux repository. However I'm having a really hard time actually working out how to use it. The 'Usage examples' at

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Michael Herrmann
On Tuesday, March 26, 2013 1:59:58 PM UTC+1, Steven D'Aprano wrote: On Tue, 26 Mar 2013 05:04:43 -0700, Michael Herrmann wrote: ... Am I the only one who appreciates the simplicity of start(Notepad) write(Hello World!) press(CTRL + 's') write(test.txt,

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Michael Herrmann
On Tuesday, March 26, 2013 1:42:26 PM UTC+1, Dave Angel wrote: ... Also, it seems that in this thread, we are using window both to refer to a particular application instance (like Notepad1 and Notepad2), and to refer to windows within a single application. Anyway, if you're only

Re: Processing user input as it's entered

2013-03-26 Thread Arnaud Delobelle
On 26 March 2013 10:07, Sven sven...@gmail.com wrote: Hello, Is there a way (ideally cross platform but a *nix OS solution would be great) to process user input as they type? What I aim to achieve is to count the number of characters a user has entered and display it while they are typing.

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Michael Herrmann
On Tuesday, March 26, 2013 3:13:30 PM UTC+1, Neil Cerutti wrote: On 2013-03-25, Mitya Sirenef wrote: I think I would prefer context managers. I don't think it's a big problem for win users because this behaviour would be one of the first things documented in the start guide and would be

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Michael Herrmann
On Tuesday, March 26, 2013 2:41:38 PM UTC+1, Mitya Sirenef wrote: ... At the __exit__, further commands are no longer routed to that window; if it was a nested context, window is switched to the outer context, WHEN there are commands in it (i.e. on the first command). This seems pretty

Re: python3 string format

2013-03-26 Thread Ian Kelly
On Tue, Mar 26, 2013 at 4:51 AM, Shiyao Ma i...@introo.me wrote: Thx for your reply. I am using pycharm and simply press go to declaration which directs me to a py file, containing the following code: def format(*args, **kwargs): # known special case of str.format

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 1:59 AM, Michael Herrmann michael.herrm...@getautoma.com wrote: save_dialogue = press(CTRL + 's') Does every single API need to then consider the possibility of focus changing? How does the press() function know that this will (or might - if the file's already been named,

Re: Processing user input as it's entered

2013-03-26 Thread Sven
On 26 March 2013 14:41, Arnaud Delobelle arno...@gmail.com wrote: On 26 March 2013 10:07, Sven sven...@gmail.com wrote: Hello, Is there a way (ideally cross platform but a *nix OS solution would be great) to process user input as they type? What I aim to achieve is to count the number

Re: import in Python3.3

2013-03-26 Thread rocky
On Tuesday, March 26, 2013 3:04:44 AM UTC-4, Terry Reedy wrote: On 3/24/2013 7:12 PM, Fabian von Romberg wrote: Hi, I have a package name collections and inside of my package I want to import the collections package from the standard library, but there is name conflicts.

I need a neat way to print nothing or a number

2013-03-26 Thread cl
What's a neat way to print columns of numbers with blanks where a number is zero or None? E.g. I want to output something like:- Credit Debit Description 100.00 Initial balance 123.45 Payment for cabbages 202.00 Telephone bill For

Re: I need a neat way to print nothing or a number

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 2:50 AM, c...@isbd.net wrote: What's a neat way to print columns of numbers with blanks where a number is zero or None? E.g. I want to output something like:- Credit Debit Description 100.00 Initial balance 123.45

Simple example of how to use importlib to create a loader

2013-03-26 Thread Paul Moore
I'm trying to write my own loader using importlib. And frankly, I'm getting nowhere. I'm struggling to understand precisely which methods of the various ABCs I need to implement, and in some cases what they should do. Could anyone point me to a simple example (say, something that implements zip

Re: I need a neat way to print nothing or a number

2013-03-26 Thread John Gordon
In jms82a-6sl@chris.zbmc.eu c...@isbd.net writes: What's a neat way to print columns of numbers with blanks where a number is zero or None? print number or ' ' -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil,

Samsung Galaxy Mini

2013-03-26 Thread 23alagmy
Samsung Galaxy Mini http://natigtas7ab.blogspot.com/2012/10/samsung-galaxy-mini.html -- http://mail.python.org/mailman/listinfo/python-list

Re: import in Python3.3

2013-03-26 Thread Jerry Hill
On Mon, Mar 25, 2013 at 11:49 PM, rocky ro...@gnu.org wrote: On Sun, 24 Mar 2013 18:12:49 -0500, Fabian von Romberg wrote: I have a package name collections and inside of my package I want to I find this kind of thing sad: it feels to me that programmers are working around somewhat

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Dave Angel
On 03/26/2013 10:40 AM, Michael Herrmann wrote: On Tuesday, March 26, 2013 3:13:30 PM UTC+1, Neil Cerutti wrote: SNIP Have you considered adding a keyword argument to each of your global functions, which is normally None, but allows a user to provide a prefered focus window?

Re: Performance of int/long in Python 3

2013-03-26 Thread Cousin Stanley
Chris Angelico wrote: Once again, Py3 is slower on small integers than Py2. Chris Angelico Ubuntu Karmic. Pentium(R) Dual-Core CPU E6500 @ 2.93GHz. python inline range_sum forloop forloop_offset 2.6.4 2.7050 2.6492 6.5877 16.5168 3.1.1 4.4453 4.3731

Re: Performance of int/long in Python 3

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 3:41 AM, Cousin Stanley cousinstan...@gmail.com wrote: Chris Angelico wrote: Once again, Py3 is slower on small integers than Py2. Chris Angelico Ubuntu Karmic. Pentium(R) Dual-Core CPU E6500 @ 2.93GHz. python inline range_sum forloop forloop_offset

Re: I need a neat way to print nothing or a number

2013-03-26 Thread Wolfgang Maier
Chris Angelico rosuav at gmail.com writes: Try printing out this expression: %.2f%value if value else '' Without the rest of your code I can't tell you how to plug that in, but a ternary expression is a good fit here. ChrisA Unfortunately, that's not working, but gives a TypeError:

Help with zip in a Python exercise

2013-03-26 Thread luggw1
I've been working through a Python tutorial online and one of the exercises uses the zip command. The only problem is that the command doesn't work. I've read through the man page for zip and it looks like what I'm attempting should work, but it doesn't. The command is: zip -qr

Re: I need a neat way to print nothing or a number

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 4:06 AM, Wolfgang Maier wolfgang.ma...@biologie.uni-freiburg.de wrote: Chris Angelico rosuav at gmail.com writes: Try printing out this expression: %.2f%value if value else '' Without the rest of your code I can't tell you how to plug that in, but a ternary

Re: I need a neat way to print nothing or a number

2013-03-26 Thread Peter Otten
Wolfgang Maier wrote: Chris Angelico rosuav at gmail.com writes: Try printing out this expression: %.2f%value if value else '' Without the rest of your code I can't tell you how to plug that in, but a ternary expression is a good fit here. ChrisA Unfortunately, that's not

problem with sys import argv

2013-03-26 Thread leonardo selmi
hi python community, i wrote the following programm: from sys import argv script, userName = argv prompt = ' ' print 'hi %s, i am the %s script' % (userName, script) print i'd like to ask you a few questions. print 'do you like me %s' % userName likes = raw_input(prompt) print where do you

Re: Help with zip in a Python exercise

2013-03-26 Thread Joel Goldstick
On Tue, Mar 26, 2013 at 1:06 PM, lug...@elpasotel.net wrote: I've been working through a Python tutorial online and one of the exercises uses the zip command. The only problem is that the command doesn't work. I've read through the man page for zip and it looks like what I'm attempting

Re: I need a neat way to print nothing or a number

2013-03-26 Thread Ethan Furman
On 03/26/2013 10:06 AM, Wolfgang Maier wrote: Chris Angelico rosuav at gmail.com writes: Try printing out this expression: %.2f%value if value else '' Without the rest of your code I can't tell you how to plug that in, but a ternary expression is a good fit here. ChrisA Unfortunately,

Re: problem with sys import argv

2013-03-26 Thread Mark Lawrence
On 26/03/2013 17:26, leonardo selmi wrote: hi python community, i wrote the following programm: from sys import argv script, userName = argv prompt = ' ' print 'hi %s, i am the %s script' % (userName, script) print i'd like to ask you a few questions. print 'do you like me %s' % userName

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Neil Cerutti
On 2013-03-26, Dave Angel da...@davea.name wrote: On 03/26/2013 10:40 AM, Michael Herrmann wrote: On Tuesday, March 26, 2013 3:13:30 PM UTC+1, Neil Cerutti wrote: SNIP Have you considered adding a keyword argument to each of your global functions, which is normally None, but allows a user

Re: problem with sys import argv

2013-03-26 Thread Dave Angel
On 03/26/2013 01:26 PM, leonardo selmi wrote: hi python community, i wrote the following programm: from sys import argv script, userName = argv prompt = ' ' print 'hi %s, i am the %s script' % (userName, script) print i'd like to ask you a few questions. print 'do you like me %s' % userName

Re: How to define exec method on a class object? Get syntax error due to built in command

2013-03-26 Thread Kyle
On Monday, March 25, 2013 4:28:34 PM UTC-4, Kyle wrote: I am using swig to generate our CLI for TCL and Python. In this CLI, we have a subcommand exec that is failing to compile in the python case. There seems to be some built-in python command exec which is giving a syntax error in the .py

Re: Performance of int/long in Python 3

2013-03-26 Thread Terry Reedy
On 3/26/2013 12:41 PM, Cousin Stanley wrote: So where's the difference with your system ? CPU Compilers and compiler settings can also make a difference. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: import in Python3.3

2013-03-26 Thread rocky
On Tuesday, March 26, 2013 12:33:54 PM UTC-4, Jerry Hill wrote: On Mon, Mar 25, 2013 at 11:49 PM, rocky wrote: On Sun, 24 Mar 2013 18:12:49 -0500, Fabian von Romberg wrote: I have a package name collections and inside of my package I want to I find this kind of thing sad: it

Re: How to define exec method on a class object? Get syntax error due to built in command

2013-03-26 Thread Ethan Furman
On 03/26/2013 11:13 AM, Kyle wrote: On Monday, March 25, 2013 4:28:34 PM UTC-4, Kyle wrote: I am using swig to generate our CLI for TCL and Python. In this CLI, we have a subcommand exec that is failing to compile in the python case. There seems to be some built-in python command exec which

Re: How to define exec method on a class object? Get syntax error due to built in command

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 5:13 AM, Kyle stalker...@gmail.com wrote: Thanks for the suggestion. Looks like we currently use 2.3.4. This still wouldn't solve the problem because now the user would need to call something like getattr(wbt, exec)(args) instead of wbt.exec(args) like all the other

[job] Python AWS /Back-End Developer in New York, NY

2013-03-26 Thread Lana
We are looking for a strong Python Developer to work with our young and energetic team on the Next generation of clients website. This project is the first to implement the modern concepts of Cloud and MongoDB. Job Responsibilities - Creates new and modifies existing software, integrates

Re: I need a neat way to print nothing or a number

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 4:21 AM, Ethan Furman et...@stoneleaf.us wrote: On 03/26/2013 10:06 AM, Wolfgang Maier wrote: Chris Angelico rosuav at gmail.com writes: Try printing out this expression: %.2f%value if value else '' Without the rest of your code I can't tell you how to plug that

Re: Performance of int/long in Python 3

2013-03-26 Thread jmfauth
On 25 mar, 22:51, Chris Angelico ros...@gmail.com wrote: The Python 3 merge of int and long has effectively penalized small-number arithmetic by removing an optimization. As we've seen from PEP 393 strings (jmf aside), there can be huge benefits from having a single type with multiple

Re: Performance of int/long in Python 3

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 5:50 AM, jmfauth wxjmfa...@gmail.com wrote: On 25 mar, 22:51, Chris Angelico ros...@gmail.com wrote: The Python 3 merge of int and long has effectively penalized small-number arithmetic by removing an optimization. As we've seen from PEP 393 strings (jmf aside), there

Re: How to define exec method on a class object? Get syntax error due to built in command

2013-03-26 Thread Kyle
On Mar 26, 2:43 pm, Chris Angelico ros...@gmail.com wrote: On Wed, Mar 27, 2013 at 5:13 AM, Kyle stalker...@gmail.com wrote: Thanks for the suggestion. Looks like we currently use 2.3.4. This still wouldn't solve the problem because now the user would need to call something like  

Re: How to define exec method on a class object? Get syntax error due to built in command

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 6:24 AM, Kyle stalker...@gmail.com wrote: On Mar 26, 2:43 pm, Chris Angelico ros...@gmail.com wrote: On Wed, Mar 27, 2013 at 5:13 AM, Kyle stalker...@gmail.com wrote: Thanks for the suggestion. Looks like we currently use 2.3.4. This still wouldn't solve the problem

Re: problem with sys import argv

2013-03-26 Thread Thomas 'PointedEars' Lahn
Dave Angel wrote: Since the script takes a mandatory argument, run it with one. python myscript.py Dave Better would be to change the script to check len(argv) for exactly 2, and tell the user how he should have run it. I would use argparse.ArgumentParser instead.

Re: Performance of int/long in Python 3

2013-03-26 Thread jmfauth
On 26 mar, 20:03, Chris Angelico ros...@gmail.com wrote: On Wed, Mar 27, 2013 at 5:50 AM, jmfauth wxjmfa...@gmail.com wrote: On 25 mar, 22:51, Chris Angelico ros...@gmail.com wrote: The Python 3 merge of int and long has effectively penalized small-number arithmetic by removing an

Re: problem with sys import argv

2013-03-26 Thread Dave Angel
On 03/26/2013 04:12 PM, Thomas 'PointedEars' Lahn wrote: Dave Angel wrote: Since the script takes a mandatory argument, run it with one. python myscript.py Dave Better would be to change the script to check len(argv) for exactly 2, and tell the user how he should have run it. I would use

Re: Performance of int/long in Python 3

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 7:44 AM, jmfauth wxjmfa...@gmail.com wrote: On 26 mar, 20:03, Chris Angelico ros...@gmail.com wrote: On Wed, Mar 27, 2013 at 5:50 AM, jmfauth wxjmfa...@gmail.com wrote: On 25 mar, 22:51, Chris Angelico ros...@gmail.com wrote: The Python 3 merge of int and long has

Re: Performance of int/long in Python 3

2013-03-26 Thread Mark Lawrence
On 26/03/2013 20:44, jmfauth wrote: On 26 mar, 20:03, Chris Angelico ros...@gmail.com wrote: On Wed, Mar 27, 2013 at 5:50 AM, jmfauth wxjmfa...@gmail.com wrote: On 25 mar, 22:51, Chris Angelico ros...@gmail.com wrote: The Python 3 merge of int and long has effectively penalized small-number

Re: Performance of int/long in Python 3

2013-03-26 Thread Grant Edwards
On 2013-03-26, Mark Lawrence breamore...@yahoo.co.uk wrote: On 26/03/2013 20:44, jmfauth wrote: A character is not an integer (short form). So? A character is not an integer. jmf But you are an idiot. I think we all agree that jmf is a character. So we've established that no

Re: Performance of int/long in Python 3

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 8:08 AM, Grant Edwards invalid@invalid.invalid wrote: On 2013-03-26, Mark Lawrence breamore...@yahoo.co.uk wrote: On 26/03/2013 20:44, jmfauth wrote: A character is not an integer (short form). So? A character is not an integer. jmf But you are an idiot. I

Re: import in Python3.3

2013-03-26 Thread Phil Connell
On Tue, Mar 26, 2013 at 08:37:00AM -0700, rocky wrote: And again, I get the impression that for the use case asked about, there isn't much ambiguity. If I am in mypackage.foo and I want to access mypackage.collections I should be able to say something like that without ambiguity or that

Re: Performance of int/long in Python 3

2013-03-26 Thread Mark Lawrence
On 26/03/2013 21:14, Chris Angelico wrote: On Wed, Mar 27, 2013 at 8:08 AM, Grant Edwards invalid@invalid.invalid wrote: On 2013-03-26, Mark Lawrence breamore...@yahoo.co.uk wrote: On 26/03/2013 20:44, jmfauth wrote: A character is not an integer (short form). So? A character is not an

Re: Performance of int/long in Python 3

2013-03-26 Thread Dave Angel
On 03/26/2013 05:14 PM, Chris Angelico wrote: snip Does that allow us to determine wheter integers are idiots or not? No, it doesn't. I'm fairly confident that most of them are not... however, I have my eye on 42. He gets around, a bit, but never seems to do anything very useful. I'd think

  1   2   >