Matthew Joiner wants to stay in touch on LinkedIn

2009-11-12 Thread Matthew Joiner
LinkedIn Matthew Joiner requested to add you as a connection on LinkedIn: -- Jaime, I'd like to add you to my professional network on LinkedIn. - Matthew Joiner Accept invitation from Matthew Joiner http://www.linkedin.com/e/I2LlXdLlWUhFABKm

Re: Python & Go

2009-11-12 Thread Michele Simionato
Well, Go looks like Python in the philosophy (it is a minimalist, keep it simple language) more than in the syntax. The one thing that I really like is the absence of classes and the presence of interfaces (I have been advocating something like that for years). I am dubious about the absence of exc

Re: How to specify Python version in script?

2009-11-12 Thread Yinon Ehrlich
> Is there some way to specify at the very beginning of the script > the acceptable range of Python versions? sys.hexversion, see http://mail.python.org/pipermail/python-list/2009-June/185939.html -- Yinon -- http://mail.python.org/mailman/listinfo/python-list

Re: advice needed for lazy evaluation mechanism

2009-11-12 Thread Steven D'Aprano
On Thu, 12 Nov 2009 08:53:57 +0100, Dieter Maurer wrote: > Steven D'Aprano writes on 10 Nov > 2009 19:11:07 GMT: >> ... >> > So I am trying to restructure it using lazy evaluation. >> >> Oh great, avoiding confusion with something even more confusing. > > Lazy evaluation may be confusing if it

standard libraries don't behave like standard 'libraries'

2009-11-12 Thread Sriram Srinivasan
I guess why every programming language has some kind of a 'standard library' built in within it. In my view it must not be called as a 'library' at all. what it does is like a 'bunch of built-in programs ready-made to do stuff'. Lets see what a 'library' does: 1. offers books for customers 1.1 l

Re: Python & Go

2009-11-12 Thread Carl Banks
On Nov 11, 8:42 pm, Carl Banks wrote: > On Nov 11, 7:56 pm, geremy condra wrote: > > > On Wed, Nov 11, 2009 at 9:00 PM, Mensanator wrote: > > > On Nov 11, 6:53 pm, kj wrote: > > >> I'm just learning about Google's latest: the GO (Go?) language. > > >> (e.g.http://golang.orgorhttp://www.youtube.

Error in Windmill

2009-11-12 Thread Raji Seetharaman
Hi Im learning Web scraping with Python from here http://www.packtpub.com/article/web-scraping-with-python-part-2 >From the above link, the complete code is here http://pastebin.com/m10046dc6 When i run the program in the terminal i receive following errors File "nasa.py", line 41, in test

Python C API and references

2009-11-12 Thread lallous
Hello, Everytime I use PyObject_SetAttrString(obj, attr_name, py_val) and I don't need the reference to py_val I should decrement the reference after this call? So for example: PyObject *py_val = PyInt_FromLong(5) PyObject_SetAttrString(py_obj, "val", py_val); Py_DECREF(py_val) Right? If s

C api and checking for integers

2009-11-12 Thread lallous
Hello, I am a little confused on how to check if a python variable is an integer or not. Sometimes PyInt_Check() fails and PyLong_Check() succeeds. How to properly check for integer values? OTOH, I tried PyNumber_Check() and: (1) The doc says: Returns 1 if the object o provides numeric prot

query regarding file handling.

2009-11-12 Thread ankita dutta
hi all, i have a file of 3x3 matrix of decimal numbers(tab separated). like this : 0.020.380.01 0.040.320.00 0.030.400.02 now i want to read 1 row and get the sum of a particular row. but when i am trying with the following code, i am getting errors : *code*: " ln1=open(

Re: Python & Go

2009-11-12 Thread Duncan Booth
Michele Simionato wrote: > I forgot to post a link to a nice analysis of Go: > http://scienceblogs.com/goodmath/2009/11/googles_new_language_go.php > Thanks for that link. I think it pretty well agrees with my first impressions of Go: there are some nice bits but there are also some bits they

Re: query regarding file handling.

2009-11-12 Thread Chris Rebert
On Thu, Nov 12, 2009 at 1:59 AM, ankita dutta wrote: > hi all, > > i have a file of 3x3 matrix of decimal numbers(tab separated). like this : > > 0.02    0.38    0.01 > 0.04    0.32    0.00 > 0.03    0.40    0.02 > > now i want to read 1 row and get the sum of a particular row. but when i am > try

Re: Choosing GUI Module for Python

2009-11-12 Thread Lorenzo Gatti
On Nov 11, 9:48 am, Lorenzo Gatti wrote: > On a more constructive note, I started to follow the instructions > athttp://www.pyside.org/docs/pyside/howto-build/index.html(which are > vague and terse enough to be cross-platform) with Microsoft VC9 > Express. > Hurdle 0: recompile Qt because the pr

Re: python with echo

2009-11-12 Thread Diez B. Roggisch
hong zhang schrieb: List, I have a question of python using echo. POWER = 14 return_value = os.system('echo 14 > /sys/class/net/wlan1/device/tx_power') can assign 14 to tx_power But return_value = os.system('echo $POWER > /sys/class/net/wlan1/device/tx_power') return_value is 256 not 0. It

regex remove closest tag

2009-11-12 Thread S.Selvam
Hi all, 1) I need to remove the tags which is just before the keyword(i.e some_text2 ) excluding others. 2) input string may or may not contain tags. 3) Sample input: inputstr = """start some_text1 some_text2 keyword anything""" 4) I came up with the following regex, p=re.compile(r'(?

Re: Python C API and references

2009-11-12 Thread lallous
Hello Daniel, Thanks for the reply. Everytime I use PyObject_SetAttrString(obj, attr_name, py_val) and I don't need the reference to py_val I should decrement the reference after this call? It really depends on /how/ the object is created. If the method used to create *py_val* increases t

Re: standard libraries don't behave like standard 'libraries'

2009-11-12 Thread Diez B. Roggisch
Sriram Srinivasan schrieb: I guess why every programming language has some kind of a 'standard library' built in within it. In my view it must not be called as a 'library' at all. what it does is like a 'bunch of built-in programs ready-made to do stuff'. Lets see what a 'library' does: 1. offe

Re: Python C API and references

2009-11-12 Thread Mark Dickinson
On Nov 12, 9:23 am, "lallous" wrote: > Hello, > > Everytime I use PyObject_SetAttrString(obj, attr_name, py_val) and I don't > need the reference to py_val I should decrement the reference after this > call? Not necessarily: it depends where py_val came from. I find the 'ownership' model descri

Re: standard libraries don't behave like standard 'libraries'

2009-11-12 Thread Sriram Srinivasan
On Nov 12, 3:56 pm, "Diez B. Roggisch" wrote: > Sriram Srinivasan schrieb: > > > > > I guess why every programming language has some kind of a 'standard > > library' built in within it. > > In my view it must not be called as a 'library' at all. what it does > > is like a 'bunch of built-in progra

Re: standard libraries don't behave like standard 'libraries'

2009-11-12 Thread Diez B. Roggisch
Sriram Srinivasan schrieb: On Nov 12, 3:56 pm, "Diez B. Roggisch" wrote: Sriram Srinivasan schrieb: I guess why every programming language has some kind of a 'standard library' built in within it. In my view it must not be called as a 'library' at all. what it does is like a 'bunch of built

Re: standard libraries don't behave like standard 'libraries'

2009-11-12 Thread Sriram Srinivasan
On Nov 12, 3:56 pm, "Diez B. Roggisch" wrote: > Sriram Srinivasan schrieb: > > > > > I guess why every programming language has some kind of a 'standard > > library' built in within it. > > In my view it must not be called as a 'library' at all. what it does > > is like a 'bunch of built-in progra

Re: comparing alternatives to py2exe

2009-11-12 Thread Jonathan Hartley
On Nov 10, 1:34 pm, Philip Semanchuk wrote: > On Nov 9, 2009, at 9:16 PM, Gabriel Genellina wrote: > > > > > En Fri, 06 Nov 2009 17:00:17 -0300, Philip Semanchuk > > escribió: > >> On Nov 3, 2009, at 10:58 AM, Jonathan Hartley wrote: > > >>> Recently I put together this incomplete comparison char

Re: standard libraries don't behave like standard 'libraries'

2009-11-12 Thread Diez B. Roggisch
Sriram Srinivasan schrieb: On Nov 12, 3:56 pm, "Diez B. Roggisch" wrote: Sriram Srinivasan schrieb: I guess why every programming language has some kind of a 'standard library' built in within it. In my view it must not be called as a 'library' at all. what it does is like a 'bunch of built

Re: standard libraries don't behave like standard 'libraries'

2009-11-12 Thread Sriram Srinivasan
On Nov 12, 4:35 pm, "Diez B. Roggisch" wrote: > Sriram Srinivasan schrieb: > > > > > On Nov 12, 3:56 pm, "Diez B. Roggisch" wrote: > >> Sriram Srinivasan schrieb: > > >>> I guess why every programming language has some kind of a 'standard > >>> library' built in within it. > >>> In my view it mus

Re: query regarding file handling.

2009-11-12 Thread Himanshu
2009/11/12 ankita dutta : > hi all, > > i have a file of 3x3 matrix of decimal numbers(tab separated). like this : > > 0.02    0.38    0.01 > 0.04    0.32    0.00 > 0.03    0.40    0.02 > > now i want to read 1 row and get the sum of a particular row. but when i am > trying with the following code,

NetCDF to ascii file

2009-11-12 Thread Arnaud Vandecasteele
Hi all, I would like to know if it's possible to read data from a netcdf file and export it into an ASCII file. I'm trying to get the latitude, longitude and a determinate value of a netcdf file. But I don't know exactly how to do it. I succeed to open and read a netcdf file but i don't know how t

Re: Error in Windmill

2009-11-12 Thread Himanshu
2009/11/12 Raji Seetharaman : > > Hi > > Im learning Web scraping with Python from here > http://www.packtpub.com/article/web-scraping-with-python-part-2 > > From the above link, the complete code is here http://pastebin.com/m10046dc6 > > When i run the program in the terminal i receive following e

Writing an emulator in python - implementation questions (for performance)

2009-11-12 Thread Santiago Romero
Hi. I'm trying to port (just for fun), my old Sinclair Spectrum emulator, ASpectrum, from C to Python + pygame. Although the Sinclair Spectrum has a simple Z80 8 bit 3.5Mhz microprocessor, and no aditional hardware (excluding the +2/+3 model's AYsound chip), I'm not sure if my loved scripted

Re: standard libraries don't behave like standard 'libraries'

2009-11-12 Thread Diez B. Roggisch
ok let me make it more clear.. forget how you use python now.. i am talking about __futuristic__ python programming. > there is no more python2.x or python3.x or python y.x releases. there is only updates of python and standard library say 1.1.5 and 1.1.6. let the difference be an old xml libr

Re: About one class/function per module

2009-11-12 Thread Hans-Peter Jansen
On Tuesday 03 November 2009, 12:52:20 Diez B. Roggisch wrote: > Peng Yu wrote: > > On Mon, Nov 2, 2009 at 9:39 PM, alex23 wrote: > >> Peng Yu wrote: > >>> I don't think that this is a problem that can not be overcome. A > >>> simple solution might be to associate a unique identifier to each > >>>

Re: Error in Windmill

2009-11-12 Thread Raji Seetharaman
On Thu, Nov 12, 2009 at 5:58 PM, Himanshu wrote: > 2009/11/12 Raji Seetharaman : > > > > Hi > > > > Im learning Web scraping with Python from here > > http://www.packtpub.com/article/web-scraping-with-python-part-2 > > > > From the above link, the complete code is here > http://pastebin.com/m1004

Re: standard libraries don't behave like standard 'libraries'

2009-11-12 Thread Steven D'Aprano
On Thu, 12 Nov 2009 00:31:57 -0800, Sriram Srinivasan wrote: > I guess why every programming language has some kind of a 'standard > library' built in within it. > In my view it must not be called as a 'library' at all. what it does is > like a 'bunch of built-in programs ready-made to do stuff'.

Re: How can a module know the module that imported it?

2009-11-12 Thread Steven D'Aprano
On Wed, 11 Nov 2009 13:44:06 -0800, Ethan Furman wrote: > Well, I don't know what kj is trying to do, but my project is another > (!) configuration program. (Don't worry, I won't release it... unless > somebody is interested, of course !) > > So here's the idea so far: > The configuration data i

Re: standard libraries don't behave like standard 'libraries'

2009-11-12 Thread Sriram Srinivasan
On Nov 12, 6:07 pm, "Diez B. Roggisch" wrote: > > ok let me make it more clear.. > > forget how you use python now.. i am talking about __futuristic__ > > python programming. > > > there is no more python2.x or python3.x or python y.x releases. there > > is only updates of python and standard libr

Does turtle graphics have the wrong associations?

2009-11-12 Thread Alf P. Steinbach
One reaction to http://preview.tinyurl.com/ProgrammingBookP3> has been that turtle graphics may be off-putting to some readers because it is associated with children's learning. What do you think? Cheers, - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: python simply not scaleable enough for google?

2009-11-12 Thread samwyse
On Nov 11, 3:57 am, "Robert P. J. Day" wrote: > http://groups.google.com/group/unladen-swallow/browse_thread/thread/4... > >   thoughts? Google's already given us its thoughts: http://developers.slashdot.org/story/09/11/11/0210212/Go-Googles-New-Open-Source-Programming-Language -- http://mail.py

Re: New syntax for blocks

2009-11-12 Thread Steven D'Aprano
On Wed, 11 Nov 2009 03:52:45 -0800, Carl Banks wrote: >> This is where a helper function is good. You want a dispatcher: > > No I really don't. I want to be able to see the action performed > adjacent to the test, and not have to scroll up to down ten pages to > find whatever function it dispatc

How can a module know the module that imported it?

2009-11-12 Thread kj
The subject line says it all. Thanks! kynn -- http://mail.python.org/mailman/listinfo/python-list

Re: Python & Go

2009-11-12 Thread Michele Simionato
I forgot to post a link to a nice analysis of Go: http://scienceblogs.com/goodmath/2009/11/googles_new_language_go.php -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing an emulator in python - implementation questions (for performance)

2009-11-12 Thread Carl Banks
On Nov 12, 4:35 am, Santiago Romero wrote: >  Hi. > >  I'm trying to port (just for fun), my old Sinclair Spectrum emulator, > ASpectrum, from C to Python + pygame. The answer to your question is, "Use numpy". More details below. [snip] >  Should I start writing all the code with a Z80CPU obj

Re: standard libraries don't behave like standard 'libraries'

2009-11-12 Thread Sriram Srinivasan
> You are describing a lending library, which is not the only sort of > library. My personal library doesn't do any of those things. It is just a > room with shelves filled with books. how i see is all libraries are libraries, for a personal library you are the only customer and you are the manag

Re: Writing an emulator in python - implementation questions (for performance)

2009-11-12 Thread Santiago Romero
> >  I'm trying to port (just for fun), my old Sinclair Spectrum emulator, > > ASpectrum, from C to Python + pygame. > > The answer to your question is, "Use numpy".  More details below. Let's see :-) > >  How can I implement this in Python, I mean, define a 16 byte variable > > so that high and

Re: Python & Go

2009-11-12 Thread kj
In <3e2ec71b-1bd6-4fc7-b2fd-12ddb6fbd...@p8g2000yqb.googlegroups.com> Carl Banks writes: >...but the lack of >inheritance is a doozie. That's what I like most about it. Inheritance introduces at least as many headaches as it solves. For one, it leads to spaghetti code. When reading such code

Re: C api and checking for integers

2009-11-12 Thread casevh
On Nov 12, 1:28 am, "lallous" wrote: > Hello, > > I am a little confused on how to check if a python variable is an integer or > not. > > Sometimes PyInt_Check() fails and PyLong_Check() succeeds. I assume you are using Python 2.x. There are two integer types: (1) PyInt which stores small values

Re: python simply not scaleable enough for google?

2009-11-12 Thread mcherm
On Nov 11, 7:38 pm, Vincent Manis wrote: > 1. The statement `Python is slow' doesn't make any sense to me. > Python is a programming language; it is implementations that have > speed or lack thereof. [...] > 2. A skilled programmer could build an implementation that compiled > Python code into

Re: Can't Write File

2009-11-12 Thread Victor Subervi
On Wed, Nov 11, 2009 at 6:35 PM, Rhodri James wrote: > On Wed, 11 Nov 2009 14:00:44 -, Victor Subervi < > victorsube...@gmail.com> wrote: > > 6) you don't indicate which user is executing this script (only root can >>> write to it) >>> >>> Help me on this. All scripts are owned by root. Is i

Re: Why Error is derived from EnvironmentError in shutil.py?

2009-11-12 Thread Peng Yu
On Thu, Nov 12, 2009 at 12:00 AM, alex23 wrote: > On Nov 12, 2:46 pm, Peng Yu wrote: >> I see Error is derived from EnvironmentError in shutil.py. >> >> class Error(EnvironmentError): >>     pass >> >> I'm wondering why EnvironmentError can not be raised directly. Why >> Error is raised instead?

Re: CGI vs mod_python

2009-11-12 Thread Victor Subervi
On Wed, Nov 11, 2009 at 3:32 PM, Dave Angel wrote: > > > Victor Subervi wrote: > >> >> >> The problem was not CGI. It turned out to be line-endings being mangled by >> Windoze and __invisible __ in my unix editor. Lovely. >> Thanks anyway, >> V >> >> >> > That's twice you've blamed Windows for t

Re: Why Error is derived from EnvironmentError in shutil.py?

2009-11-12 Thread Chris Rebert
On Thu, Nov 12, 2009 at 7:10 AM, Peng Yu wrote: > On Thu, Nov 12, 2009 at 12:00 AM, alex23 wrote: >> On Nov 12, 2:46 pm, Peng Yu wrote: >>> I see Error is derived from EnvironmentError in shutil.py. >>> >>> class Error(EnvironmentError): >>>     pass >>> >>> I'm wondering why EnvironmentError ca

(OT) Recommend FTP Client

2009-11-12 Thread Victor Subervi
Hi; Someone on this list just recommended I find an ftp client that enables me to change line endings. He indicated that it would be easy, but googling I haven't been able to find one. I would prefer a free client, but whatever. Please send me a recommendation. TIA, Victor -- http://mail.python.or

Re: standard libraries don't behave like standard 'libraries'

2009-11-12 Thread Diez B. Roggisch
Sriram Srinivasan schrieb: On Nov 12, 6:07 pm, "Diez B. Roggisch" wrote: ok let me make it more clear.. forget how you use python now.. i am talking about __futuristic__ python programming. there is no more python2.x or python3.x or python y.x releases. there is only updates of python and stand

Re: python simply not scaleable enough for google?

2009-11-12 Thread Joel Davis
On Nov 12, 10:07 am, mcherm wrote: > On Nov 11, 7:38 pm, Vincent Manis wrote: > > > 1. The statement `Python is slow' doesn't make any sense to me. > > Python is a programming language; it is implementations that have > > speed or lack thereof. >    [...] > > 2. A skilled programmer could build a

Re: Writing an emulator in python - implementation questions (for performance)

2009-11-12 Thread Dave Angel
Santiago Romero wrote: I'm trying to port (just for fun), my old Sinclair Spectrum emulator, A Do you mean: page =ddress / 16384 index =ddress MOD 16384 ? Or, better, with: page =ddress >> 14 index =ddress & 16383 ? How about page, index = divmod(address, 16384)

#define (from C) in Python

2009-11-12 Thread Santiago Romero
Is there a Python version of C's language #define statements? Example: #define ReadMem( (x) )memory[ (x) ] Instead of using a function, when you call to ReadMem(), the code is INCLUDED, (no function is called, the "compiler" just substitues the ReadMem( expression ) with memory[ (expressio

Re: #define (from C) in Python

2009-11-12 Thread Diez B. Roggisch
Santiago Romero schrieb: Is there a Python version of C's language #define statements? Example: #define ReadMem( (x) )memory[ (x) ] Instead of using a function, when you call to ReadMem(), the code is INCLUDED, (no function is called, the "compiler" just substitues the ReadMem( expression

Re: #define (from C) in Python

2009-11-12 Thread Michele Simionato
On Nov 12, 5:43 pm, Santiago Romero wrote: > Is there a Python version of C's language #define statements? > > Example: > > #define ReadMem( (x) )    memory[ (x) ] > >  Instead of using a function, when you call to ReadMem(), the code is > INCLUDED, (no function is called, the "compiler" just subs

Re: standard libraries don't behave like standard 'libraries'

2009-11-12 Thread Sriram Srinivasan
> So all libraries written have to use the common subset, which - unless > things are *removed*, which with python3 actually happened - is always > the oldest interpreter. And if a feature goes away, they have to be > rewritten with the then common subset. you see that's the problem with py3. inst

Re: python simply not scaleable enough for google?

2009-11-12 Thread Steven D'Aprano
On Thu, 12 Nov 2009 08:35:23 -0800, Joel Davis wrote: > obviously the GIL is a major reason it's so slow. No such "obviously" about it. There have been attempts to remove the GIL, and they lead to CPython becoming *slower*, not faster, for the still common case of single-core processors. And

Re: #define (from C) in Python

2009-11-12 Thread Stefan Behnel
Santiago Romero, 12.11.2009 17:43: > Is there a Python version of C's language #define statements? > > Example: > > #define ReadMem( (x) )memory[ (x) ] Yes: ReadMem = memory.__getitem__ Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: ask a question about the module

2009-11-12 Thread Daniel Fetchinson
> Could not import module "Gnuplot" - it is not installed on your > system. You need to install the Gnuplot.py package. > \easyviz\gnuplot_.py(41) : > Traceback (most recent call last): > File "E:\study\python\commodity modle 10.23.py", line 3, in > import multipleloop as mp > File "E:\stu

Re: #define (from C) in Python

2009-11-12 Thread Santiago Romero
On 12 nov, 18:16, Stefan Behnel wrote: > Santiago Romero, 12.11.2009 17:43: > > > Is there a Python version of C's language #define statements? > > > Example: > > > #define ReadMem( (x) )    memory[ (x) ] > > Yes: > >         ReadMem = memory.__getitem__ > > Stefan Well, In the above concrete e

Re: python simply not scaleable enough for google?

2009-11-12 Thread Alf P. Steinbach
* Steven D'Aprano: On Thu, 12 Nov 2009 08:35:23 -0800, Joel Davis wrote: obviously the GIL is a major reason it's so slow. http://en.wikipedia.org/wiki/Global_Interpreter_Lock Uh oh... No such "obviously" about it. There have been attempts to remove the GIL, and they lead to CPython be

Re: python simply not scaleable enough for google?

2009-11-12 Thread J Kenneth King
mcherm writes: > On Nov 11, 7:38 pm, Vincent Manis wrote: >> 1. The statement `Python is slow' doesn't make any sense to me. >> Python is a programming language; it is implementations that have >> speed or lack thereof. >[...] >> 2. A skilled programmer could build an implementation that com

Re: #define (from C) in Python

2009-11-12 Thread Stefan Behnel
Santiago Romero, 12.11.2009 18:23: > #define LD_r_n(reg) (reg) = Z80ReadMem(r_PC++) > > #define LD_rr_nn(reg) r_opl = Z80ReadMem(r_PC); r_PC++; \ > r_oph = Z80ReadMem(r_PC); r_PC++; \ > reg = r_op > > #define LOAD_r(dreg, saddreg) (dreg)=Z80Read

Re: Writing an emulator in python - implementation questions (for performance)

2009-11-12 Thread Santiago Romero
> You can do clever memory slicing like this with numpy.  For instance: > > breg = numpy.zeros((16,),numpy.uint8) > wreg = numpy.ndarray((8,),numpy.uint16,breg) > > This causes breg and wreg to share the same 16 bytes of memory.  You > can define constants to access specific registers: What I'm d

Re: How can a module know the module that imported it?

2009-11-12 Thread AK Eric
so: # moduleA.py import moduleB # moduleB.py import sys stuff = sys._getframe(1).f_locals print stuff Prints: {'__builtins__': , '__file__': 'C:\\Documents and SettingsMy Documents\ \python\\moduleA.py', '__name__': '__main__', '__doc__': None} Looks like you could query stuff['__file__']

Re: Writing an emulator in python - implementation questions (for performance)

2009-11-12 Thread Santiago Romero
Oops, numpy arrays start with index=0 :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: standard libraries don't behave like standard 'libraries'

2009-11-12 Thread Benjamin Kaplan
On Thu, Nov 12, 2009 at 12:05 PM, Sriram Srinivasan wrote: >> So all libraries written have to use the common subset, which - unless >> things are *removed*, which with python3 actually happened - is always >> the oldest interpreter. And if a feature goes away, they have to be >> rewritten with th

Re: How can a module know the module that imported it?

2009-11-12 Thread Ethan Furman
AK Eric wrote: so: # moduleA.py import moduleB # moduleB.py import sys stuff = sys._getframe(1).f_locals print stuff Prints: {'__builtins__': , '__file__': 'C:\\Documents and SettingsMy Documents\ \python\\moduleA.py', '__name__': '__main__', '__doc__': None} Looks like you could query s

Re: How can a module know the module that imported it?

2009-11-12 Thread AK Eric
On Nov 12, 10:10 am, Ethan Furman wrote: > AK Eric wrote: > > so: > > > # moduleA.py > > import moduleB > > > # moduleB.py > > import sys > > stuff = sys._getframe(1).f_locals > > print stuff > > > Prints: > > > {'__builtins__': , > > '__file__': 'C:\\Documents and SettingsMy Documents\ > > \p

QuerySets in Dictionaries

2009-11-12 Thread scoopseven
I need to create a dictionary of querysets. I have code that looks like: query1 = Myobject.objects.filter(status=1) query2 = Myobject.objects.filter(status=2) query3 = Myobject.objects.filter(status=3) d={} d['a'] = query1 d['b'] = query2 d['c'] = query3 Is there a way to do this that I'm missi

Re: (OT) Recommend FTP Client

2009-11-12 Thread Tim Chase
Someone on this list just recommended I find an ftp client that enables me to change line endings. He indicated that it would be easy, but googling I haven't been able to find one. I would prefer a free client, but whatever. Please send me a recommendation. How about the command line client that

Re: python simply not scaleable enough for google?

2009-11-12 Thread Rami Chowdhury
On Thu, 12 Nov 2009 09:32:28 -0800, Alf P. Steinbach wrote: This also seems religious. It's like in Norway it became illegal to market lemon soda, since umpteen years ago it's soda with lemon flavoring. This has to do with the *origin* of the citric acid, whether natural or chemist's con

Re: #define (from C) in Python

2009-11-12 Thread TerryP
If it's such a big hairy deal, just recompile a copy of the C Pre Processor to use something other then #, and hook it up to your python scripts in a pipe line from a shell wrapper. Personally, I'd rather have Lisps lambda or perls sub then Cs preprocessor, and even in those cases, Python suffices

Re: QuerySets in Dictionaries

2009-11-12 Thread Simon Brunning
2009/11/12 scoopseven : > I need to create a dictionary of querysets.  I have code that looks > like: > > query1 = Myobject.objects.filter(status=1) > query2 = Myobject.objects.filter(status=2) > query3 = Myobject.objects.filter(status=3) > > d={} > d['a'] = query1 > d['b'] = query2 > d['c'] = quer

Re: QuerySets in Dictionaries

2009-11-12 Thread Diez B. Roggisch
scoopseven schrieb: I need to create a dictionary of querysets. I have code that looks like: query1 = Myobject.objects.filter(status=1) query2 = Myobject.objects.filter(status=2) query3 = Myobject.objects.filter(status=3) d={} d['a'] = query1 d['b'] = query2 d['c'] = query3 Is there a way to

Computing the 1000th prime

2009-11-12 Thread Ray Holt
I have an assigment to find the 1000th. prime using python. What's wrong with the following code: PrimeCount = 0 PrimeCandidate = 1 while PrimeCount < 2000: IsPrime = True PrimeCandidate = PrimeCandidate + 2 for x in range(2, PrimeCandidate): if PrimeCandidate % x == 0: ##

Re: regex remove closest tag

2009-11-12 Thread MRAB
S.Selvam wrote: Hi all, 1) I need to remove the tags which is just before the keyword(i.e some_text2 ) excluding others. 2) input string may or may not contain tags. 3) Sample input: inputstr = """start some_text1 href="">some_text2 keyword anything""" 4) I came up with the follo

Re: python simply not scaleable enough for google?

2009-11-12 Thread Alf P. Steinbach
* Rami Chowdhury: On Thu, 12 Nov 2009 09:32:28 -0800, Alf P. Steinbach wrote: This also seems religious. It's like in Norway it became illegal to market lemon soda, since umpteen years ago it's soda with lemon flavoring. This has to do with the *origin* of the citric acid, whether natural o

Re: (OT) Recommend FTP Client

2009-11-12 Thread Dave Angel
Victor Subervi wrote: Hi; Someone on this list just recommended I find an ftp client that enables me to change line endings. He indicated that it would be easy, but googling I haven't been able to find one. I would prefer a free client, but whatever. Please send me a recommendation. TIA, Victor

Re: python with echo

2009-11-12 Thread MRAB
Steven D'Aprano wrote: On Wed, 11 Nov 2009 17:24:37 -0800, hong zhang wrote: List, I have a question of python using echo. POWER = 14 return_value = os.system('echo 14 > /sys/class/net/wlan1/device/tx_power') can assign 14 to tx_power But return_value = os.system('echo $POWER > /sys/class/n

Re: Does turtle graphics have the wrong associations?

2009-11-12 Thread Terry Reedy
Alf P. Steinbach wrote: One reaction to http://preview.tinyurl.com/ProgrammingBookP3> has been that turtle graphics may be off-putting to some readers because it is associated with children's learning. What do you think? I just started using the module for simple plots. I am not a child. You

Re: Does turtle graphics have the wrong associations?

2009-11-12 Thread AK Eric
On Nov 12, 11:31 am, Terry Reedy wrote: > Alf P. Steinbach wrote: > > One reaction to >http://preview.tinyurl.com/ProgrammingBookP3> has been that turtle > > graphics may be off-putting to some readers because it is associated > > with children's learning. > > > What do you think? > > I just star

Re: python simply not scaleable enough for google?

2009-11-12 Thread Rami Chowdhury
On Thu, 12 Nov 2009 11:24:18 -0800, Alf P. Steinbach wrote: * Rami Chowdhury: On Thu, 12 Nov 2009 09:32:28 -0800, Alf P. Steinbach wrote: This also seems religious. It's like in Norway it became illegal to market lemon soda, since umpteen years ago it's soda with lemon flavoring. Thi

Re: Computing the 1000th prime

2009-11-12 Thread MRAB
Ray Holt wrote: I have an assigment to find the 1000th. prime using python. What's wrong with the following code: PrimeCount = 0 PrimeCandidate = 1 while PrimeCount < 2000: IsPrime = True PrimeCandidate = PrimeCandidate + 2 for x in range(2, PrimeCandidate): if PrimeCandidate

Re: (OT) Recommend FTP Client

2009-11-12 Thread Victor Subervi
Thanks. V On Thu, Nov 12, 2009 at 2:26 PM, Dave Angel wrote: > > > Victor Subervi wrote: > >> Hi; >> Someone on this list just recommended I find an ftp client that enables me >> to change line endings. He indicated that it would be easy, but googling I >> haven't been able to find one. I would

3.x and 2.x on same machine (is this info at Python.org??)

2009-11-12 Thread rantingrick
Hello, Currently i am using 2.6 on Windows and need to start writing code in 3.0. I cannot leave 2.x yet because 3rd party modules are still not converted. So i want to install 3.0 without disturbing my current Python2.x. What i'm afraid of is that some SYSVARIABLE will get changed to Python3.0 an

Re: python simply not scaleable enough for google?

2009-11-12 Thread Alf P. Steinbach
* Rami Chowdhury: On Thu, 12 Nov 2009 11:24:18 -0800, Alf P. Steinbach wrote: * Rami Chowdhury: On Thu, 12 Nov 2009 09:32:28 -0800, Alf P. Steinbach wrote: This also seems religious. It's like in Norway it became illegal to market lemon soda, since umpteen years ago it's soda with lemon

Re: Computing the 1000th prime

2009-11-12 Thread Benjamin Kaplan
On Thursday, November 12, 2009, Ray Holt wrote: > > > > > > I have an assigment > to find the 1000th. prime using python. What's wrong with the following > code: > PrimeCount = > 0 > PrimeCandidate = 1 > while PrimeCount < 2000: > > IsPrime = True >     PrimeCandidate = PrimeCandidate + > 2 >    

Psyco on 64-bit machines

2009-11-12 Thread Russ P.
I have a Python program that runs too slow for some inputs. I would like to speed it up without rewriting any code. Psyco seemed like exactly what I need, until I saw that it only works on a 32-bit architecture. I work in an environment of Sun Ultras that are all 64- bit. However, the Psyco docs sa

Re: Computing the 1000th prime

2009-11-12 Thread Benjamin Kaplan
On Thursday, November 12, 2009, Benjamin Kaplan wrote: > On Thursday, November 12, 2009, Ray Holt wrote: >> >> >> >> >> >> I have an assigment >> to find the 1000th. prime using python. What's wrong with the following >> code: >> PrimeCount = >> 0 >> PrimeCandidate = 1 >> while PrimeCount < 2000:

Re: python simply not scaleable enough for google?

2009-11-12 Thread Rami Chowdhury
On Thu, 12 Nov 2009 12:02:11 -0800, Alf P. Steinbach wrote: I think that was in the part you *snipped* here. Just fill in the mentioned qualifications and weasel words. OK, sure. I don't think they're weasel words, because I find them useful, but I think I see where you're coming from. S

Re: Psyco on 64-bit machines

2009-11-12 Thread Chris Kaynor
On Thu, Nov 12, 2009 at 12:06 PM, Russ P. wrote: > I have a Python program that runs too slow for some inputs. I would > like to speed it up without rewriting any code. Psyco seemed like > exactly what I need, until I saw that it only works on a 32-bit > architecture. I work in an environment of

Re: python simply not scaleable enough for google?

2009-11-12 Thread Benjamin Kaplan
On Thu, Nov 12, 2009 at 2:24 PM, Alf P. Steinbach wrote: > > You'll also find it impossible to rigorously define "dynamic language" in a > general way so that that definition excludes C++. > > So, to anyone who understands what one is talking about, "interpreted", or > e.g. "slow language" (as wa

Re: 3.x and 2.x on same machine (is this info at Python.org??)

2009-11-12 Thread Benjamin Kaplan
On Thu, Nov 12, 2009 at 2:52 PM, rantingrick wrote: > Hello, > > Currently i am using 2.6 on Windows and need to start writing code in > 3.0. I cannot leave 2.x yet because 3rd party modules are still not > converted. So i want to install 3.0 without disturbing my current > Python2.x. What i'm afr

Re: 3.x and 2.x on same machine (is this info at Python.org??)

2009-11-12 Thread Terry Reedy
rantingrick wrote: Hello, Currently i am using 2.6 on Windows and need to start writing code in 3.0. I cannot leave 2.x yet because 3rd party modules are still not converted. So i want to install 3.0 without disturbing my current Python2.x. What i'm afraid of is that some SYSVARIABLE will get ch

Re: Computing the 1000th prime

2009-11-12 Thread Dave Angel
Ray Holt wrote: I have an assigment to find the 1000th. prime using python. What's wrong with the following code: PrimeCount = 0 PrimeCandidate = 1 while PrimeCount < 2000: IsPrime = True PrimeCandidate = PrimeCandidate + 2 for x in range(2, PrimeCandidate): if PrimeCandidate

Re: Python & Go

2009-11-12 Thread Patrick Sabin
Carl Banks wrote: Well, it's hard to argue with not being like C++, but the lack of inheritance is a doozie. Well it has the concept of embedding, which seems to be similar to inheritance. - Patrick -- http://mail.python.org/mailman/listinfo/python-list

Re: (OT) Recommend FTP Client

2009-11-12 Thread David M. Besonen
On 11/12/2009 11:26 AM, Dave Angel wrote: > Try http://fireftp.mozdev.org/ in the past i found this to be buggy. i'd recommend something different. what is your OS? -- david -- http://mail.python.org/mailman/listinfo/python-list

Re: python simply not scaleable enough for google?

2009-11-12 Thread Rami Chowdhury
On Thu, 12 Nov 2009 12:44:00 -0800, Benjamin Kaplan wrote: Some one could even write an interpreter for C++ if they wanted to. Someone has (http://root.cern.ch/drupal/content/cint)! -- Rami Chowdhury "Never attribute to malice that which can be attributed to stupidity" -- Hanlon's Razor

  1   2   >