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 th

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 t

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: > > >>

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' > > % (MESSA

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 proba

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 -- http://mail.p

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') > > not

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, s

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

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 store

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!") notepa

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 b

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 (ba

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 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 s

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 wrote: > Thx, really a nice and detailed explanation. > > > On Tue, Mar 26, 2013 at 6:07 PM, Dave Angel wrote: > >> On 03/26/2013 02:17 AM, Sh

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 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 right about our >> > targ

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 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 + 'c') > switch

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 +

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 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) a module, anyone who wants a

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 cor

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 +

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) > > wr

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

[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 a

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 trivi

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. `inst

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 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? http://webpython.codepoint.net/wsgi_environment_dict

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 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 - or possibl

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 t

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 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 wrote: > > > >> Also, speaking as somebody who remembers

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 >> i

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 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 Wheezy >

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

2013-03-26 Thread Neil Cerutti
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 > all over example scripts, so a new user missing or forgetting > it

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 http://vobject.skyho

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') > > w

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'r

Re: Processing user input as it's entered

2013-03-26 Thread Arnaud Delobelle
On 26 March 2013 10:07, Sven 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. The entered t

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 wou

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 i

Re: python3 string format

2013-03-26 Thread Ian Kelly
On Tue, Mar 26, 2013 at 4:51 AM, Shiyao Ma 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 > """ > S.format(*args

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 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, Ctrl-S won't open a dlg) chan

Re: Processing user input as it's entered

2013-03-26 Thread Sven
On 26 March 2013 14:41, Arnaud Delobelle wrote: > On 26 March 2013 10:07, Sven 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

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 c

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 ea

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, 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 Payment for

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 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, assaulted by bears

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 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 arbitrary and c

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: 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? enter_text("test.tx

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 12

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 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 > > 2.6.4

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

2013-03-26 Thread Wolfgang Maier
Chris Angelico 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 TypeErr

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 /media/backup

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 wrote: > Chris Angelico 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. >> >>

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

2013-03-26 Thread Peter Otten
Wolfgang Maier wrote: > Chris Angelico 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

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, 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 should work, but it d

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 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 n

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 l

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

2013-03-26 Thread Neil Cerutti
On 2013-03-26, Dave Angel 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: >>> >>> >>> Have you considered adding a keyword argument to each of your >>> global functions, which is normally None, but allows a user to >>

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' % userNam

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

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 thin

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" whic

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 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")() instead of wbt.exec() like > all the other commands. > > I think

[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 softwar

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 wrote: > On 03/26/2013 10:06 AM, Wolfgang Maier wrote: >> >> Chris Angelico 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 i

Re: Performance of int/long in Python 3

2013-03-26 Thread jmfauth
On 25 mar, 22:51, Chris Angelico 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 representations inter

Re: Performance of int/long in Python 3

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 5:50 AM, jmfauth wrote: > On 25 mar, 22:51, Chris Angelico 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 >> h

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 wrote: > On Wed, Mar 27, 2013 at 5:13 AM, Kyle 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")() instead of >

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 wrote: > On Mar 26, 2:43 pm, Chris Angelico wrote: >> On Wed, Mar 27, 2013 at 5:13 AM, Kyle 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

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 wrote: > On Wed, Mar 27, 2013 at 5:50 AM, jmfauth wrote: > > On 25 mar, 22:51, Chris Angelico 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 string

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 wrote: > On 26 mar, 20:03, Chris Angelico wrote: >> On Wed, Mar 27, 2013 at 5:50 AM, jmfauth wrote: >> > On 25 mar, 22:51, Chris Angelico wrote: >> >> The Python 3 merge of int and long has effectively penalized >> >> small-number arithmetic by removing

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 wrote: On Wed, Mar 27, 2013 at 5:50 AM, jmfauth wrote: On 25 mar, 22:51, Chris Angelico wrote: The Python 3 merge of int and long has effectively penalized small-number arithmetic by removing an optimization. As we've seen

Re: Performance of int/long in Python 3

2013-03-26 Thread Grant Edwards
On 2013-03-26, Mark Lawrence 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 character

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 wrote: > On 2013-03-26, Mark Lawrence 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

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 wrote: On 2013-03-26, Mark Lawrence 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

Re: Performance of int/long in Python 3

2013-03-26 Thread Dave Angel
On 03/26/2013 05:14 PM, Chris Angelico wrote: 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 twic

MySQLdbd error. Perhpas it isn't installed?

2013-03-26 Thread Νίκος Γκρ33κ
Hello today i deiced to go form python 2.6 to python 3.2.3 although in 2.6 my script runs in the ht enewest python i ge this error: Traceback (most recent call last): File "/opt/python3/lib/python3.2/site-packages/MySQL_python-1.2.3-py3.2-linux-x86_64.egg/MySQLdb/cursors.py", line 171, in ex

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

2013-03-26 Thread Mitya Sirenef
On 03/26/2013 10:59 AM, Michael Herrmann wrote: 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 i

Re: import in Python3.3

2013-03-26 Thread Rocky Bernstein
On Tue, Mar 26, 2013 at 5:16 PM, Phil Connell wrote: > 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

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

2013-03-26 Thread Steven D'Aprano
On Tue, 26 Mar 2013 07:33:18 -0700, Michael Herrmann wrote: >> As long as you know the program is going to be simple, pile on the >> globals. But as soon as it advances, each of them is a trap to fall >> into. > > You're right with everything you say. globals are bad and it may happen > that thi

Re: import in Python3.3

2013-03-26 Thread Steven D'Aprano
On Tue, 26 Mar 2013 08:37:00 -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 much inf

Re: import in Python3.3

2013-03-26 Thread Steven D'Aprano
On Tue, 26 Mar 2013 12:33:54 -0400, 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 feels to me t

Re: Performance of int/long in Python 3

2013-03-26 Thread Gregory Ewing
On Wed, Mar 27, 2013 at 8:08 AM, Grant Edwards wrote: 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 thought he was equal to 6 x 9 at one point, which seems pretty idiotic

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

2013-03-26 Thread Steven D'Aprano
On Wed, 27 Mar 2013 06:39:24 +1100, Chris Angelico wrote: > On Wed, Mar 27, 2013 at 6:24 AM, Kyle wrote: >> On Mar 26, 2:43 pm, Chris Angelico wrote: >>> On Wed, Mar 27, 2013 at 5:13 AM, Kyle wrote: >>> > Thanks for the suggestion. Looks like we currently use 2.3.4. >>> >>> > This still wouldn'

how do you make a loop run in reverse?

2013-03-26 Thread rahulreddy24
So i have a set of for loops that create this : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** **

Re: Performance of int/long in Python 3

2013-03-26 Thread Ned Deily
In article , Mark Lawrence wrote: > But you are an idiot. I repeat the friendly reminder I posted a few weeks ago and I'll be a little less oblique: please avoid gratuitous personal attacks here. It reflects badly on the group and especially on those people making them. We can disagree stro

  1   2   >