Re: Idioms and Anti-Idioms Question
Ben Charrow wrote: I have a question about the Using Backslash to Continue Statements in the howto Idioms and Anti-Idioms in Python (http://docs.python.org/howto/doanddont.html#using-backslash-to-continue-statements) It says: ...if the code was: value = foo.bar()['first'][0]*baz.quux(1, 2)[5:9] \ + calculate_number(10, 20)*forbulate(500, 360) then it would just be subtly wrong. What is subtly wrong about this piece of code? I can't see any bugs and can't think of subtle gotchas (e.g. the '\' is removed or the lines become separated, because in both cases an IndentationError would be raised). The preferred style is to put the binary operators before the line-break (i.e. the line break is after the operators): value = foo.bar()['first'][0]*baz.quux(1, 2)[5:9] + \ calculate_number(10, 20)*forbulate(500, 360) and even more preferrable is NOT to use explicit line break at all; relying on implicit breaking with parentheses since then you won't need to worry about empty lines: value = (foo.bar()['first'][0]*baz.quux(1, 2)[5:9] + calculate_number(10, 20)*forbulate(500, 360) ) although, in a formula that is so complex, the most preferable way is to separate them so they won't need to take more than a single line: a = foo.bar()['first'][0] b = baz.quux(1, 2)[5:9] c = calculate_number(10, 20) d = forbulate(500, 360) value = a*b + c*d of course, a, b, c, d should be substituted with a more helpful names. The following is an extract from PEP 8: The preferred way of wrapping long lines is by using Python's implied line continuation inside parentheses, brackets and braces. If necessary, you can add an extra pair of parentheses around an expression, but sometimes using a backslash looks better. Make sure to indent the continued line appropriately. The preferred place to break around a binary operator is *after* the operator, not before it. -- http://mail.python.org/mailman/listinfo/python-list
Re: Re: Help: Group based synchronize decorator
Thanks. - vishal -Original Message- Sent: Friday, June 19, 2009 3:15 PM To: python-list@python.org Subject: Python-list Digest, Vol 69, Issue 214 Message: 6 Date: Fri, 19 Jun 2009 10:53:27 +0200 From: Piet van Oostrum p...@cs.uu.nl To: python-list@python.org Subject: Re: Help: Group based synchronize decorator Message-ID: m2zlc4r4e0@cs.uu.nl Content-Type: text/plain; charset=us-ascii Vishal Shetye (VS) wrote: VS I want to synchronize calls using rw locks per 'group' and my implementation is similar to VS http://code.activestate.com/recipes/465057/ VS except that I have my own Lock implementation. VS All my synchronized functions take 'whatGroup' as param. My lock considers 'group' while deciding on granting locks through acquire. VS What I could come up with is: VS - decorator knows(assumes) first param to decorated functions is always 'whatGroup' VS - decorator passes this 'whatGroup' argument to my lock which is used in acquire logic. VS Is it ok to make such assumptions in decorator? As long as you make sure that all decorated functions indeed adhere to that assumption there is nothing wrong with it. -- Piet van Oostrum p...@cs.uu.nl URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4] Private email: p...@vanoostrum.org DISCLAIMER == This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails. -- http://mail.python.org/mailman/listinfo/python-list
Re: RE: RE: Good books in computer science?
in 118305 20090621 214008 Phil Runciman ph...@aspexconsulting.co.nz wrote: How many instruction sets have you used? I have used at least 9. IBM 1401 IBM 1410 IBM 7090/7094 IBM 1620 IBM 360 IBM System/7 IBM 1130 IBM 1800 IBM Series/1 Intel 8080 etc Motorola 6800 etc Texas 9900 (my second favourite) plus a bunch of IBM microprocessor cards (eg Woodstock). -- http://mail.python.org/mailman/listinfo/python-list
Re: failed to build decompyle/unpyc project on WindowsXP
Hello! Project: http://unpyc.googlecode.com/svn/trunk/ For resolve problem You must: 1. modify file setup.py replace ext_modules = [Extension('unpyc/marshal_20', ['unpyc/'], define_macros=[]), Extension('unpyc/marshal_21', ['unpyc/marshal_21.c'], define_macros=[]), Extension('unpyc/marshal_22', ['unpyc/marshal_22.c'], define_macros=[]), Extension('unpyc/marshal_23', ['unpyc/marshal_23.c'], define_macros=[]), Extension('unpyc/marshal_24', ['unpyc/marshal_24.c'], define_macros=[]), Extension('unpyc/marshal_25', ['unpyc/marshal_25.c'], define_macros=[]), Extension('unpyc/marshal_26', ['unpyc/marshal_26.c'], define_macros=[]), ] on ext_modules = [Extension('marshal_20', ['marshal_20.c'], define_macros=[]), Extension('marshal_21', ['marshal_21.c'], define_macros=[]), Extension('marshal_22', ['marshal_22.c'], define_macros=[]), Extension('marshal_23', ['marshal_23.c'], define_macros=[]), Extension('marshal_24', ['marshal_24.c'], define_macros=[]), Extension('marshal_25', ['marshal_25.c'], define_macros=[]), Extension('marshal_26', ['marshal_26.c'], define_macros=[]), ] 2. сopy files marshal_20.c marshal_21.c marshal_22.c marshal_23.c marshal_24.c marshal_25.c marshal_26.c from unpyc directory to ..\unpyc near setup.py file. 3. Run python.exe setup.py install -- http://mail.python.org/mailman/listinfo/python-list
Re: Can I replace this for loop with a join?
Ben Finney wrote: Paul Watson paul.hermeneu...@gmail.com writes: On Mon, 2009-04-13 at 17:03 +0200, WP wrote: dict = {1:'astring', 2:'anotherstring'} for key in dict.keys(): print 'Press %i for %s' % (key, dict[key]) In addition to the comments already made, this code will be quite broken if there is ever a need to localize your package in another language. How is this code especially broken? AFAICT, it merely needs the strings marked for translation, which is the best i18n situation any regular program can hope for anyway. The problem is that some language might require you to write For X press Y, which is impossible to achieve here. I think percent-formatting supports using keys, like Press %{key} for %{action} % {'key': key, 'action':dict[key]} However, I would also like to hear what Paul really meant and also the alternatives he proposes. Uli -- Sator Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 -- http://mail.python.org/mailman/listinfo/python-list
Re: Can I replace this for loop with a join?
WP no.i.d...@want.mail.from.spammers.com writes: I could do it like this: dict = {1:'astring', 2:'anotherstring'} for key in dict.keys(): print 'Press %i for %s' % (key, dict[key]) Press 1 for astring Press 2 for anotherstring Note that dict.keys() will return the keys in random order. but can I use a join instead? print '\n'.join('Press %s for %s' for (k,v) in sorted(dict.iteritems())) (untested) should print them in order. Yes it is ok to use %s to format integers. Note: normally you should not call your dictionary 'dict', since 'dict' is a built-in value and overriding it could confuse people and/or code. -- http://mail.python.org/mailman/listinfo/python-list
ctypes list library
There is a command for ctypes that help me to know the entry points inside a library. Thanks Luca -- http://mail.python.org/mailman/listinfo/python-list
error when use libgmail with proxy
Hi all, Does anybody use libgmail with proxy? I met error here. Below is code snip: libgmail.PROXY_URL = G_PROXY # the proxy url self.ga = libgmail.GmailAccount(account,pwd) self.ga.login() Error information: ga.login () File C:\Python25\Lib\site-packages\libgmail.py, line 305, in login pageData = self._retrievePage (req) File C:\Python25\Lib\site-packages\libgmail.py, line 348, in _retrievePage resp = self.opener.open (req) File build\bdist.win32\egg\mechanize\_opener.py, line 191, in open File C:\Python25\lib\urllib2.py, line 399, in _open '_open', req) File C:\Python25\lib\urllib2.py, line 360, in _call_chain result = func (*args) File build\bdist.win32\egg\mechanize\_http.py, line 751, in https_open AttributeError: 'int' object has no attribute 'find_key_cert' Is it possible the issue of mechanize? -- http://mail.python.org/mailman/listinfo/python-list
Re: os.system vs subprocess
Nate wrote: Thanks for your response. Related to this talk about shells, maybe you could point me towards a resource where I could read about how windows commands are processed w/w/o shells? I guess I assumed all subprocess commands were intepreted by the same thing, cmd.exe., or perhaps the shell. Just a comment here: on Windows, you almost *never* need to specify shell=True. Certainly, far less than most people seem to think you need to. The only things which certainly need shell to be set True are those which don't really exist as programs in their own right: dir, copy etc. You don't need to set it for batch files (altho' this does seem to vary slightly between versions) and you certainly don't need to set it for console programs in general, such as Python. code import subprocess subprocess.call ([dir], shell=False) subprocess.call ([dir], shell=True) with open (test.bat, w) as f: f.write (echo hello) subprocess.call ([test.bat], shell=False) subprocess.call ([python, -c, import sys; print sys.executable], shell=False) /code This all works as expected using Python 2.6.1 on WinXP SP3 TJG -- http://mail.python.org/mailman/listinfo/python-list
Re: Idioms and Anti-Idioms Question
In message h0f%l.20231$y61.5...@news-server.bigpond.net.au, Lie Ryan wrote: The preferred style is to put the binary operators before the line-break ... Not by me. I prefer using a two-dimensional layout to make the expression structure more obvious: value = \ ( foo.bar()['first'][0] * baz.quux(1, 2)[5:9] + calculate_number(10, 20) * forbulate(500, 360) ) In this case it's not necessary, but if the factors were really long, this could become value = \ ( foo.bar()['first'][0] * baz.quux(1, 2)[5:9] + calculate_number(10, 20) * forbulate(500, 360) ) -- http://mail.python.org/mailman/listinfo/python-list
Re: Status of Python threading support (GIL removal)?
Paul Rubin http://phr...@nospam.invalid wrote: Hendrik van Rooyen m...@microcorp.co.za writes: I think that this is because (like your link has shown) the problem is really not trivial, and also because the model that can bring sanity to the party (independent threads/processes that communicate with queued messages) is seen as inefficient at small scale. That style works pretty well in Python and other languages. The main gripe about it for Python is the subject of this thread, i.e. the GIL. I have found that if you accept it, and sprinkle a few judicious time.sleep(short_time)'s around, things work well. Sort of choosing yourself when the thread gives up its turn. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list
Re: raw_input with a pre-compiled data
On Sun, Jun 21, 2009 at 12:51 PM, Peter Otten__pete...@web.de wrote: With traduced you stumbled upon another false friend ;) http://it.wikipedia.org/wiki/Falso_amico D'oh!!! x-) import readline def input_default(prompt, default): def startup_hook(): readline.insert_text(default) readline.set_startup_hook(startup_hook) try: return raw_input(prompt) finally: readline.set_startup_hook(None) print input_default(directory? , default=/home/john) Thanks! It works! This is working on Linux and MacOS too. The readline module is specific to Unix implementations. I don't know what OS the OP was using. Any one knows is this working also on Windows? I've no Win system right no to test this... -- -- luca -- http://mail.python.org/mailman/listinfo/python-list
Re: raw_input with a pre-compiled data
On Mon, Jun 22, 2009 at 1:19 AM, Lucaluca...@gmail.com wrote: On Sun, Jun 21, 2009 at 12:51 PM, Peter Otten__pete...@web.de wrote: With traduced you stumbled upon another false friend ;) http://it.wikipedia.org/wiki/Falso_amico D'oh!!! x-) import readline def input_default(prompt, default): def startup_hook(): readline.insert_text(default) readline.set_startup_hook(startup_hook) try: return raw_input(prompt) finally: readline.set_startup_hook(None) print input_default(directory? , default=/home/john) Thanks! It works! This is working on Linux and MacOS too. The readline module is specific to Unix implementations. I don't know what OS the OP was using. Any one knows is this working also on Windows? I've no Win system right no to test this... No, it won't. specific to Unix == Unix-only Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: ctypes list library
luca72 schrieb: There is a command for ctypes that help me to know the entry points inside a library. dir() on a loaded library? But it won't do you any good, without having the header-file you can't possibly know what the functions take for parameters. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: raw_input with a pre-compiled data
Luca wrote: On Sun, Jun 21, 2009 at 12:51 PM, Peter Otten__pete...@web.de wrote: import readline Any one knows is this working also on Windows? I've no Win system right no to test this... I do not have Windows available, either, but you might try http://ipython.scipy.org/moin/PyReadline/Intro Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: ctypes list library
Thanks for your reply. I have another question i can load a list of library? Thanks Luca -- http://mail.python.org/mailman/listinfo/python-list
Re: ctypes list library
luca72 schrieb: Thanks for your reply. I have another question i can load a list of library? Yes. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Missing c.l.py posts (was Re: A question on scope...)
Aahz a écrit : In article 4a3b5dc3$0$2985$426a7...@news.free.fr, Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid wrote: NB : answering the OP (original post didn't show up on c.l.py ???) Correct. There's a problem with the mail-news gateway, I think that MIME messages are failing. I fixed the problem for c.l.py.announce by making the list reject non-ASCII messages, but I don't think that's an option for python-list. Hu, I see. FWIW, it's not the first time I observe this (posts not showing up, only answers...), but at least I now know why. Well, I guess it might be possible to have the gateway extract the text part from MIME messages, but I'm not sure I'd volunteer to work on this... Just out of curiousity, where can I find more infos on this gateway ? -- http://mail.python.org/mailman/listinfo/python-list
Re: ctypes list library
luca72 lucabe...@libero.it wrote: There is a command for ctypes that help me to know the entry points inside a library. I don't know.. However nm on the library works quite well on the command line $ nm --defined-only -D /usr/lib/libdl.so A GLIBC_2.0 A GLIBC_2.1 A GLIBC_2.3.3 A GLIBC_2.3.4 A GLIBC_PRIVATE 304c B _dlfcn_hook 13b0 T dladdr 1400 T dladdr1 0ca0 T dlclose 1170 T dlerror 1490 T dlinfo 1760 T dlmopen 0ae0 T dlopen 18d0 T dlopen 0cf0 T dlsym 0dd0 W dlvsym nm from the mingw distribution works on Windows too IIRC. -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list
Re: Convert hash to struct
D'Arcy J.M. Cain da...@druid.net wrote: On Fri, 19 Jun 2009 13:17:24 -0500 Amita Ekbote amita.ekb...@gmail.com wrote: I am retrieving values from a database in the form of a dictionary so I can access the values as d['column'] and I was wondering if there is a way to convert the hash to a struct like format so i can just say d.column. Makes it easier to read and understand. Are there enough clues here? class MyDict(dict): def __getattribute__(self, name): return dict.__getattribute__(self, name) def __getattr__(self, name): return self.get(name, 42) x = MyDict({'a': 1, 'b': 2, 'values': 3}) That is my preferred solution - subclass dict rather than make a new type... I use this a lot for returning results from databases. Here is a more fleshed out version. Changing KeyError to AttributeError is necessary if you want the object to pickle. class MyDict(dict): A dictionary with attribute access also. If a builtin dictionary method collides with a member of the dictionary, the member function will win. def __getattr__(self, name): try: return super(db_dict, self).__getitem__(name) except KeyError: raise AttributeError(%r object has no attribute %r % (self.__class__.__name__, name)) def __setattr__(self, name, value): return super(db_dict, self).__setitem__(name, value) def __delattr__(self, name): try: return super(db_dict, self).__delitem__(name) except KeyError: raise AttributeError(%r object has no attribute %r % (self.__class__.__name__, name)) def copy(self): return MyDict(self) print x.a print x.z print x.values Big question - what should the last line display? If you expect 3 and not built-in method values of MyDict object at 0xbb82838c then you need to reconsider the above implementation. Thinking about the question may change your opinion about this being a good idea after all. Indeed! -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list
Re: ctypes list library
Diez B. Roggisch wrote: luca72 schrieb: There is a command for ctypes that help me to know the entry points inside a library. dir() on a loaded library? But it won't do you any good, without having the header-file you can't possibly know what the functions take for parameters. I was trying this right now, but I can't even get the exported function names: from ctypes import * l = cdll.msvcrt type(l) class 'ctypes.CDLL' dir(l) ['_FuncPtr', '__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__ge__', '__getattr__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_func_flags_', '_func_restype_', '_handle', '_name'] shouldn't the C functions names be there? -- http://mail.python.org/mailman/listinfo/python-list
Re: ctypes list library
Carlo Salinari wrote: Diez B. Roggisch wrote: luca72 schrieb: There is a command for ctypes that help me to know the entry points inside a library. dir() on a loaded library? But it won't do you any good, without having the header-file you can't possibly know what the functions take for parameters. I was trying this right now, but I can't even get the exported function names: To be honest, I wasn't 100% sure about this. That was the reason for the ?, but I admit that I should have phrased it more explicitly. But again, it is pretty useless anyway. Diez -- http://mail.python.org/mailman/listinfo/python-list
Check module without import it
Is there any way to check that it's installed a module without import it directly? I'm using the nex code but it's possible that it not been necessary to import a module - try: import module except ImportError: pass else: print 'make anything' - -- http://mail.python.org/mailman/listinfo/python-list
Re: error when use libgmail with proxy
On Jun 22, 3:33 pm, 马不停蹄的猪 sunrui...@gmail.com wrote: Hi all, Does anybody use libgmail with proxy? I met error here. Below is code snip: libgmail.PROXY_URL = G_PROXY # the proxy url self.ga = libgmail.GmailAccount(account,pwd) self.ga.login() Error information: ga.login () File C:\Python25\Lib\site-packages\libgmail.py, line 305, in login pageData = self._retrievePage (req) File C:\Python25\Lib\site-packages\libgmail.py, line 348, in _retrievePage resp = self.opener.open (req) File build\bdist.win32\egg\mechanize\_opener.py, line 191, in open File C:\Python25\lib\urllib2.py, line 399, in _open '_open', req) File C:\Python25\lib\urllib2.py, line 360, in _call_chain result = func (*args) File build\bdist.win32\egg\mechanize\_http.py, line 751, in https_open AttributeError: 'int' object has no attribute 'find_key_cert' Is it possible the issue of mechanize? I do not know why you need proxy. i have used gdata do the same work like you. then i descript it in my blog: vincent-w.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: python needs a tutorial for install and setup on a Mac
On Sun, Jun 21, 2009 at 9:04 PM, Vincent Davisvinc...@vincentdavis.net wrote: I am running python on a mac and when I was getting going it was difficult to setup information. Specifically how modify bash_profile, how pythonpath works and how to set it up. how to switch between python versions. How/where to install modules if you have multiple installed versions. I am thinking about this from perspective of a new pythoner (is there a word for a person who programs in python). I think many new pythoners may be like me and don't mess with the underling UNIX on a mac. My question/suggestion is that there be a nice tutorial for this. I am wiling to contribute much but I am still somewhat new to python and may need help with some details. Also where should this be posted, how do I post it. Do other think there is a need? Any willing to help? But of course I may have missed a great tutorial out there if so I think It needs to be easier to findor I need to learn how to look. Have you seen the page at http://www.python.org/download/mac/ and the pages linked from it? -- kushal -- http://mail.python.org/mailman/listinfo/python-list
Re: error when use libgmail with proxy
On 22 июн, 10:33, 马不停蹄的猪 sunrui...@gmail.com wrote: Hi all, Does anybody use libgmail with proxy? I met error here. I wouldn't recommend to use this module at all. It was writtent at the time when no IMAP was available at Google. Now there are POP and IMAP, so it's better to use them. -- http://mail.python.org/mailman/listinfo/python-list
Re: Idioms and Anti-Idioms Question
Op maandag 22 juni 2009, schreef Lawrence D'Oliveiro: value = \ ( foo.bar()['first'][0] * baz.quux(1, 2)[5:9] + calculate_number(10, 20) * forbulate(500, 360) ) I' prefer: value = (foo.bar()['first'][0] * baz.quux(1, 2)[5:9] + calculate_number(10, 20) * forbulate(500, 360)) w best regards, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi -- http://mail.python.org/mailman/listinfo/python-list
Re: python needs a tutorial for install and setup on a Mac
On 22 juin, 12:44, Kushal Kumaran kushal.kumaran+pyt...@gmail.com wrote: On Sun, Jun 21, 2009 at 9:04 PM, Vincent Davisvinc...@vincentdavis.net wrote: I am running python on a mac and when I was getting going it was difficult to setup information. Specifically how modify bash_profile, how pythonpath works and how to set it up. how to switch between python versions. How/where to install modules if you have multiple installed versions. I am thinking about this from perspective of a new pythoner (is there a word for a person who programs in python). I think many new pythoners may be like me and don't mess with the underling UNIX on a mac. My question/suggestion is that there be a nice tutorial for this. I am wiling to contribute much but I am still somewhat new to python and may need help with some details. Also where should this be posted, how do I post it. Do other think there is a need? Any willing to help? But of course I may have missed a great tutorial out there if so I think It needs to be easier to findor I need to learn how to look. Have you seen the page athttp://www.python.org/download/mac/and the pages linked from it? do you think a pythonista can go further than the given example ? 2 + 2 4 ;-) Olivier -- http://mail.python.org/mailman/listinfo/python-list
Re: python needs a tutorial for install and setup on a Mac
On 22 juin, 12:44, Kushal Kumaran Have you seen the page athttp://www.python.org/download/mac/and the pages linked from it? As a (usefull) add-on : iPython (a must), I found this page a good help : http://www.brianberliner.com/2008/04/ipython-on-mac-os-x-105-leopard/ Olivier -- http://mail.python.org/mailman/listinfo/python-list
Re: Inheritance and forward references (prototypes)
On 21 Jun., 22:51, Scott David Daniels scott.dani...@acm.org wrote: LorenzoDiGregoriowrote: On 21 Jun., 01:54, Dave Angel da...@ieee.org wrote: ... class B(object): def __init__(self,test=None): if test==None: test = A() self.obj =() return ... I had also thought of using None (or whatever else) as a marker but I was curious to find out whether there are better ways to supply an object with standard values as a default argument. In this sense, I was looking for problems ;-) Of course the observation that def is an instruction and no declaration changes the situation: I would not have a new object being constructed for every instantiation with no optional argument, because __init__ gets executed on the instantiation but test=A() gets executed on reading 'def' If what you are worrying about is having a single default object, you could do something like this: class B(object): _default = None def __init__(self, test=None): if test is None: test = self._default if test is None: B._default = test = A() ... --Scott David Daniels scott.dani...@acm.org- Zitierten Text ausblenden - - Zitierten Text anzeigen - Well, I could also declare (ups, define ;-)) __init__(self,**kwargs) and within the __init__, if kwargs['test'] exists, do test = kwargs ['test'], if it does not exist, do test = A(). The point is that it would have been cleaner to place it straight in the __init__, but due to the semantic of 'def' this does not seem possible. -- http://mail.python.org/mailman/listinfo/python-list
Re: Idioms and Anti-Idioms Question
In message mailman.1941.1245668263.8015.python-l...@python.org, Wilbert Berendsen wrote: I' prefer: value = (foo.bar()['first'][0] * baz.quux(1, 2)[5:9] + calculate_number(10, 20) * forbulate(500, 360)) I prefer using a two-dimensional layout to make the expression structure more obvious: value = \ ( foo.bar()['first'][0] * baz.quux(1, 2)[5:9] + calculate_number(10, 20) * forbulate(500, 360) ) In this case it's not necessary, but if the factors were really long, this could become value = \ ( foo.bar()['first'][0] * baz.quux(1, 2)[5:9] + calculate_number(10, 20) * forbulate(500, 360) ) -- http://mail.python.org/mailman/listinfo/python-list
Re: ctypes list library
Can you tell me how load a list of library Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: python needs a tutorial for install and setup on a Mac
Switching between python version Lets assume you have python 2.4.x and now you installed 2.5.x.By default python path will point to 2.4.x. To switch to python 2.5.x, use following commands... cd /usr/bin sudo rm pythonw sudo ln -s /Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw pythonw sudo rm python sudo ln -s pythonw python2.5 sudo ln -s python2.5 python this worked for me... do let me know if any1 has other way of doing... Rgds, aberry Vincent Davis wrote: I am running python on a mac and when I was getting going it was difficult to setup information. Specifically how modify bash_profile, how pythonpath works and how to set it up. how to switch between python versions. How/where to install modules if you have multiple installed versions. I am thinking about this from perspective of a new pythoner (is there a word for a person who programs in python). I think many new pythoners may be like me and don't mess with the underling UNIX on a mac. My question/suggestion is that there be a nice tutorial for this. I am wiling to contribute much but I am still somewhat new to python and may need help with some details. Also where should this be posted, how do I post it. Do other think there is a need? Any willing to help? But of course I may have missed a great tutorial out there if so I think It needs to be easier to findor I need to learn how to look. Thanks Vincent -- http://mail.python.org/mailman/listinfo/python-list -- View this message in context: http://www.nabble.com/python-needs-a-tutorial-for-install-and-setup-on-a-Mac-tp24135580p24146279.html Sent from the Python - python-list mailing list archive at Nabble.com. -- http://mail.python.org/mailman/listinfo/python-list
Re: ctypes list library
luca72 wrote: Can you tell me how load a list of library from ctypes.util import find_library from ctypes import CDLL for name in list_of_libraries: lib = CDLL(find_library(name)) Do you actually read the documentation of ctypes? Or python, for that matter? Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: python needs a tutorial for install and setup on a Mac
aberry wrote: Switching between python version Lets assume you have python 2.4.x and now you installed 2.5.x.By default python path will point to 2.4.x. To switch to python 2.5.x, use following commands... cd /usr/bin sudo rm pythonw sudo ln -s /Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw pythonw sudo rm python sudo ln -s pythonw python2.5 sudo ln -s python2.5 python this worked for me... do let me know if any1 has other way of doing... Bad idea. It might break tools that need the /usr/bin/python to be the system's python. a simple export PATH=/Library/.../bin:$PATH inside .bashrc should be all you need. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: python needs a tutorial for install and setup on a Mac
I think a setup guide for the Mac would prove very useful. Earlier this year, I tried installing Python 2.6 on my iMac, and ran into all sorts of problems, largely as a result of the fact that I knew very little about Unix. I finally downloaded and installed the Enthought Python distribution for the Mac and it worked like a charm. -- http://mail.python.org/mailman/listinfo/python-list
Re: Measuring Fractal Dimension ?
On Jun 19, 8:13 pm, Charles Yeomans char...@declaresub.com wrote: On Jun 19, 2009, at 2:43 PM, David C. Ullrich wrote: Evidently my posts are appearing, since I see replies. I guess the question of why I don't see the posts themselves \is ot here... On Thu, 18 Jun 2009 17:01:12 -0700 (PDT), Mark Dickinson dicki...@gmail.com wrote: On Jun 18, 7:26 pm, David C. Ullrich ullr...@math.okstate.edu wrote: On Wed, 17 Jun 2009 08:18:52 -0700 (PDT), Mark Dickinson Right. Or rather, you treat it as the image of such a function, if you're being careful to distinguish the curve (a subset of R^2) from its parametrization (a continuous function R - R**2). It's the parametrization that's uniformly continuous, not the curve, Again, it doesn't really matter, but since you use the phrase if you're being careful: In fact what you say is exactly backwards - if you're being careful that subset of the plane is _not_ a curve (it's sometimes called the trace of the curve. Darn. So I've been getting it wrong all this time. Oh well, at least I'm not alone: De?nition 1. A simple closed curve J, also called a Jordan curve, is the image of a continuous one-to-one function from R/Z to R2. [...] - Tom Hales, in 'Jordan's Proof of the Jordan Curve Theorem'. We say that Gamma is a curve if it is the image in the plane or in space of an interval [a, b] of real numbers of a continuous function gamma. - Claude Tricot, 'Curves and Fractal Dimension' (Springer, 1995). Perhaps your definition of curve isn't as universal or 'official' as you seem to think it is? Perhaps not. I'm very surprised to see those definitions; I've been a mathematician for 25 years and I've never seen a curve defined a subset of the plane. I have. Hmm. You left out a bit in the first definition you cite: A simple closed curve J, also called a Jordan curve, is the image of a continuous one-to-one function from R/Z to R2. We assume that each curve comes with a fixed parametrization phi_J : R/Z -¨ J. We call t in R/Z the time parameter. By abuse of notation, we write J(t) in R2 instead of phi_j (t), using the same notation for the function phi_J and its image J. Close to sounding like he can't decide whether J is a set or a function... On the contrary, I find this definition to be written with some care. I find the usage of image slightly ambiguous (as it suggests the image set defines the curve), but that's my only qualm with it as well. Thinking pragmatically, you can't have non-simple curves unless you use multisets, and you also completely lose the notion of curve orientation and even continuity without making it a poset. At this point in time, parsimony says that you want to ditch your multiposet thingie (and God knows what else you want to tack in there to preserve other interesting curve properties) and really just want to define the curve as a freaking function and be done with it. -- http://mail.python.org/mailman/listinfo/python-list
Re: easiest way to check python version?
Here is what I use in easygui: pre #-- # check python version and take appropriate action #-- From the python documentation: sys.hexversion contains the version number encoded as a single integer. This is guaranteed to increase with each version, including proper support for non- production releases. For example, to test that the Python interpreter is at least version 1.5.2, use: if sys.hexversion = 0x010502F0: # use some advanced feature ... else: # use an alternative implementation or warn the user ... if sys.hexversion = 0x020600F0: runningPython26 = True else: runningPython26 = False if sys.hexversion = 0x03F0: runningPython3 = True else: runningPython3 = False if runningPython3: from tkinter import * import tkinter.filedialog as tk_FileDialog from io import StringIO else: from Tkinter import * import tkFileDialog as tk_FileDialog from StringIO import StringIO /pre -- Steve Ferg -- http://mail.python.org/mailman/listinfo/python-list
Re: python needs a tutorial for install and setup on a Mac
thanks for suggestion... what should I put in 'bashrc ' so that I can switch between different version. as python command will always point to one Python framework (lets either 2.4.x or 2.5.x). regards, aberry Diez B. Roggisch-2 wrote: aberry wrote: Switching between python version Lets assume you have python 2.4.x and now you installed 2.5.x.By default python path will point to 2.4.x. To switch to python 2.5.x, use following commands... cd /usr/bin sudo rm pythonw sudo ln -s /Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw pythonw sudo rm python sudo ln -s pythonw python2.5 sudo ln -s python2.5 python this worked for me... do let me know if any1 has other way of doing... Bad idea. It might break tools that need the /usr/bin/python to be the system's python. a simple export PATH=/Library/.../bin:$PATH inside .bashrc should be all you need. Diez -- http://mail.python.org/mailman/listinfo/python-list -- View this message in context: http://www.nabble.com/python-needs-a-tutorial-for-install-and-setup-on-a-Mac-tp24135580p24146713.html Sent from the Python - python-list mailing list archive at Nabble.com. -- http://mail.python.org/mailman/listinfo/python-list
Re: Perl's @foo[3,7,1,-1] ?
J. Cliff Dyer wrote: On Wed, 2009-06-17 at 14:13 +0200, Jean-Michel Pichavant wrote: On Wed, Jun 17, 2009 at 04:14, Steven D'Aprano wrote: What's np.arange? import numpy as np -- Pierre delroth Bourdon delr...@gmail.com Étudiant à l'EPITA / Student at EPITA Perfect example of why renaming namespaces should be done only when absolutely required, that is, almost never. Jean-Michel I disagree. Renaming namespaces should always be done if it will help stop people from doing a 'from package import *'. However, example code should always include relevant imports. Cheers, Cliff The import * should not used if possible, I totally agree on that point, but there's no need to rename namespaces for that. br Jean-Michel -- http://mail.python.org/mailman/listinfo/python-list
UnicodeDecodeError: problem when path contain folder start with character 'u
I am facing an error on Unicode decoding of path if it contain a folder/file name starting with character 'u' . Here is what I did in IDLE 1. fp = C:\\ab\\anil 2. unicode(fp, unicode_escape) 3. u'C:\x07b\x07nil' 4. fp = C:\\ab\\unil 5. unicode(fp, unicode_escape) 6. 7. Traceback (most recent call last): 8. File pyshell#41, line 1, in module 9. unicode(fp, unicode_escape) 10. UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 5-9: end of string in escape sequence 11. Not sure whether I am doing something wrong or this is as designed behavior . any help appreciated Rgds, aberry -- View this message in context: http://www.nabble.com/UnicodeDecodeError%3A-problem-when-path-contain-folder-start-with-character-%27u-tp24146775p24146775.html Sent from the Python - python-list mailing list archive at Nabble.com. -- http://mail.python.org/mailman/listinfo/python-list
Graphical library - charts
Hello, I have thousends of files with logs from monitoring system. Each file has some important data (numbers). I'd like to create charts using those numbers. Could you please suggest library which will allow creating such charts ? The preferred chart is line chart. Besides is there any library which allow me to zoom in/out of such chart ? Sometimes I need to create chart using long-term data (a few months) but then observe a minutes - it would be good to not create another short-term chart but just zoom-in. Those files are on one unix server and the charts will be displayed on another unix server so the X-Window protocol is going to be used. Any suggestions ? Best regards przemol -- http://mail.python.org/mailman/listinfo/python-list
How to output a complex List object to a file.
Hi all, I have a object list list this: from bots.botsconfig import * from D96Arecords import recorddefs from edifactsyntax3 import syntax structure=[ {ID:'UNH',MIN:1,MAX:1,LEVEL:[ {ID:'BGM',MIN:1,MAX:1}, {ID:'DTM',MIN:1,MAX:5}, {ID:'NAD',MIN:1,MAX:5,LEVEL:[ {ID:'CTA',MIN:0,MAX:5,LEVEL:[ {ID:'COM',MIN:0,MAX:5}, ]}, ]}, {ID:'RFF',MIN:0,MAX:5,LEVEL:[ {ID:'DTM',MIN:0,MAX:5}, ]}, {ID:'CUX',MIN:0,MAX:5,LEVEL:[ {ID:'DTM',MIN:0,MAX:5}, ]}, {ID:'LOC',MIN:1,MAX:20,LEVEL:[ {ID:'DTM',MIN:0,MAX:5}, {ID:'LIN',MIN:0,MAX:20,LEVEL:[ {ID:'PIA',MIN:0,MAX:5}, {ID:'IMD',MIN:0,MAX:5}, {ID:'RFF',MIN:0,MAX:5}, {ID:'ALI',MIN:0,MAX:5}, {ID:'MOA',MIN:0,MAX:5}, {ID:'PRI',MIN:0,MAX:5}, {ID:'QTY',MIN:0,MAX:999,LEVEL:[ {ID:'NAD',MIN:0,MAX:1}, ]}, ]}, ]}, {ID:'UNT',MIN:1,MAX:1}, ] } ] I need to output this structure object into a file, how to do that ? Jim -- http://mail.python.org/mailman/listinfo/python-list
Re: Re: ctypes list library
Nick Craig-Wood wrote: luca72 lucabe...@libero.it wrote: There is a command for ctypes that help me to know the entry points inside a library. I don't know.. However nm on the library works quite well on the command line $ nm --defined-only -D /usr/lib/libdl.so A GLIBC_2.0 A GLIBC_2.1 A GLIBC_2.3.3 A GLIBC_2.3.4 A GLIBC_PRIVATE 304c B _dlfcn_hook 13b0 T dladdr 1400 T dladdr1 0ca0 T dlclose 1170 T dlerror 1490 T dlinfo 1760 T dlmopen 0ae0 T dlopen 18d0 T dlopen 0cf0 T dlsym 0dd0 W dlvsym nm from the mingw distribution works on Windows too IIRC. For Windows, you can use the Microsoft tool DUMPBIN to display entry points (and other stuff) for a DLL. Notice that a DLL may have almost any extension, including EXE, SYS, DRV, ... -- http://mail.python.org/mailman/listinfo/python-list
Re: Missing c.l.py posts (was Re: A question on scope...)
In article 4a3f4b46$0$11882$426a7...@news.free.fr, Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid wrote: Aahz a écrit : In article 4a3b5dc3$0$2985$426a7...@news.free.fr, Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid wrote: NB : answering the OP (original post didn't show up on c.l.py ???) Correct. There's a problem with the mail-news gateway, I think that MIME messages are failing. I fixed the problem for c.l.py.announce by making the list reject non-ASCII messages, but I don't think that's an option for python-list. Hu, I see. FWIW, it's not the first time I observe this (posts not showing up, only answers...), but at least I now know why. Well, I guess it might be possible to have the gateway extract the text part from MIME messages, but I'm not sure I'd volunteer to work on this... Just out of curiousity, where can I find more infos on this gateway ? It's part of Mailman, so that's where you should start. -- Aahz (a...@pythoncraft.com) * http://www.pythoncraft.com/ as long as we like the same operating system, things are cool. --piranha -- http://mail.python.org/mailman/listinfo/python-list
Re: Graphical library - charts
2009/6/22 przemol...@poczta.fm-n-o-s-p-a-m: Hello, I have thousends of files with logs from monitoring system. Each file has some important data (numbers). I'd like to create charts using those numbers. Could you please suggest library which will allow creating such charts ? The preferred chart is line chart. Besides is there any library which allow me to zoom in/out of such chart ? Sometimes I need to create chart using long-term data (a few months) but then observe a minutes - it would be good to not create another short-term chart but just zoom-in. Those files are on one unix server and the charts will be displayed on another unix server so the X-Window protocol is going to be used. Try Google Charts. It is quite excellent for easily creating simple charts. There is also Gnuplot which is more advanced and complicated. Both tools have python bindings. -- mvh Björn -- http://mail.python.org/mailman/listinfo/python-list
Re: How to output a complex List object to a file.
On Jun 22, 2009, at 9:17 AM, Jim Qiu wrote: Hi all, I have a object list list this: from bots.botsconfig import * from D96Arecords import recorddefs from edifactsyntax3 import syntax structure=[ {ID:'UNH',MIN:1,MAX:1,LEVEL:[ {ID:'BGM',MIN:1,MAX:1}, {ID:'DTM',MIN:1,MAX:5}, ...snip... {ID:'UNT',MIN:1,MAX:1}, ] } ] I need to output this structure object into a file, how to do that ? Have you looked at the pickle module? -- http://mail.python.org/mailman/listinfo/python-list
Re: Good books in computer science?
If you are looking for *classics*, then you can't beat Michael Jackson's Principles of Program Design and System Development. They are pre-ObjectOriented, but if you really want to understand what application programming is all about, this is where you should start. I also recommend Eric S. Roberts Thinking Recursively. I don't know if it can be considered a classic, but a good programmer needs to be able to understand and do recursion, and I found this book a very readable introduction. It may also help if you bring a tighter focus to your search. The domain of programming can be divided up into large subdomains, each with its own specialized types of problems, techniques and classics. Here are some subdomains that I can think of off the top of my head: system programming -- dealing with interacting with the computer at the bits and bytes level scientific programming -- dealing with algorithms business programming -- dealing with data structures and the events that change them embedded real-time programming -- dealing with controlling machines ... and there are probably others, such as writing compilers/ interpreters, and robotics programming. -- http://mail.python.org/mailman/listinfo/python-list
Re: Graphical library - charts
BJörn Lindqvist wrote: 2009/6/22 przemol...@poczta.fm-n-o-s-p-a-m: Hello, I have thousends of files with logs from monitoring system. Each file has some important data (numbers). I'd like to create charts using those numbers. Could you please suggest library which will allow creating such charts ? The preferred chart is line chart. Besides is there any library which allow me to zoom in/out of such chart ? Sometimes I need to create chart using long-term data (a few months) but then observe a minutes - it would be good to not create another short-term chart but just zoom-in. Those files are on one unix server and the charts will be displayed on another unix server so the X-Window protocol is going to be used. Try Google Charts. It is quite excellent for easily creating simple charts. There is also Gnuplot which is more advanced and complicated. Both tools have python bindings. Which option is better: pygooglechart http://pygooglechart.slowchop.com/ google-chartwrapper http://code.google.com/p/google-chartwrapper/ Regards Przemek -- http://mail.python.org/mailman/listinfo/python-list
Re: python needs a tutorial for install and setup on a Mac
aberry wrote: thanks for suggestion... what should I put in 'bashrc ' so that I can switch between different version. as python command will always point to one Python framework (lets either 2.4.x or 2.5.x). if you want to switch, put in there three different lines, and comment that in that you need. Or write short bash-functions that replace the path. Not scripts!! They won't work. But I think if you want to switch, you are better off using fully qualified names, such as python2.5 and link these to your desired versions. Or start using virtualenvs for everything (as I do), and don't bother as you simply activate the one you want before using python. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Meta question: disappearing posts (was Re: calculating a self.value, self.randomnum = normalvariate(x, y))
Piet van Oostrum p...@cs.uu.nl wrote: I notice that I see several postings on news:comp.lang.python that are replies to other postings that I don't see. Aahz a...@pythoncraft.com wrote: As stated previously, my suspicion is that at least some is caused by a problem with MIME messages and the mail-news gateway on python.org. I'm not sure what MIME would have to do with it, but Piet van Oostrum's problem is almost certainly as result of the python.org mail to news gateway mangling the References header. The missing postings he's looking for don't actually exist. Just go up the thread one more posting and you'll find the message that was being replied to. Ross Ridge -- l/ // Ross Ridge -- The Great HTMU [oo][oo] rri...@csclub.uwaterloo.ca -()-/()/ http://www.csclub.uwaterloo.ca/~rridge/ db // -- http://mail.python.org/mailman/listinfo/python-list
Re: Graphical library - charts
BJörn Lindqvist wrote: 2009/6/22 przemol...@poczta.fm-n-o-s-p-a-m: Hello, I have thousends of files with logs from monitoring system. Each file has some important data (numbers). I'd like to create charts using those numbers. Could you please suggest library which will allow creating such charts ? The preferred chart is line chart. Besides is there any library which allow me to zoom in/out of such chart ? Sometimes I need to create chart using long-term data (a few months) but then observe a minutes - it would be good to not create another short-term chart but just zoom-in. Those files are on one unix server and the charts will be displayed on another unix server so the X-Window protocol is going to be used. Try Google Charts. It is quite excellent for easily creating simple charts. There is also Gnuplot which is more advanced and complicated. Both tools have python bindings. By the way: do I need any access to internet while using this library ? Regards przemol -- http://mail.python.org/mailman/listinfo/python-list
Re: python needs a tutorial for install and setup on a Mac
On Jun 22, 2009, at 8:56 AM, aberry wrote: thanks for suggestion... what should I put in 'bashrc ' so that I can switch between different version. as python command will always point to one Python framework (lets either 2.4.x or 2.5.x). Something like this would work: alias py25='/Library/Frameworks/Python.framework/Versions/2.5/bin/ pythonw' Diez B. Roggisch-2 wrote: aberry wrote: Switching between python version Lets assume you have python 2.4.x and now you installed 2.5.x.By default python path will point to 2.4.x. To switch to python 2.5.x, use following commands... cd /usr/bin sudo rm pythonw sudo ln -s /Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw pythonw sudo rm python sudo ln -s pythonw python2.5 sudo ln -s python2.5 python this worked for me... do let me know if any1 has other way of doing... Bad idea. It might break tools that need the /usr/bin/python to be the system's python. a simple export PATH=/Library/.../bin:$PATH inside .bashrc should be all you need. Diez -- http://mail.python.org/mailman/listinfo/python-list -- View this message in context: http://www.nabble.com/python-needs-a-tutorial-for-install-and-setup-on-a-Mac-tp24135580p24146713.html Sent from the Python - python-list mailing list archive at Nabble.com. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Perl's @foo[3,7,1,-1] ?
On Mon, 2009-06-22 at 14:57 +0200, Jean-Michel Pichavant wrote: J. Cliff Dyer wrote: On Wed, 2009-06-17 at 14:13 +0200, Jean-Michel Pichavant wrote: On Wed, Jun 17, 2009 at 04:14, Steven D'Aprano wrote: What's np.arange? import numpy as np -- Pierre delroth Bourdon delr...@gmail.com Étudiant à l'EPITA / Student at EPITA Perfect example of why renaming namespaces should be done only when absolutely required, that is, almost never. Jean-Michel I disagree. Renaming namespaces should always be done if it will help stop people from doing a 'from package import *'. However, example code should always include relevant imports. Cheers, Cliff The import * should not used if possible, I totally agree on that point, but there's no need to rename namespaces for that. br Jean-Michel Technically, no. But we're dealing with people, who are notoriously *un*technical in their behavior. A person is much more likely to develop bad habits if the alternative means more work for them. The reason people do `from foo import *` is that they don't want to type more than they have to. If they can write a one or two letter namespace, they're likely to be happy with that trade-off. If the alternative is to write out long module names every time you use a variable, they'll tend to develop bad habits. To paraphrase Peter Maurin, coding guidelines should have the aim of helping to bring about a world in which it is easy to be good. I don't really see much problem with renaming namespaces: For people reading the code, everything is explicit, as you can just look at the top of the module to find out what module a namespace variable represent; the local namespace doesn't get polluted with God knows what from God knows where; and code remains succinct. I've found in my own code that using, for example, the name `sqlalchemy` in my code means that I have to go through painful contortions to get your code down to the PEP-8 recommended 80 characters per line. The resulting mess of multi-line statements is significantly less readable than the same code using the abbreviation `sa`. Do you have an argument for avoiding renaming namespaces? So far the only example you provided is a code fragment that doesn't run. I don't disagree with you on that example; referring to numpy as np without telling anyone what np refers to is a bad idea, but no functioning piece of code could reasonably do that. Cheers, Cliff -- http://mail.python.org/mailman/listinfo/python-list
Re: How to output a complex List object to a file.
Have you looked at the JSON module? On Mon, 2009-06-22 at 21:17 +0800, Jim Qiu wrote: Hi all, I have a object list list this: from bots.botsconfig import * from D96Arecords import recorddefs from edifactsyntax3 import syntax structure=[ {ID:'UNH',MIN:1,MAX:1,LEVEL:[ {ID:'BGM',MIN:1,MAX:1}, {ID:'DTM',MIN:1,MAX:5}, {ID:'NAD',MIN:1,MAX:5,LEVEL:[ {ID:'CTA',MIN:0,MAX:5,LEVEL:[ {ID:'COM',MIN:0,MAX:5}, ]}, ]}, {ID:'RFF',MIN:0,MAX:5,LEVEL:[ {ID:'DTM',MIN:0,MAX:5}, ]}, {ID:'CUX',MIN:0,MAX:5,LEVEL:[ {ID:'DTM',MIN:0,MAX:5}, ]}, {ID:'LOC',MIN:1,MAX:20,LEVEL:[ {ID:'DTM',MIN:0,MAX:5}, {ID:'LIN',MIN:0,MAX:20,LEVEL:[ {ID:'PIA',MIN:0,MAX:5}, {ID:'IMD',MIN:0,MAX:5}, {ID:'RFF',MIN:0,MAX:5}, {ID:'ALI',MIN:0,MAX:5}, {ID:'MOA',MIN:0,MAX:5}, {ID:'PRI',MIN:0,MAX:5}, {ID:'QTY',MIN:0,MAX:999,LEVEL:[ {ID:'NAD',MIN:0,MAX:1}, ]}, ]}, ]}, {ID:'UNT',MIN:1,MAX:1}, ] } ] I need to output this structure object into a file, how to do that ? Jim -- http://mail.python.org/mailman/listinfo/python-list
Re: Measuring Fractal Dimension ?
On Jun 22, 2009, at 8:46 AM, pdpi wrote: On Jun 19, 8:13 pm, Charles Yeomans char...@declaresub.com wrote: On Jun 19, 2009, at 2:43 PM, David C. Ullrich wrote: snick Hmm. You left out a bit in the first definition you cite: A simple closed curve J, also called a Jordan curve, is the image of a continuous one-to-one function from R/Z to R2. We assume that each curve comes with a fixed parametrization phi_J : R/Z -¨ J. We call t in R/Z the time parameter. By abuse of notation, we write J(t) in R2 instead of phi_j (t), using the same notation for the function phi_J and its image J. Close to sounding like he can't decide whether J is a set or a function... On the contrary, I find this definition to be written with some care. I find the usage of image slightly ambiguous (as it suggests the image set defines the curve), but that's my only qualm with it as well. Thinking pragmatically, you can't have non-simple curves unless you use multisets, and you also completely lose the notion of curve orientation and even continuity without making it a poset. At this point in time, parsimony says that you want to ditch your multiposet thingie (and God knows what else you want to tack in there to preserve other interesting curve properties) and really just want to define the curve as a freaking function and be done with it. -- But certainly the image set does define the curve, if you want to view it that way -- all parameterizations of a curve should satisfy the same equation f(x, y) = 0. Charles Yeomans -- http://mail.python.org/mailman/listinfo/python-list
Re: UnicodeDecodeError: problem when path contain folder start with character 'u
2009/6/22 aberry abe...@aol.in: I am facing an error on Unicode decoding of path if it contain a folder/file name starting with character 'u' . Here is what I did in IDLE 1. fp = C:\\ab\\anil 2. unicode(fp, unicode_escape) 3. u'C:\x07b\x07nil' 4. fp = C:\\ab\\unil 5. unicode(fp, unicode_escape) 6. 7. Traceback (most recent call last): 8. File pyshell#41, line 1, in module 9. unicode(fp, unicode_escape) 10. UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 5-9: end of string in escape sequence 11. Not sure whether I am doing something wrong or this is as designed behavior . any help appreciated Rgds, aberry -- View this message in context: http://www.nabble.com/UnicodeDecodeError%3A-problem-when-path-contain-folder-start-with-character-%27u-tp24146775p24146775.html Sent from the Python - python-list mailing list archive at Nabble.com. -- http://mail.python.org/mailman/listinfo/python-list Hi, It seems, that using unicode_escape codec is not appropriate here, are you sure, you are dealing with unicode encoded strings? The examples seem like usual strings with backslashes escaped. If these should be paths, you probably can use them directly without conversion (the bel hex 0x07 character is maybe not expected here, is it?) vbr -- http://mail.python.org/mailman/listinfo/python-list
Re: Check module without import it
On Mon, Jun 22, 2009 at 3:06 AM, Klessjonas@googlemail.com wrote: Is there any way to check that it's installed a module without import it directly? I'm using the nex code but it's possible that it not been necessary to import a module - try: import module except ImportError: pass else: print 'make anything' - Have a look at find_module in the imp module of the standard library. -- http://mail.python.org/mailman/listinfo/python-list
Re: python needs a tutorial for install and setup on a Mac
tkp...@hotmail.com wrote: I think a setup guide for the Mac would prove very useful. Earlier this year, I tried installing Python 2.6 on my iMac, and ran into all sorts of problems, largely as a result of the fact that I knew very little about Unix. I finally downloaded and installed the Enthought Python distribution for the Mac and it worked like a charm. Exactly why I think this is needed. I did the same thing, installed Enthought. Then I wanted to use 2.6 and now 3.0.1 . I have all versions installed. They work and I know how to switch between but not so sure what s going on when I things a package. I should not require lots of googling for the answers. The mailing lists are great and everyone is helpful but do you really want to answer the same questions again and agian. Kushal Kumaran Have you seen the page at http://www.python.org/download/mac/ and the pages linked from it? Yes I have as I am sure tkp...@hotmail.com and did not find it usefull, or I should say only a little. So I still have no answer, There seems to be a need but, no one has said post it hear or volunteered to help. Am I going about this wrong? Thanks Vincent -- http://mail.python.org/mailman/listinfo/python-list
Re: python needs a tutorial for install and setup on a Mac
Kushal Kumaran wrote: On Sun, Jun 21, 2009 at 9:04 PM, Vincent Davisvinc...@vincentdavis.net wrote: I am running python on a mac and when I was getting going it was difficult to setup information. Specifically how modify bash_profile, how pythonpath works and how to set it up. how to switch between python versions. How/where to install modules if you have multiple installed versions. I am thinking about this from perspective of a new pythoner (is there a word for a person who programs in python). I think many new pythoners may be like me and don't mess with the underling UNIX on a mac. My question/suggestion is that there be a nice tutorial for this. I am wiling to contribute much but I am still somewhat new to python and may need help with some details. Also where should this be posted, how do I post it. Do other think there is a need? Any willing to help? But of course I may have missed a great tutorial out there if so I think It needs to be easier to findor I need to learn how to look. The Python doc set includes Using Python. Chapter 4 is ... on a Macintosh. If you think that is inadequate, start a new issue on the tracker (after searching for existing Mac doc issues). Python is a volunteer enterprise, and Python-Mac is a relatively small subset of volunteers, so feel free to help. Have you seen the page at http://www.python.org/download/mac/ and the pages linked from it? It is possible that the chapter should include material from or link to material in other pages. tjr -- http://mail.python.org/mailman/listinfo/python-list
Re: UnicodeDecodeError: problem when path contain folder start with character 'u
aberry wrote: I am facing an error on Unicode decoding of path if it contain a folder/file name starting with character 'u' . Here is what I did in IDLE 1. fp = C:\\ab\\anil The results in two single \s in the string. Use / for paths, even on Windows, and you will have less trouble. 2. unicode(fp, unicode_escape) why? Not for interacting with file system. It tries to interpret \s. Not what you want. 3. u'C:\x07b\x07nil' 4. fp = C:\\ab\\unil This has \u followed by three chars. \u followed by FOUR chars is a unicode escape for ONE unicode char. 5. unicode(fp, unicode_escape) This tries to interpret \u as 1 char, but it only fines \uxxx and the string ends. 6. 7. Traceback (most recent call last): 8. File pyshell#41, line 1, in module 9. unicode(fp, unicode_escape) 10. UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 5-9: end of string in escape sequence Read the doc for string literals and unicode function. -- http://mail.python.org/mailman/listinfo/python-list
Re: UnicodeDecodeError: problem when path contain folder start with character 'u
aberry abe...@aol.in (a) a écrit: a I am facing an error on Unicode decoding of path if it contain a folder/file a name starting with character 'u' . a Here is what I did in IDLE a 1. fp = C:\\ab\\anil a 2. unicode(fp, unicode_escape) a 3. u'C:\x07b\x07nil' a 4. fp = C:\\ab\\unil a 5. unicode(fp, unicode_escape) a 6. a 7. Traceback (most recent call last): a 8. File pyshell#41, line 1, in module a 9. unicode(fp, unicode_escape) a 10. UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position a 5-9: end of string in escape sequence a 11. a Not sure whether I am doing something wrong or this is as designed behavior a . a any help appreciated Calling unicode(fp, unicode_escape) with these filenames is nonsense. unicode_escape is for transforming a string like \u20ac to a €-sign or vice versa: fp=\\u20ac print unicode(fp,unicode_escape) € So what are you trying to achieve? -- Piet van Oostrum p...@cs.uu.nl URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4] Private email: p...@vanoostrum.org -- http://mail.python.org/mailman/listinfo/python-list
Re: Graphical library - charts
przemol...@poczta.fm-n-o-s-p-a-m wrote: Try Google Charts. It is quite excellent for easily creating simple charts. There is also Gnuplot which is more advanced and complicated. Both tools have python bindings. By the way: do I need any access to internet while using this library ? http://code.google.com/apis/chart/basics.html GoogleCharts are generated by Google in response to a url call to Google. They are intended for embedding in a web page with the url being part of an image element. While interesting for that, they may not be what you want for your app The largest size is well less than full screen. -- http://mail.python.org/mailman/listinfo/python-list
ANN: Leo 4.6 beta 2 released
Leo 4.6 b2 is now available at: http://sourceforge.net/project/showfiles.php?group_id=3458package_id=29106 Leo is a text editor, data organizer, project manager and much more. See: http://webpages.charter.net/edreamleo/intro.html The highlights of Leo 4.6: -- - Cached external files *greatly* reduces the time to load .leo files. - Leo now features a modern Qt interface by default. Leo's legacy Tk interface can also be used. - New --config, --file and --gui command-line options. - Leo tests syntax of .py files when saving them. - Leo can now open any kind of file into @edit nodes. - @auto-rst nodes support round-tripping of reStructuredText files. - Properties of commanders, positions and nodes simplify programming. - Improved Leo's unit testing framework. - Leo now requires Python 2.4 or later. - Dozens of small improvements and bug fixes. Links: -- Leo: http://webpages.charter.net/edreamleo/front.html Forum:http://groups.google.com/group/leo-editor Download: http://sourceforge.net/project/showfiles.php?group_id=3458 Bzr: http://code.launchpad.net/leo-editor/ Quotes: http://webpages.charter.net/edreamleo/testimonials.html Edward K. Ream email: edream...@yahoo.com Leo: http://webpages.charter.net/edreamleo/front.html -- http://mail.python.org/mailman/listinfo/python-list
Help
Hi i was wondering how i should go about this problem: ok so i am writing a program for my school's football team and to keep the stats for each player there is a notebook with 3 tabs that has a txtctrl and a + and - button. i need to find a way to when you click the + or - button it updates that stat for that individual player. _ Hotmail® has ever-growing storage! Don’t worry about storage limits. http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage_062009-- http://mail.python.org/mailman/listinfo/python-list
Re: Perl's @foo[3,7,1,-1] ?
J. Cliff Dyer wrote: On Mon, 2009-06-22 at 14:57 +0200, Jean-Michel Pichavant wrote: J. Cliff Dyer wrote: On Wed, 2009-06-17 at 14:13 +0200, Jean-Michel Pichavant wrote: On Wed, Jun 17, 2009 at 04:14, Steven D'Aprano wrote: What's np.arange? import numpy as np -- Pierre delroth Bourdon delr...@gmail.com Étudiant à l'EPITA / Student at EPITA Perfect example of why renaming namespaces should be done only when absolutely required, that is, almost never. Jean-Michel I disagree. Renaming namespaces should always be done if it will help stop people from doing a 'from package import *'. However, example code should always include relevant imports. Cheers, Cliff The import * should not used if possible, I totally agree on that point, but there's no need to rename namespaces for that. br Jean-Michel Technically, no. But we're dealing with people, who are notoriously *un*technical in their behavior. A person is much more likely to develop bad habits if the alternative means more work for them. The reason people do `from foo import *` is that they don't want to type more than they have to. If they can write a one or two letter namespace, they're likely to be happy with that trade-off. If the alternative is to write out long module names every time you use a variable, they'll tend to develop bad habits. To paraphrase Peter Maurin, coding guidelines should have the aim of helping to bring about a world in which it is easy to be good. I don't really see much problem with renaming namespaces: For people reading the code, everything is explicit, as you can just look at the top of the module to find out what module a namespace variable represent; the local namespace doesn't get polluted with God knows what from God knows where; and code remains succinct. I've found in my own code that using, for example, the name `sqlalchemy` in my code means that I have to go through painful contortions to get your code down to the PEP-8 recommended 80 characters per line. The resulting mess of multi-line statements is significantly less readable than the same code using the abbreviation `sa`. Do you have an argument for avoiding renaming namespaces? So far the only example you provided is a code fragment that doesn't run. I don't disagree with you on that example; referring to numpy as np without telling anyone what np refers to is a bad idea, but no functioning piece of code could reasonably do that. Cheers, Cliff Maybe I've been a little bit too dictatorial when I was saying that renaming namespaces should be avoided. Sure your way of doing make sense. In fact they're 2 main purposes of having strong coding rules: 1/ ease the coder's life 2/ ease the reader's life The perfect rule satisfies both of them, but when I have to choose, I prefer number 2. Renaming packages, especially those who are world wide used, may confuse the reader and force him to browse into more code. From the OP example, I was just pointing the fact that **he alone** gains 3 characters when **all** the readers need to ask what means np. Renaming namespaces with a well chosen name (meaningful) is harmless. br Jean-Michel -- http://mail.python.org/mailman/listinfo/python-list
wikipedia with python
Let me know if it's the right place to ask. I'm looking for wiki writen with python where I can import all wikipedia site. If you have any links please let me know. Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Graphical library - charts
I suggest you look at matplotlib. It's a bit of a learning curve but will do whatever you need. I have a similar requirement and found that gnuplot did not work for me. The plots are impressive. Paul Simon przemol...@poczta.fm-n-o-s-p-a-m wrote in message news:h1nv4q$5k...@news.dialog.net.pl... Hello, I have thousends of files with logs from monitoring system. Each file has some important data (numbers). I'd like to create charts using those numbers. Could you please suggest library which will allow creating such charts ? The preferred chart is line chart. Besides is there any library which allow me to zoom in/out of such chart ? Sometimes I need to create chart using long-term data (a few months) but then observe a minutes - it would be good to not create another short-term chart but just zoom-in. Those files are on one unix server and the charts will be displayed on another unix server so the X-Window protocol is going to be used. Any suggestions ? Best regards przemol -- http://mail.python.org/mailman/listinfo/python-list
Re: wikipedia with python
Does this help: http://www.mediawiki.org/wiki/MoinMoin On Mon, Jun 22, 2009 at 6:58 PM, zelegolaszelego...@gmail.com wrote: Let me know if it's the right place to ask. I'm looking for wiki writen with python where I can import all wikipedia site. If you have any links please let me know. Thanks -- http://mail.python.org/mailman/listinfo/python-list -- http://www.xing.com/profile/Martin_Marcher http://www.linkedin.com/in/martinmarcher You are not free to read this message, by doing so, you have violated my licence and are required to urinate publicly. Thank you. Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Perl's @foo[3,7,1,-1] ?
Jean-Michel Pichavant wrote: snip Maybe I've been a little bit too dictatorial when I was saying that renaming namespaces should be avoided. Sure your way of doing make sense. In fact they're 2 main purposes of having strong coding rules: 1/ ease the coder's life 2/ ease the reader's life The perfect rule satisfies both of them, but when I have to choose, I prefer number 2. Renaming packages, especially those who are world wide used, may confuse the reader and force him to browse into more code. From the OP example, I was just pointing the fact that **he alone** gains 3 characters when **all** the readers need to ask what means np. Renaming namespaces with a well chosen name (meaningful) is harmless. As long as you keep all import statements at the head of the file, there is no readability problems with renaming namespace. Glance at the header file, see: import numpy as np and it's not hard to mentally switch np as numpy... well, as long as your header doesn't look like this: import numpy as np import itertools as it import Tkinter as Tk from time import time as t -- http://mail.python.org/mailman/listinfo/python-list
Re: wikipedia with python
On Mon, Jun 22, 2009 at 6:58 PM, zelegolaszelego...@gmail.com wrote: Let me know if it's the right place to ask. I'm looking for wiki writen with python where I can import all wikipedia site. If you have any links please let me know. I don't think that's possible. If you wnat to import Wikipedia in a wiki, it will probably have to be MediaWiki - and that's written in PHP. What do you want to use the material for? -- André Engels, andreeng...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Graphical library - charts
BJörn Lindqvist wrote: 2009/6/22 przemol...@poczta.fm-n-o-s-p-a-m: Hello, I have thousends of files with logs from monitoring system. Each file has some important data (numbers). I'd like to create charts using those numbers. Could you please suggest library which will allow creating such charts ? The preferred chart is line chart. Besides is there any library which allow me to zoom in/out of such chart ? Sometimes I need to create chart using long-term data (a few months) but then observe a minutes - it would be good to not create another short-term chart but just zoom-in. Those files are on one unix server and the charts will be displayed on another unix server so the X-Window protocol is going to be used. Try Google Charts. It is quite excellent for easily creating simple charts. There is also Gnuplot which is more advanced and complicated. Both tools have python bindings. I've used Quickplot (http://quickplot.sourceforge.net/) for similar purpose. It's not the most elegant solution since the chart viewer is external, not embedded to your program, but it works, zooming and all. You simply need to create a program that convert the log file into list of points and pipe it to quickplot or save it into a file and point quickplot to it (look at the command line options). The chart navigation is a bit unusual, but is efficient to work with once you get used to it. -- http://mail.python.org/mailman/listinfo/python-list
Re: Measuring Fractal Dimension ?
On Mon, 22 Jun 2009 05:46:55 -0700 (PDT), pdpi pdpinhe...@gmail.com wrote: On Jun 19, 8:13 pm, Charles Yeomans char...@declaresub.com wrote: On Jun 19, 2009, at 2:43 PM, David C. Ullrich wrote: Evidently my posts are appearing, since I see replies. I guess the question of why I don't see the posts themselves \is ot here... On Thu, 18 Jun 2009 17:01:12 -0700 (PDT), Mark Dickinson dicki...@gmail.com wrote: On Jun 18, 7:26 pm, David C. Ullrich ullr...@math.okstate.edu wrote: On Wed, 17 Jun 2009 08:18:52 -0700 (PDT), Mark Dickinson Right. Or rather, you treat it as the image of such a function, if you're being careful to distinguish the curve (a subset of R^2) from its parametrization (a continuous function R - R**2). It's the parametrization that's uniformly continuous, not the curve, Again, it doesn't really matter, but since you use the phrase if you're being careful: In fact what you say is exactly backwards - if you're being careful that subset of the plane is _not_ a curve (it's sometimes called the trace of the curve. Darn. So I've been getting it wrong all this time. Oh well, at least I'm not alone: De?nition 1. A simple closed curve J, also called a Jordan curve, is the image of a continuous one-to-one function from R/Z to R2. [...] - Tom Hales, in 'Jordan's Proof of the Jordan Curve Theorem'. We say that Gamma is a curve if it is the image in the plane or in space of an interval [a, b] of real numbers of a continuous function gamma. - Claude Tricot, 'Curves and Fractal Dimension' (Springer, 1995). Perhaps your definition of curve isn't as universal or 'official' as you seem to think it is? Perhaps not. I'm very surprised to see those definitions; I've been a mathematician for 25 years and I've never seen a curve defined a subset of the plane. I have. Hmm. You left out a bit in the first definition you cite: A simple closed curve J, also called a Jordan curve, is the image of a continuous one-to-one function from R/Z to R2. We assume that each curve comes with a fixed parametrization phi_J : R/Z -¨ J. We call t in R/Z the time parameter. By abuse of notation, we write J(t) in R2 instead of phi_j (t), using the same notation for the function phi_J and its image J. Close to sounding like he can't decide whether J is a set or a function... On the contrary, I find this definition to be written with some care. I find the usage of image slightly ambiguous (as it suggests the image set defines the curve), but that's my only qualm with it as well. Thinking pragmatically, you can't have non-simple curves unless you use multisets, and you also completely lose the notion of curve orientation and even continuity without making it a poset. At this point in time, parsimony says that you want to ditch your multiposet thingie (and God knows what else you want to tack in there to preserve other interesting curve properties) and really just want to define the curve as a freaking function and be done with it. Precisely. -- http://mail.python.org/mailman/listinfo/python-list
Re: Measuring Fractal Dimension ?
On Mon, 22 Jun 2009 10:31:26 -0400, Charles Yeomans char...@declaresub.com wrote: On Jun 22, 2009, at 8:46 AM, pdpi wrote: On Jun 19, 8:13 pm, Charles Yeomans char...@declaresub.com wrote: On Jun 19, 2009, at 2:43 PM, David C. Ullrich wrote: snick Hmm. You left out a bit in the first definition you cite: A simple closed curve J, also called a Jordan curve, is the image of a continuous one-to-one function from R/Z to R2. We assume that each curve comes with a fixed parametrization phi_J : R/Z -¨ J. We call t in R/Z the time parameter. By abuse of notation, we write J(t) in R2 instead of phi_j (t), using the same notation for the function phi_J and its image J. Close to sounding like he can't decide whether J is a set or a function... On the contrary, I find this definition to be written with some care. I find the usage of image slightly ambiguous (as it suggests the image set defines the curve), but that's my only qualm with it as well. Thinking pragmatically, you can't have non-simple curves unless you use multisets, and you also completely lose the notion of curve orientation and even continuity without making it a poset. At this point in time, parsimony says that you want to ditch your multiposet thingie (and God knows what else you want to tack in there to preserve other interesting curve properties) and really just want to define the curve as a freaking function and be done with it. -- But certainly the image set does define the curve, if you want to view it that way -- all parameterizations of a curve should satisfy the same equation f(x, y) = 0. This sounds like you didn't read his post, or totally missed the point. Say S is the set of (x,y) in the plane such that x^2 + y^2 = 1. What's the index, or winding number, of that curve about the origin? (Hint: The curve c defined by c(t) = (cos(t), sin(t)) for 0 = t = 2pi has index 1 about the origin. The curve d(t) = (cos(-t), sin(-t)) (0 = t = 2pi) has index -1. The curve (cos(2t), sin(2t)) (same t) has index 2.) Charles Yeomans -- http://mail.python.org/mailman/listinfo/python-list
Re: Perl's @foo[3,7,1,-1] ?
Lie Ryan wrote: Jean-Michel Pichavant wrote: snip Maybe I've been a little bit too dictatorial when I was saying that renaming namespaces should be avoided. Sure your way of doing make sense. In fact they're 2 main purposes of having strong coding rules: 1/ ease the coder's life 2/ ease the reader's life The perfect rule satisfies both of them, but when I have to choose, I prefer number 2. Renaming packages, especially those who are world wide used, may confuse the reader and force him to browse into more code. From the OP example, I was just pointing the fact that **he alone** gains 3 characters when **all** the readers need to ask what means np. Renaming namespaces with a well chosen name (meaningful) is harmless. As long as you keep all import statements at the head of the file, there is no readability problems with renaming namespace. Glance at the header file, see: import numpy as np and it's not hard to mentally switch np as numpy... well, as long as your header doesn't look like this: import numpy as np import itertools as it import Tkinter as Tk from time import time as t yep, your example is good, no namespace renaming ... :o) I would gladly accept the following renaming: import theMostEfficientPythonPackageInTheWorld as meppw Hopefully, package names are often usable as provided. Moreover, writing numpy instead of np is not harder for the coder than switching mentally from np to numpy for the reader. It's just about who you want to make the life easier, the coder or the reader ? br Jean-Michel -- http://mail.python.org/mailman/listinfo/python-list
Re: Measuring Fractal Dimension ?
On Fri, 19 Jun 2009 12:40:36 -0700 (PDT), Mark Dickinson dicki...@gmail.com wrote: On Jun 19, 7:43 pm, David C. Ullrich ullr...@math.okstate.edu wrote: Evidently my posts are appearing, since I see replies. I guess the question of why I don't see the posts themselves \is ot here... Judging by this thread, I'm not sure that much is off-topic here. :-) Perhaps not. I'm very surprised to see those definitions; I've been a mathematician for 25 years and I've never seen a curve defined a subset of the plane. That in turn surprises me. I've taught multivariable calculus courses from at least three different texts in three different US universities, and as far as I recall a 'curve' was always thought of as a subset of R^2 or R^3 in those courses (though not always with explicit definitions, since that would be too much to hope for with that sort of text). Here's Stewart's 'Calculus', p658: Examples 2 and 3 show that different sets of parametric equations can represent the same curve. Thus we distinguish between a *curve*, which is a set of points, and a *parametric curve*, in which the points are traced in a particular way. Again as far as I remember, the rest of the language in those courses (e.g., 'level curve', 'curve as the intersection of two surfaces') involves thinking of curves as subsets of R^2 or R^3. Certainly I'll agree that it's then necessary to parameterize the curve before being able to do anything useful with it. [Standard question when teaching multivariable calculus: Okay, so we've got a curve. What's the first thing we do with it? Answer, shouted out from all the (awake) students: PARAMETERIZE IT! (And then calculate its length/integrate the given vector field along it/etc.) Those were the days...] Surely you don't say a curve is a subset of the plane and also talk about the integrals of verctor fields over _curves_? This is getting close to the point someone else made, before I had a chance to: We need a parametriztion of that subset of the plane before we can do most interesting things with it. The parametrization determines the set, but the set does not determine the parametrization (not even up to some sort of isomorphism; the set does not determine multiplicity, orientation, etc.) So if the definition of curve is not as I claim then in some sense it _should_ be. Hales defines a curve to be a set C and then says he assumes that there is a parametrization phi_C. Does he ever talk about things like the orientation of a curve a about a point? Seems likely. If so then his use of the word curve is simply not consistent with his definition. A Google Books search even turned up some complex analysis texts where the word 'curve' is used to mean a subset of the plane; check out the book by Ian Stewart and David Orme Tall, 'Complex Analysis: a Hitchhiker's Guide to the Plane': they distinguish 'curves' (subset of the complex plane) from 'paths' (functions from a closed bounded interval to the complex plane). Hmm. I of all people am in no position to judge a book on complex analysis by the silliness if its title... Definition 2. A polygon is a Jordan curve that is a subset of a finite union of lines. A polygonal path is a continuous function P : [0, 1] -¨ R2 that is a subset of a finite union of lines. It is a polygonal arc, if it is 1 . 1. By that definition a polygonal path is not a curve. Right. I'm much more willing to accept 'path' as standard terminology for a function [a, b] - (insert_favourite_space_here). Not that it matters, but his defintion of polygonal path is, _if_ we're being very careful, self-contradictory. Agreed. Surprising, coming from Hales; he must surely rank amongst the more careful mathematicians out there. So I don't think we can count that paper as a suitable reference for what the _standard_ definitions are; the standard definitions are not self-contradictory this way. I just don't believe there's any such thing as 'the standard definition' of a curve. I'm happy to believe that in complex analysis and differential geometry it's common to define a curve to be a function. But in general I'd suggest that it's one of those terms that largely depends on context, and should be defined clearly when it's not totally obvious from the context which definition is intended. For example, for me, more often than not, a curve is a 1-dimensional scheme over a field k (usually *not* algebraically closed), that's at least some of {geometrically reduced, geometrically irreducible, proper, smooth}. That's a far cry either from a subset of an affine space or from a parametrization by an interval. Ok. Then the second definition you cite: Amazon says the prerequisites are two years of calculus. The stanard meaning of log is log base e, even though means log base 10 in calculus. Sorry, I've lost context for this comment. Why are logs relevant? (I'm very well aware of the debates over the meaning of log, having frequently had to
Re: Graphical library - charts
I suggest you look at matplotlib. +1 Another vote Matplotlib. It has impressive graphing/plotting capabilities and is used as a Python module/library. Description from site: matplotlib is a python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms. matplotlib can be used in python scripts, the python and ipython shell (ala matlab or mathematica), web application servers, and six graphical user interface toolkits. http://matplotlib.sourceforge.net/ -Corey Goldberg -- http://mail.python.org/mailman/listinfo/python-list
Re: Help
tanner barnes wrote: Hi i was wondering how i should go about this problem: ok so i am writing a program for my school's football team and to keep the stats for each player there is a notebook with 3 tabs that has a txtctrl and a + and - button. i need to find a way to when you click the + or - button it updates that stat for that individual player. We are not mind readers ;-) What version of Python are you using? What GUI framework are you using? Is there anywhere we can see your existing code? Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk -- http://mail.python.org/mailman/listinfo/python-list
Re: wikipedia with python
On Mon, 22 Jun 2009 21:01:16 +0200, Andre Engels andreeng...@gmail.com wrote: On Mon, Jun 22, 2009 at 8:24 PM, ZeLegolaszelego...@gmail.com wrote: Well sorry I was not clear. I have a wiki running with mediawiki and I want to import in a wiki written with python. I don't think it will work, but you could try using the Special:Export page. Thanks I will try. :) I don't choose the wiki base on python yet. Do you know one similar to mediawiki or what is the best wiki that you know? -- http://mail.python.org/mailman/listinfo/python-list
Re: Good books in computer science?
Chris Jones wrote: Maybe I'm nitpicking, but the one thing I don't understand is how you practice programming. The term makes obvious sense when you're talking about your golf swing, acquiring competitive driving skills, playing tetris.. But programming..?? It is practice in the same way as learning to write well requires practice. Writing good code is a writing skill, as well as a precision of thought exercise. The basics of Computer Science are well-covered in TAOCP Volumes 1-5 (not all yet available in stores :-). You _must know data structures and fundamental algorithms, but after that what you write is a way of expressing clearly what you learn in a field. The field may be as narrow as the field of Ink-Jet Printer automated testing for models XXX through XYZ of manufacturer Z, but in some sense the programs should clearly expr4ess that knowledge. If you read books on learning to write clearly, even if they are oriented to (non-fiction) writing in English, none of them advocate intensive study of a theory with little practice. You can follow the advice in those books (with a loose interpretation of the instructions) and improve your code. What the best teach you is be succinct, clear, unambiguous, and try new things regularly. It is only this variation that can help you get better. Read what others write about how to write code, but remember you will have your own style. Take what others write about how to code as a cook does a recipe: you should be understand what is being attempted, try it the authors way to see what new might surprise you, and carry away only what you find you can incorporate into your own process. How we pull stuff from our brains is as varied as the brains themselves. We bring a host of experiences to our writing, and we should similarly bring that to the programs we write. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list
Re: wikipedia with python
On Mon, Jun 22, 2009 at 8:24 PM, ZeLegolaszelego...@gmail.com wrote: Well sorry I was not clear. I have a wiki running with mediawiki and I want to import in a wiki written with python. I don't think it will work, but you could try using the Special:Export page. -- André Engels, andreeng...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Perl's @foo[3,7,1,-1] ?
On 2009-06-22 13:31, Jean-Michel Pichavant wrote: Moreover, writing numpy instead of np is not harder for the coder than switching mentally from np to numpy for the reader. It's just about who you want to make the life easier, the coder or the reader ? shrug It depends on the audience. For those familiar with numpy and the np convention, it's easier to read code that uses np because there are many lines with several numpy functions called in each. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list
Procedures
Learning Python (on a Mac), with the massive help of Mark Lutz's excellent book, Learning Python. What I want to do is this: I've got a Class Object that begins with a def. It's designed to be fed a string that looks like this: scene 1, pnl 1, 3+8, pnl 2, 1+12, pnl 3, 12, pnl 4, 2+4, I'm parsing the string by finding the commas, and pulling out the data between them. No problem so far (I think...) The trouble is, there is a place where code is repeated: 1. Resetting the start end position and finding the next comma in the string. In my previous experience (with a non-OOP language), I could create a 'procedure', which was a separate function. With a call like: var=CallProcedure(arg1,arg2) the flow control would go to the procedure, run, then Return back to the main function. In Python, when I create a second def in the same file as the first it receives a undefined error. I can't figure out how to deal with this. How do I set it up to have my function #1 call my function #2, and return? The only programming experience I've had where I pretty much knew what I was doing was with ARexx on the Amiga, a language much like Python without the OOP part. ARexx had a single-step debugger as part of the language installation. I've always depended on a debugger to help me understand what I'm doing (eg Script Debugger for Apple Script--not that I understand Apple Script) Python's debug system is largely confusing to me, but of course I'll keep at it. I would love to see a step-by-step debugging tutorial designed for someone like me who usually wants to single-step through an entire script. Thanks for any help, Greg Reyna -- http://mail.python.org/mailman/listinfo/python-list
Re: Measuring Fractal Dimension ?
On Jun 22, 7:43 pm, David C. Ullrich ullr...@math.okstate.edu wrote: Surely you don't say a curve is a subset of the plane and also talk about the integrals of verctor fields over _curves_? [snip rest of long response that needs a decent reply, but possibly not here... ] I wonder whether we can find a better place to have this discussion; I think there are still plenty of interesting things to say, but I fear we're rather abusing the hospitality of comp.lang.python at the moment. I'd suggest moving it to sci.math, except that I've seen the noise/signal ratio over there... Mark -- http://mail.python.org/mailman/listinfo/python-list
Open source python projects
Hi There, I am an experienced C programmer and recently dived into python, I have developed an instant love for it. I have been doing some routine scripting for day to day admin tasks,also have done some Tkinter and socket programming using python. I am looking for some open source python project preferably in one of the above areas (not strictly, am open to others too) to contribute. Please give me any pointers to some python project which needs a contributor. Thanks Saurabh -- http://mail.python.org/mailman/listinfo/python-list
Re: fastest native python database?
Lawrence D'Oliveiro wrote: ... Use Python mapping objects. Most real-world databases will fit in memory anyway. Interesting theory. Certainly true for some definitions of most and real-world (and databases for that matter). --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list
Re: itertools.intersect?
On Jun 11, 6:23 pm, Mensanator mensana...@aol.com wrote: Removing the duplicates could be a big problem. It is fairly easy to ignore duplicates in a sorted list: pre from itertools import groupby def unique(ordered): Yield the unique elements from a sorted iterable. for key,_ in groupby(ordered): yield key /pre Combining this with some ideas of others, we have a simple, complete solution: pre def intersect(*ascendingSeqs): Yield the intersection of zero or more ascending iterables. N=len(ascendingSeqs) if N==0: return unq = [unique(s) for s in ascendingSeqs] val = [u.next() for u in unq] while True: for i in range(N): while val[i-1] val[i]: val[i] = unq[i].next() if val[0]==val[-1]: yield val[0] val[-1] = unq[-1].next() /pre This works with empty arg-lists; combinations of empty, infinite and finite iterators; iterators with duplicate elements; etc. The only requirement is that all iterators are sorted ascending. -- FC -- http://mail.python.org/mailman/listinfo/python-list
Re: Procedures
On Mon, 2009-06-22 at 12:13 -0700, Greg Reyna wrote: Learning Python (on a Mac), with the massive help of Mark Lutz's excellent book, Learning Python. What I want to do is this: I've got a Class Object that begins with a def. It's designed to be fed a string that looks like this: scene 1, pnl 1, 3+8, pnl 2, 1+12, pnl 3, 12, pnl 4, 2+4, I'm parsing the string by finding the commas, and pulling out the data between them. No problem so far (I think...) The trouble is, there is a place where code is repeated: 1. Resetting the start end position and finding the next comma in the string. Have you looked at the split() method on string objects. It works kind of like this: s = scene 1, pnl 1, 3+8, pnl 2, 1+12, pnl 3, 12, pnl 4, 2+4, s.split(,) ['scene 1', ' pnl 1', ' 3+8', ' pnl 2', ' 1+12', ' pnl 3', ' 12', ' pnl 4', ' 2+4', ''] elements = s.split(,) elements ['scene 1', ' pnl 1', ' 3+8', ' pnl 2', ' 1+12', ' pnl 3', ' 12', ' pnl 4', ' 2+4', ''] elements[2] ' 3+8' In my previous experience (with a non-OOP language), I could create a 'procedure', which was a separate function. With a call like: var=CallProcedure(arg1,arg2) the flow control would go to the procedure, run, then Return back to the main function. Python doesn't have procedures quite like this. It has functions (the things starting with def), which generally speaking take arguments and return values. For the most part, you do not want your functions to operate on variables that aren't either defined in the function or passed in as arguments. That leads to difficult-to-debug code. In Python, when I create a second def in the same file as the first it receives a undefined error. I can't figure out how to deal with this. How do I set it up to have my function #1 call my function #2, and return? Your problem description is confusing. First of all, no class starts with 'def'. They all start with 'class'. Perhaps you are talking about a module (a python file)? Also, telling us that you get an undefined error is not particularly helpful. Every Exception that python raises is accompanied by an extensive stack trace which will help you (or us) debug the problem. If you don't show us this information, we can't tell you what's going wrong. It will tell you (in ways that are crystal clear once you have a bit of practice reading them) exactly what went wrong. Can you show your code, as well as the complete error message you are receiving? My suggestions here, are essentially a paraphrasing of Eric Raymond's essay, How to Ask Smart Questions. It is freely available on the web, and easily found via google. I recommend reading that, in order to get the most mileage out this news group. Cheers, Cliff -- http://mail.python.org/mailman/listinfo/python-list
Re: Open source python projects
On 22 Giu, 21:40, saurabh saur...@saurabh.org wrote: Hi There, I am an experienced C programmer and recently dived into python, I have developed an instant love for it. I have been doing some routine scripting for day to day admin tasks,also have done some Tkinter and socket programming using python. I am looking for some open source python project preferably in one of the above areas (not strictly, am open to others too) to contribute. Please give me any pointers to some python project which needs a contributor. Thanks Saurabh If you have experience in C system programming then you could help us with psutil: http://code.google.com/p/psutil You might want to take a look at our Milestone wiki which lists some features we would like to implement: http://code.google.com/p/psutil/wiki/Milestones The platforms we aim to support are: Linux, OS X, Windows and FreeBSD. If you're interested feel free to contact me at [g.rodola -AT- gmail - DOT- com] or use the psutil mailing list: http://groups.google.com/group/psutil --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil -- http://mail.python.org/mailman/listinfo/python-list
RE: Good books in computer science?
A big yes to Scott's remarks. The first law of programming is: Write as you would be written unto. Apologies to Kingsley. Phil -Original Message- From: Scott David Daniels [mailto:scott.dani...@acm.org] Sent: Tuesday, 23 June 2009 7:14 a.m. To: python-list@python.org Subject: Re: Good books in computer science? Chris Jones wrote: Maybe I'm nitpicking, but the one thing I don't understand is how you practice programming. The term makes obvious sense when you're talking about your golf swing, acquiring competitive driving skills, playing tetris.. But programming..?? It is practice in the same way as learning to write well requires practice. Writing good code is a writing skill, as well as a precision of thought exercise. The basics of Computer Science are well-covered in TAOCP Volumes 1-5 (not all yet available in stores :-). You _must know data structures and fundamental algorithms, but after that what you write is a way of expressing clearly what you learn in a field. The field may be as narrow as the field of Ink-Jet Printer automated testing for models XXX through XYZ of manufacturer Z, but in some sense the programs should clearly expr4ess that knowledge. If you read books on learning to write clearly, even if they are oriented to (non-fiction) writing in English, none of them advocate intensive study of a theory with little practice. You can follow the advice in those books (with a loose interpretation of the instructions) and improve your code. What the best teach you is be succinct, clear, unambiguous, and try new things regularly. It is only this variation that can help you get better. Read what others write about how to write code, but remember you will have your own style. Take what others write about how to code as a cook does a recipe: you should be understand what is being attempted, try it the authors way to see what new might surprise you, and carry away only what you find you can incorporate into your own process. How we pull stuff from our brains is as varied as the brains themselves. We bring a host of experiences to our writing, and we should similarly bring that to the programs we write. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list
Re: Measuring Fractal Dimension ?
On Jun 22, 2009, at 2:16 PM, David C. Ullrich wrote: On Mon, 22 Jun 2009 10:31:26 -0400, Charles Yeomans char...@declaresub.com wrote: On Jun 22, 2009, at 8:46 AM, pdpi wrote: On Jun 19, 8:13 pm, Charles Yeomans char...@declaresub.com wrote: On Jun 19, 2009, at 2:43 PM, David C. Ullrich wrote: snick Hmm. You left out a bit in the first definition you cite: A simple closed curve J, also called a Jordan curve, is the image of a continuous one-to-one function from R/Z to R2. We assume that each curve comes with a fixed parametrization phi_J : R/Z -¨ J. We call t in R/Z the time parameter. By abuse of notation, we write J(t) in R2 instead of phi_j (t), using the same notation for the function phi_J and its image J. Close to sounding like he can't decide whether J is a set or a function... On the contrary, I find this definition to be written with some care. I find the usage of image slightly ambiguous (as it suggests the image set defines the curve), but that's my only qualm with it as well. Thinking pragmatically, you can't have non-simple curves unless you use multisets, and you also completely lose the notion of curve orientation and even continuity without making it a poset. At this point in time, parsimony says that you want to ditch your multiposet thingie (and God knows what else you want to tack in there to preserve other interesting curve properties) and really just want to define the curve as a freaking function and be done with it. -- But certainly the image set does define the curve, if you want to view it that way -- all parameterizations of a curve should satisfy the same equation f(x, y) = 0. This sounds like you didn't read his post, or totally missed the point. Say S is the set of (x,y) in the plane such that x^2 + y^2 = 1. What's the index, or winding number, of that curve about the origin? (Hint: The curve c defined by c(t) = (cos(t), sin(t)) for 0 = t = 2pi has index 1 about the origin. The curve d(t) = (cos(-t), sin(-t)) (0 = t = 2pi) has index -1. The curve (cos(2t), sin(2t)) (same t) has index 2.) That is to say, the winding number is a property of both the curve and a parameterization of it. Or, in other words, the winding number is a property of a function from S1 to C. Charles Yeomans -- http://mail.python.org/mailman/listinfo/python-list
Re: wikipedia with python
Andre Engels andreeng...@gmail.com wrote: On Mon, Jun 22, 2009 at 6:58 PM, zelegolaszelego...@gmail.com wrote: Let me know if it's the right place to ask. I'm looking for wiki writen with python where I can import all wikipedia site. If you have any links please let me know. I don't think that's possible. If you wnat to import Wikipedia in a wiki, it will probably have to be MediaWiki - and that's written in PHP. MoinMoin has a MediaWiki format parser (or two). Not 100% compatible, but good enough for some purposes. Templates will be a problem, though. -- --- | Radovan Garabík http://kassiopeia.juls.savba.sk/~garabik/ | | __..--^^^--..__garabik @ kassiopeia.juls.savba.sk | --- Antivirus alert: file .signature infected by signature virus. Hi! I'm a signature virus! Copy me into your signature file to help me spread! -- http://mail.python.org/mailman/listinfo/python-list
launch a .py file from a batch file
I'd like to launch a number of programs, one of which is a Python GUI app, from a batch file launcher. I'd like to click the .bat file and have it open all the stuff and then not show the DOS console. I can launch an Excel and Word file fine using, e.g.: Start path/mydocument.doc But if I try that with a Python file, like: Start path/myPythonApp.py It does nothing. The others open fine and no Python app. However, if I do this instead (where path = full pathname to Python file), cd path myPythonApp.py it will launch the Python app fine, but it will show the DOS console. How can I get it to launch a .py file and yet not show the console? Thanks, Che -- http://mail.python.org/mailman/listinfo/python-list
re.NONE
I am currently using python v2.5.2. Not sure if this is defined in a later version, but it would be nice to define re.NONE = 0 in the re module. This would be useful in cases such as: flags = re.DOTALL if dotall else re.NONE Also useful for building up flags by ORing with other flags. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to output a complex List object to a file.
On Mon, Jun 22, 2009 at 6:17 AM, Jim Qiubluefishe...@gmail.com wrote: Hi all, I have a object list list this: snip I need to output this structure object into a file, how to do that ? Links for the modules mentioned: http://docs.python.org/library/pickle.html http://docs.python.org/library/json.html Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Idioms and Anti-Idioms Question
On 2009-06-22, Lie Ryan lie.1...@gmail.com wrote: Ben Charrow wrote: value = foo.bar()['first'][0]*baz.quux(1, 2)[5:9] \ + calculate_number(10, 20)*forbulate(500, 360) What is subtly wrong about this piece of code? I can't see any bugs and can't think of subtle gotchas (e.g. the '\' is removed or the lines become separated, because in both cases an IndentationError would be raised). The preferred style is to put the binary operators before the line-break (i.e. the line break is after the operators): value = foo.bar()['first'][0]*baz.quux(1, 2)[5:9] + \ calculate_number(10, 20)*forbulate(500, 360) ... The following is an extract from PEP 8: The preferred way of wrapping long lines is by using Python's implied line continuation inside parentheses, brackets and braces. If necessary, you can add an extra pair of parentheses around an expression, but sometimes using a backslash looks better. Make sure to indent the continued line appropriately. The preferred place to break around a binary operator is *after* the operator, not before it. Damian Conway, in Perl Best Practices, puts forward a clear argument for breaking *before* the operator: Using an expression at the end of a statement gets too long, it's common practice to break that expression after an operator and then continue the expression on the following line ... The rationale is that the operator that remains at the end of the line acts like a continutation marker, indicating that the expression continues on the following line. Using the operator as a continutation marker seems like an excellent idea, but there's a serious problem with it: people rarely look at the right edge of code. Most of the semantic hints in a program - such as keywords - appear on the left side of that code. More importantly, the structural cues for understanding code - for example, indenting, - are predominantly on the left as well ... This means that indenting the continued lines of the expression actually gives a false impression of the underlying structure, a misperception that the eye must travel all the way to the right margin to correct. which seems to me well-argued. I wonder on what grounds PEP8 says The preferred place to break around a binary operator is *after* the operator ? Perhaps it's just the continutation marker rationale? Regards, Peter -- Peter Billam www.pjb.com.auwww.pjb.com.au/comp/contact.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Open source python projects
Saurabh I am looking for some open source python project preferably in Saurabh one of the above areas (not strictly, am open to others too) to Saurabh contribute. If you have some Windows programming experience the SpamBayes project (http://www.spambayes.org/) could use some assistance. We have been held up because our existing Windows experts have been too busy to contribute much for a couple years. -- Skip Montanaro - s...@pobox.com - http://www.smontanaro.net/ when i wake up with a heart rate below 40, i head right for the espresso machine. -- chaos @ forums.usms.org -- http://mail.python.org/mailman/listinfo/python-list
Re: Open source python projects
Saurabh, 1. The Dabo crew is doing some exciting thing. Might be worth checking out. http://dabodev.com 2. The Py2exe project is also looking for help (and some C experience would be beneficial to this project). http://py2exe.org 3. There's a bunch of encryption code floating around in native Python that would benefit from being recoded as native C modules. Welcome! Malcolm -- http://mail.python.org/mailman/listinfo/python-list
Re: Procedures
Greg Reyna wrote: div class=moz-text-flowed style=font-family: -moz-fixedLearning Python (on a Mac), with the massive help of Mark Lutz's excellent book, Learning Python. What I want to do is this: I've got a Class Object that begins with a def. It's designed to be fed a string that looks like this: scene 1, pnl 1, 3+8, pnl 2, 1+12, pnl 3, 12, pnl 4, 2+4, I'm parsing the string by finding the commas, and pulling out the data between them. No problem so far (I think...) The trouble is, there is a place where code is repeated: 1. Resetting the start end position and finding the next comma in the string. In my previous experience (with a non-OOP language), I could create a 'procedure', which was a separate function. With a call like: var=CallProcedure(arg1,arg2) the flow control would go to the procedure, run, then Return back to the main function. In Python, when I create a second def in the same file as the first it receives a undefined error. I can't figure out how to deal with this. How do I set it up to have my function #1 call my function #2, and return? The only programming experience I've had where I pretty much knew what I was doing was with ARexx on the Amiga, a language much like Python without the OOP part. ARexx had a single-step debugger as part of the language installation. I've always depended on a debugger to help me understand what I'm doing (eg Script Debugger for Apple Script--not that I understand Apple Script) Python's debug system is largely confusing to me, but of course I'll keep at it. I would love to see a step-by-step debugging tutorial designed for someone like me who usually wants to single-step through an entire script. Thanks for any help, Greg Reyna You should post an example. Otherwise we can just make wild guesses. So for a wild guess, perhaps your question is how an instance method calls another instance method. But to put it briefly, a def inside a class definition does not create a name at global scope, but instead defines a method of that class. Normally, you have to use an object of that class as a prefix to call such a function (with the exception of __init__() for one example). class A(object): def func1(self, parm1, parm2): do some work self.func2(arg1) do some more work def func2(self, parm1): do some common work q = A() q.func1(data1, data2) Here we use q.func1() to call the func1 method on the q instance of the class. We could also call q.func2() similarly. But I think you may have been asking about func1 calling func2. Notice the use of self.func2(). Self refers to the object of the method we're already in. -- http://mail.python.org/mailman/listinfo/python-list
Re: Open source python projects
On 6/22/2009 3:40 PM saurabh apparently wrote: I am an experienced C programmer and recently dived into python, I have developed an instant love for it. I have been doing some routine scripting for day to day admin tasks,also have done some Tkinter and socket programming using python. I am looking for some open source python project preferably in one of the above areas (not strictly, am open to others too) to contribute. A one off project ... If you can help figure out how to produce a Windows installer of SimpleParse for Python 2.6 and post your experience here, I believe quite a few projects would profit, not to mention the SimpleParse users themselves. Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list