Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-07 Thread Reinhold Birkenfeld
Ron Adam wrote: Given the statement: a = None And the following are all true: a == None Okay. (a) == (None) Okay. (a) == () Whoops! a (which is None) is equal to the empty tuple (which is not None)? (None) == () Then this conceptual comparison should also be true: if

ANN: python-constraint 1.0

2005-07-07 Thread Gustavo Niemeyer
Overview **python-constraint** [1]_ is a Python module offering solvers for Constraint Solving Problems (CSPs) over finite domains in simple and pure Python. CSP is class of problems which may be represented in terms of variables (`a`, `b`, ...), domains (`a in [1, 2, 3]`, ...),

Do a Python beginners e-mail list exist?

2005-07-07 Thread Alessandro Brollo
Far from a professional programmer, I'm simply a newbie Python user. Two basic questions: 1. I don't want to post banal questions about Python to main Python list. Does a banal Python questions list or a Python beginners list exist? 2. There is somewhere a very patient fellow willing to be my

Re: Tkinter grid layout

2005-07-07 Thread Eric Brunel
On Wed, 06 Jul 2005 16:32:42 GMT, William Gill [EMAIL PROTECTED] wrote: Excuse me for intruding, but I followed examples and ended up with a similar architecture: from Tkinter import * class MyMain(Frame): def __init__(self, master): self.root = master

Re: Do a Python beginners e-mail list exist?

2005-07-07 Thread Gerald Klix
Perhaps irc://irc.freenode.net##python Note the double # This channel is less crowed as the #python channels are. Alessandro Brollo schrieb: Far from a professional programmer, I'm simply a newbie Python user. Two basic questions: 1. I don't want to post banal questions about Python to

Re: How do you program in Python?

2005-07-07 Thread Jorgen Grahn
On Wed, 6 Jul 2005 14:56:09 +0200, Sybren Stuvel [EMAIL PROTECTED] wrote: ... I'm usually annoyed by IDEs because, for instance, they don't use VIM as an editor. Since I'm hooked to that, all IDEs I've used so far have failed to impress me. Same here (s/VIM/Emacs/, or course). I try not to

RE: Do a Python beginners e-mail list exist?

2005-07-07 Thread Tony Meyer
1. I don't want to post banal questions about Python to main Python list. Does a banal Python questions list or a Python beginners list exist? Yes: http://mail.python.org/mailman/listinfo/tutor There are plenty of people there that will be glad to help! =Tony.Meyer --

Re: Conditionally implementing __iter__ in new style classes

2005-07-07 Thread Thomas Heller
[EMAIL PROTECTED] (Bengt Richter) writes: On Wed, 06 Jul 2005 17:57:42 +0200, Thomas Heller [EMAIL PROTECTED] wrote: I'm trying to implement __iter__ on an abstract base class while I don't know whether subclasses support that or not. Will a property or custom descriptor do what you want?

Re: Do a Python beginners e-mail list exist?

2005-07-07 Thread Brian van den Broek
Alessandro Brollo said unto the world upon 07/07/2005 03:24: Far from a professional programmer, I'm simply a newbie Python user. Two basic questions: 1. I don't want to post banal questions about Python to main Python list. Does a banal Python questions list or a Python beginners list

Re: Lisp development with macros faster than Python development?..

2005-07-07 Thread Antoon Pardon
Op 2005-07-07, Philippe C. Martin schreef [EMAIL PROTECTED]: Almost sounds like a racist comment - sorry if I misunderstood I'll clarify. A lot of the time I hear arguments against features that boils down to. 1) I don't need it. 2) Having the feature will make my job more difficult.

Why anonymity? [was Re: map/filter/reduce/lambda opinions and background unscientific mini-survey]

2005-07-07 Thread Steven D'Aprano
Steven Bethard wrote: If you're really afraid of two lines, write it as: def r(): randint(1, 100) This is definitely a bad case for an anonymous function because it's not anonymous! You give it a name, r. This is something I've never understood. Why is it bad form to assign an

Re: Use cases for del

2005-07-07 Thread Steven D'Aprano
Ron Adam wrote: Why would you want to use None as an integer value? If a value isn't established yet, then do you need the name defined? Wouldn't it be better to wait until you need the name then give it a value? Er, maybe I'm misunderstanding something here, but surely the most obvious

Re: How do you program in Python?

2005-07-07 Thread Gregory Bond
Jorgen Grahn wrote: Emacs and vim are almost always installed, or trivially installable. All I need to remember is to bring my emacs config file. And, fortunately, USB pen drives are now big enough to hold it! -- http://mail.python.org/mailman/listinfo/python-list

HELP!

2005-07-07 Thread Ert Ert
Please help me i down loaded python nd itplays on MS-DOS mode and not on normal please help [EMAIL PROTECTED] -- ___ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm --

Re: Create datetime instance using a tuple.

2005-07-07 Thread Negroup
Use: dt =3D datetime(*t) Thanks for the quick reply. I can't find any doc about '*' used in this context. Have you some url or suggestion for which terms search in Google? -- http://mail.python.org/mailman/listinfo/python-list

Re: latex/bibtex python paper?

2005-07-07 Thread Jorgen Grahn
On 6 Jul 2005 08:28:45 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi All, Does anyone have a good template that I might use for writing a python paper in latex/bibtex? I've got the paper mostly done, but am having issues with the references. I am definitely not an expert at

Re: HELP!

2005-07-07 Thread Robert Kern
Ert Ert wrote: Please help me i down loaded python nd itplays on MS-DOS mode and not on normal please help So what's your problem? Please read http://www.catb.org/~esr/faqs/smart-questions.html Then reformulate your question so that we can answer it. -- Robert Kern [EMAIL PROTECTED] In

Re: Why anonymity? [was Re: map/filter/reduce/lambda opinions and background unscientific mini-survey]

2005-07-07 Thread Duncan Booth
Steven D'Aprano wrote: This is something I've never understood. Why is it bad form to assign an anonymous function (an object) to a name? Because it obfuscates your code for no benefit. You should avoid making it hard for others to read your code (and 'others' includes yourself in the

Re: Do a Python beginners e-mail list exist?

2005-07-07 Thread Giovanni Dall'Olio
Hi, have you seen the python ML at www.python.it? It's in Italian. You can find even other tutorial for beginners here. See also www.zonapython.it -- http://mail.python.org/mailman/listinfo/python-list

Re: Create datetime instance using a tuple.

2005-07-07 Thread John Machin
Negroup wrote: Use: dt =3D datetime(*t) Thanks for the quick reply. I can't find any doc about '*' used in this context. Have you some url or suggestion for which terms search in Google? http://www.python.org/doc/2.4.1/tut/tut.html Then read this section 4.7.4 Unpacking Argument Lists

Re: ANN: python-constraint 1.0

2005-07-07 Thread gabriele renzi
Gustavo Niemeyer ha scritto: Overview **python-constraint** [1]_ is a Python module offering solvers for Constraint Solving Problems (CSPs) over finite domains in simple and pure Python. CSP is class of problems which may be represented in terms of variables (`a`, `b`,

How to use Adobe Illustrator Export function within a Python script

2005-07-07 Thread adder
I would like to create a script that can export ai-files to jpg-files using the export function available in Adobe Illustrator. Can someone tell me how to dispatch the illustrator com-object to make this possible and possibly provide me with some tips on how to accomplish this?! Thanks in advance

Re: HELP!

2005-07-07 Thread Giovanni Dall'Olio
Ahah, I've to save this page. p.s. @ Ert Ert: download this: http://starship.python.net/crew/mhammond/win32/ and use 'Pythonwin' (or, use Unix!) -- http://mail.python.org/mailman/listinfo/python-list

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-07 Thread Chris Rebert (cybercobra)
Agreed, I dislike map and its ilk as well. However, they are handy in some cases. I particularly like the way Ruby deals with this problem. Instead of all these functions, internal iterators and true anonymous blocks are used. Case in point: def gt_than_5(obj): return obj 5 results =

Re: f*cking re module

2005-07-07 Thread Chris Smith
Michael == Michael Hoffman [EMAIL PROTECTED] writes: Michael Greg Lindstrom wrote: I hear that Perl 6 is going to have a rewrite of regular expressions; it will be interesting to see what their hard work produces. Michael From what I saw a while ago, it didn't look like

Re: Python exception hook simple example needed

2005-07-07 Thread Fuzzyman
Do you have an exception handling dialog ? Can you use the UI layer without being tied to the rest of the framework ? They seemed pretty integrated to me. Best Regards, Fuzzy http://www.voidspace.org.uk/pythonhave an -- http://mail.python.org/mailman/listinfo/python-list

VC++ linking problem

2005-07-07 Thread J
Hi everyone, I started embedding python into a 3D graphics App and I came across this linking problem. SO.lib(ScnGlobal.obj) : error LNK2001: unresolved external symbol __imp__Py_InitModule4TraceRefs SO.lib(ScnNode.obj) : error LNK2001: unresolved external symbol __imp___Py_RefTotal

Re: VC++ linking problem

2005-07-07 Thread Gerhard Haering
On Thu, Jul 07, 2005 at 04:52:11AM -0700, J wrote: Hi everyone, I started embedding python into a 3D graphics App and I came across this linking problem. SO.lib(ScnGlobal.obj) : error LNK2001: unresolved external symbol __imp__Py_InitModule4TraceRefs SO.lib(ScnNode.obj) : error

Re: VC++ linking problem

2005-07-07 Thread Miki Tebeka
Hello Jochen, I started embedding python into a 3D graphics App and I came across this linking problem. SO.lib(ScnGlobal.obj) : error LNK2001: unresolved external symbol __imp__Py_InitModule4TraceRefs SO.lib(ScnNode.obj) : error LNK2001: unresolved external symbol __imp___Py_RefTotal

how to change a script while it is running

2005-07-07 Thread faxme
Hi, I would like to know if it is possible to change code on the fly on a python interpreter. I want to have a python script running a multithread server and be able to connect to this python script and change the interpreter environment. Is this possible? Ideally i would like to call python,

Re: Favorite non-python language trick?

2005-07-07 Thread Edvard Majakari
Simon Brunning [EMAIL PROTECTED] writes: http://wiki.python.org/moin/PythonDecoratorLibrary?#head-de01988728ccdec415708f10928cc6feb022e7bb Neat. I guess about 75% about programming-related things classified as neat-o or convenient! are already implemented by some Pythonista(s). Spoils all the

Re: Favorite non-python language trick?

2005-07-07 Thread Shai
Mike Meyer wrote: Shai [EMAIL PROTECTED] writes: They're called Special vars, and you need to define them (unlike local LISP variables, which behave essentially like Python vars), but then you use them just like other vars (that is, you usually bind them with LET). This is the first I

Re: VC++ linking problem

2005-07-07 Thread Wolfgang Langner
Hello Jochen, I started embedding python into a 3D graphics App and I came across this linking problem. SO.lib(ScnGlobal.obj) : error LNK2001: unresolved external symbol __imp__Py_InitModule4TraceRefs SO.lib(ScnNode.obj) : error LNK2001: unresolved external symbol __imp___Py_RefTotal

Re: Modules for inclusion in standard library?

2005-07-07 Thread awbarker
1. LDAP module should be included in the base distro. 2. DNS library really should be included in the base library, I emailed Anthony Baxter and he replied, saying it was almost done. 3. Ipython would be nice -- http://mail.python.org/mailman/listinfo/python-list

Re: VC++ linking problem

2005-07-07 Thread J
Thank you very much Miki! That was an easy solution. It links... I will put a hold on compiling the latest version until I really have to. I will probably switch to VC 7 before that. Cheers Jochen Miki Tebeka wrote: Hello Jochen, I started embedding python into a 3D graphics App and I came

Windows Cmd.exe Window

2005-07-07 Thread Giles Brown
For my sins I'm a MS Windows user at work and apart from that I have a small problem ... I like to write python scripts to do small tasks and then double click on them from the file explorer to run them. Unfortunately I'm not perfect and sometimes I make mistakes and have unhandled exceptions or

Re: Windows Cmd.exe Window

2005-07-07 Thread Thorsten Kampe
* Giles Brown (2005-07-07 13:56 +0100) For my sins I'm a MS Windows user at work and apart from that I have a small problem ... I like to write python scripts to do small tasks and then double click on them from the file explorer to run them. Unfortunately I'm not perfect and sometimes I

Re: calling python procedures from tcl using tclpython

2005-07-07 Thread Michael Schlenker
chand wrote: Hi.. I am writing a Gui in TCL and my backend code is python. I want to call python procedure in tcl using tclpyhton. I want to know clearly how this should be implemented. let's say I have procedure test_function(arg1,arg2 ...) defined in test.py. I want to call this

Re: Windows Cmd.exe Window

2005-07-07 Thread Giles Brown
Nah. You're missing my point. I only want the command window not to be closed if there is an *exception*. Picky I know, but there you go. Giles -- http://mail.python.org/mailman/listinfo/python-list

Re: Strange os.path.exists() behaviour

2005-07-07 Thread Sion Arrowsmith
Jeff Epler [EMAIL PROTECTED] wrote: Pierre wrote: Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on wi= n32 = ^^^ Here's the bug. You're using Windows. It's a filesystem, but not as we kn= ow it...

Re: Windows Cmd.exe Window

2005-07-07 Thread harold fellermann
On 07.07.2005, at 15:25, Giles Brown wrote: Nah. You're missing my point. I only want the command window not to be closed if there is an *exception*. Picky I know, but there you go. well, then register raw_input as exit function: import atexit atexit.register(raw_input) works fine in

Re: calling python procedures from tcl using tclpython

2005-07-07 Thread chand
That is exactly i want to know. i.e...,how to provide the python code path in tcl script file, that loads required function. --BestRegards., --chandra definitions etc. Michael Schlenker wrote: chand wrote: Hi.. I am writing a Gui in TCL and my backend code is python. I want to call

Re: Windows Cmd.exe Window

2005-07-07 Thread harold fellermann
On 07.07.2005, at 15:43, harold fellermann wrote: On 07.07.2005, at 15:25, Giles Brown wrote: Nah. You're missing my point. I only want the command window not to be closed if there is an *exception*. Picky I know, but there you go. well, then register raw_input as exit function:

Re: Windows Cmd.exe Window

2005-07-07 Thread Larry Bates
Use sys.excepthook to hook a function you define and in that function print a traceback and pause before exiting. Something like (not tested but copied from working example): import sys def Myexcepthook(type, value, traceback): print in Myexcepthook-type=, type, value=,value,

Re: Determining actual elapsed (wall-clock) time

2005-07-07 Thread zooko
The traditional use of gettimeofday() to (insecurely and unreliably) approximate elapsed local time is one of my pet peeves. Fortunately a real monotonic clock has finally been added to the linux kernel and glibc: http://www.imperialviolet.org/page24.html#e474 If you have a recent enough kernel

Re: ANN: python-constraint 1.0

2005-07-07 Thread Benji York
Gustavo Niemeyer wrote: **python-constraint** [1]_ is a Python module offering solvers for Constraint Solving Problems (CSPs) over finite domains in simple and pure Python. Very cool! I can't wait to get some time to play with this. -- Benji York --

Re: Windows Cmd.exe Window

2005-07-07 Thread Giles Brown
Thanks for your replies. I think we might have a miscommunication here as (to my understanding) neither of your replies actually solve my problem. After all, the function raw_input is just another way of blocking until user input. I was already doing that using os.system('pause'). To recap,

Re: latex/bibtex python paper?

2005-07-07 Thread Florian Diesch
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Does anyone have a good template that I might use for writing a python paper in latex/bibtex? I've got the paper mostly done, but am having issues with the references. I am definitely not an expert at latex/bibtex. Right now, I have references

question about introspection using inspect module

2005-07-07 Thread Benjamin Rutt
I'm trying to learn about introspection in Python. my ultimate goal is to be able to build a module text database of all modules that are in the sys.path, by discovering all candidate modules (I've already done that), importing all of them, and then introspecting on each module to discover its

Re: Windows Cmd.exe Window

2005-07-07 Thread Thomas Heller
Giles Brown [EMAIL PROTECTED] writes: Nah. You're missing my point. I only want the command window not to be closed if there is an *exception*. Picky I know, but there you go. I find it useful to set an sys.excepthook which calls the debugger pdb.pm(). This way I not only see the

Re: Windows Cmd.exe Window

2005-07-07 Thread Giles Brown
Hi Larry, I mentioned how I am already using sys.excepthook in my initial posting. What I'm looking for is: 1) Is there any better way of solving the problem than setting sys.excepthook in sitecustomize.py? 2) Or is there a better way of detecting when I am running a .cmd based script than the

Re: Windows Cmd.exe Window

2005-07-07 Thread Duncan Booth
harold fellermann wrote: sorry, I did not think. if you want to wait for input _only_ if an exception occured, your exit function needs to check for the exception: import atexit def wait_on_exc() : ... import sys ... if sys.exc_type : ... raw_input() ...

Re: Windows Cmd.exe Window

2005-07-07 Thread Duncan Booth
Giles Brown wrote: The special first line is: @pythoncmd -x %~f0 %* exit /b (In the python.org FAQ for windows it says @setlocal enableextensions python -x %~f0 %* goto :EOF but since I have no idea which is right I chose the simpler looking one) This approach does require

Re: Use cases for del

2005-07-07 Thread Grant Edwards
On 2005-07-07, Ron Adam [EMAIL PROTECTED] wrote: class demo: def foo(v=None): if v is not None: self.v = v return self.v You are really checking if v exists, so having it undefined in namespace as the default is consistent with what you are

Re: Do a Python beginners e-mail list exist?

2005-07-07 Thread Grant Edwards
On 2005-07-07, Alessandro Brollo [EMAIL PROTECTED] wrote: Far from a professional programmer, I'm simply a newbie Python user. Two basic questions: 1. I don't want to post banal questions about Python to main Python list. Go ahead. We're really quite nice. Extraordinarily so by Usenet

Re: Windows Cmd.exe Window

2005-07-07 Thread Giles Brown
Hooray! We have a winner! Thanks Duncan. Your improved shell line will do the job very nicely. :) (btw, the problem with import sethook at the top of the script is that syntax errors in the top-level will prevent the import from being run meaning we don't get our traceback anymore.) Giles --

Re: f*cking re module

2005-07-07 Thread Steven D'Aprano
On Thu, 07 Jul 2005 06:47:54 -0400, Chris Smith wrote: Michael == Michael Hoffman [EMAIL PROTECTED] writes: Michael Greg Lindstrom wrote: I hear that Perl 6 is going to have a rewrite of regular expressions; it will be interesting to see what their hard work produces.

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-07 Thread Paweł Sakowski
Tom Anderson wrote: def flatten(ll): return reduce(lambda a, l: a.extend(l), ll, []) How would one do that as a list comp, by the way? I'm really not very good with them yet. Not really a list-comprehension based solution, but I think what you want is ll=[[1,2],[3,4,5],[6]] sum(ll,[])

Re: HELP!

2005-07-07 Thread Rocco Moretti
Ert Ert wrote: Please help me i down loaded python nd itplays on MS-DOS mode and not on normal please help Python itself is a command line program. MS-DOS mode *is* it's normal mode. As other's have mentioned, there are graphical front ends to Python which you may be more comforatble with.

Re: Why anonymity? [was Re: map/filter/reduce/lambda opinions and background unscientific mini-survey]

2005-07-07 Thread Steven D'Aprano
On Thu, 07 Jul 2005 09:36:24 +, Duncan Booth wrote: Steven D'Aprano wrote: This is something I've never understood. Why is it bad form to assign an anonymous function (an object) to a name? Because it obfuscates your code for no benefit. You should avoid making it hard for others

Re: (Win32 API) callback to Python, threading hiccups

2005-07-07 Thread Scott David Daniels
Francois De Serres wrote: PyGILState_STATE gil = PyGILState_Ensure(); result = PyEval_CallObject(my_callback, arglist); PyGILState_Release(gil); Py_DECREF(arglist); Py_DECREF(result); I think this should be: PyGILState_STATE

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-07 Thread Sion Arrowsmith
=?ISO-8859-2?Q?Pawe=B3?= Sakowski [EMAIL PROTECTED] wrote: ll=[[1,2],[3,4,5],[6]] sum(ll,[]) [1, 2, 3, 4, 5, 6] That's a great argument for list.__add__ having the semantics of extend rather than append 8-) -- \S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/ ___ | Frankly I have

Re: Windows Cmd.exe Window

2005-07-07 Thread Giles Brown
Addendum - forgot to mention that the problem with checking the extension of sys.argv[0] is that sys.argv[0] is not set until after sitecustomize.py is run (and it needs to be in sitecustomize.py not an imported module due to the top-level SyntaxError problem mentioned in my other post). Cheers

Pattern question

2005-07-07 Thread cantabile
Hi, I'm trying to write a small installer for a server. But this program should be able to run in the future under heterogenous environments and os (at least linux/windows). I mean, the install will be done either in text mode or curses or gtk or tk, either in debian or windows 2000 and so on...

Re: Conditionally implementing __iter__ in new style classes

2005-07-07 Thread Bengt Richter
On Thu, 07 Jul 2005 09:51:42 +0200, Thomas Heller [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (Bengt Richter) writes: On Wed, 06 Jul 2005 17:57:42 +0200, Thomas Heller [EMAIL PROTECTED] wrote: I'm trying to implement __iter__ on an abstract base class while I don't know whether subclasses

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-07 Thread Ron Adam
Reinhold Birkenfeld wrote: Ron Adam wrote: Given the statement: a = None And the following are all true: a == None Okay. (a) == (None) Okay. (a) == () Whoops! a (which is None) is equal to the empty tuple (which is not None)? It's not an empty tuple, it's an empty

Re: Why anonymity? [was Re: map/filter/reduce/lambda opinions and background unscientific mini-survey]

2005-07-07 Thread Bengt Richter
On 7 Jul 2005 15:46:23 GMT, Duncan Booth [EMAIL PROTECTED] wrote: Steven D'Aprano wrote: Put it this way: whenever I see a two-line def as above, I can't help feeling that it is a waste of a def. (Somebody went to all the trouble to define a function for *that*?) Yet I would never think the

Re: flatten(), [was Re: map/filter/reduce/lambda opinions ...]

2005-07-07 Thread Tom Anderson
On Thu, 7 Jul 2005, Ron Adam wrote: Stian Søiland wrote: Or what about a recursive generator? That's the sort of thing i like to see! Ok, lets see... I found a few problems with the testing (and corrected it) so the scores have changed. My sort in place routines were cheating because

Re: latex/bibtex python paper?

2005-07-07 Thread ansobol
Kurt, Try http://www.tex.ac.uk/cgi-bin/texfaq2html?label=citeURL and search this site (the famous UK TeX FAQ) at http://www.tex.ac.uk/cgi-bin/texfaq2html?introduction=yes#search for other info. You might also ask this question at the comp.text.tex group (which, in my experience, is as nice as

Re: Why anonymity? [was Re: map/filter/reduce/lambda opinions and background unscientific mini-survey]

2005-07-07 Thread Ron Adam
Steven D'Aprano wrote: On Thu, 07 Jul 2005 09:36:24 +, Duncan Booth wrote: Steven D'Aprano wrote: This is something I've never understood. Why is it bad form to assign an anonymous function (an object) to a name? Because it obfuscates your code for no benefit. You should avoid making

method for Exception base class to raise the exception in an expression?

2005-07-07 Thread Bengt Richter
Sometimes it could be handy, e.g., cutting short iteration: def raisex(self, *args): ... raise self.__class__(self, *args) ... Exception.raisex = raisex list(i for i in xrange(20) if i10 or StopIteration().raisex()) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] list(i for i in xrange(20) if i15

Re: precision problems in base conversion of rational numbers

2005-07-07 Thread [EMAIL PROTECTED]
Raymond Hettinger wrote: For a simple example, convert both 10247448370872321 and 10247448370872319 from base ten to 4 digits of hex. The calculations need to be carried out to 15 places of hex (or 17 places of decimal) just to determine whether the fourth hex digit is a 7 or 8:

Re: flatten()

2005-07-07 Thread Björn Lindström
Tom Anderson [EMAIL PROTECTED] writes: Stian Søiland wrote: Or what about a recursive generator? That's the sort of thing i like to see! That can be a neat method. It's a pretty verbose way to do flatten(), but it's a good example: def flatten(l): for e in l: if isinstance(e,

Re: how to change a script while it is running

2005-07-07 Thread Do Re Mi chel La Si Do
Hi ! Try : def ff(a): print a*2 ff(111) exec('''def ff(a): print a*3 ''',globals(),globals()) ff(111) @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Deleting variables [was Re: map/filter/reduce/lambda opinions and background unscientific mini-survey]

2005-07-07 Thread Tom Anderson
On Thu, 7 Jul 2005, Steven D'Aprano wrote: On Wed, 06 Jul 2005 14:28:55 +0100, Tom Anderson wrote: del - delete How about just getting rid of del? Removal from collections could be done with a method call, Which would be called object.del() I presume. That would be fine. And that opens

Re: How do you program in Python?

2005-07-07 Thread Jorgen Grahn
On Thu, 07 Jul 2005 18:10:44 +1000, Gregory Bond [EMAIL PROTECTED] wrote: Jorgen Grahn wrote: Emacs and vim are almost always installed, or trivially installable. All I need to remember is to bring my emacs config file. And, fortunately, USB pen drives are now big enough to hold it! Hey,

print values from Py_BuildValue

2005-07-07 Thread [EMAIL PROTECTED]
Hello, How do i print values returned by Py_BuildValue in Linux? PyObject *obj = Py_BuildValue({s:i}, Status, status); I need to print the Status value here -Thanks, Ashton -- http://mail.python.org/mailman/listinfo/python-list

Re: question about introspection using inspect module

2005-07-07 Thread Fernando Perez
Benjamin Rutt wrote: I'm trying to learn about introspection in Python. my ultimate goal is to be able to build a module text database of all modules that are in the sys.path, by discovering all candidate modules (I've already done that), importing all of them, and then introspecting on

Re: Use cases for del

2005-07-07 Thread Ron Adam
Grant Edwards wrote: On 2005-07-07, Ron Adam [EMAIL PROTECTED] wrote: It would be a way to set an argument as being optional without actually assigning a value to it. So it would still work like you expect even though v is not bound to anything. Like I said the bigger problem is that globals

Re: Use cases for del

2005-07-07 Thread Ron Adam
Steven D'Aprano wrote: Ron Adam wrote: Why would you want to use None as an integer value? If a value isn't established yet, then do you need the name defined? Wouldn't it be better to wait until you need the name then give it a value? Er, maybe I'm misunderstanding something here,

Re: Use cases for del

2005-07-07 Thread Dieter Maurer
Daniel Dittmar [EMAIL PROTECTED] writes on Wed, 06 Jul 2005 16:12:46 +0200: Peter Hansen wrote: Arguing the case for del: how would I, in doing automated testing, ensure that I've returned everything to a clean starting point in all cases if I can't delete variables? Sometimes a global is

Re: Conditionally implementing __iter__ in new style classes

2005-07-07 Thread Dieter Maurer
Thomas Heller [EMAIL PROTECTED] writes on Wed, 06 Jul 2005 18:07:10 +0200: Thomas Heller [EMAIL PROTECTED] writes: ... class Base: def __getattr__(self, name): if name == __iter__ and hasattr(self, Iterator): return self.Iterator raise AttributeError,

Python Module Exposure

2005-07-07 Thread Jacob Page
I have created what I think may be a useful Python module, but I'd like to share it with the Python community to get feedback, i.e. if it's Pythonic. If it's considered useful by Pythonistas, I'll see about hosting it on Sourceforge or something like that. Is this a good forum for exposing

Re: ANN: python-constraint 1.0

2005-07-07 Thread Alexandre Fayolle
On Thu, Jul 07, 2005 at 03:40:10AM -0300, Gustavo Niemeyer wrote: Overview **python-constraint** [1]_ is a Python module offering solvers for Constraint Solving Problems (CSPs) over finite domains in simple and pure Python. CSP is class of problems which may be

Re: Why anonymity? [was Re: map/filter/reduce/lambda opinions and background unscientific mini-survey]

2005-07-07 Thread Daniel Schüle
Am I just weird? I feel the same way about where to use lambda's and where *not* I come from C and C++ background and defining a function at the top level (no nested functions) would always require good reasons function name has to be remembered, to put it in other words it has to be added in

Re: Favorite non-python language trick?

2005-07-07 Thread Robert Kern
Edvard Majakari wrote: Simon Brunning [EMAIL PROTECTED] writes: http://wiki.python.org/moin/PythonDecoratorLibrary?#head-de01988728ccdec415708f10928cc6feb022e7bb Neat. I guess about 75% about programming-related things classified as neat-o or convenient! are already implemented by some

Re: Python Module Exposure

2005-07-07 Thread Robert Kern
Jacob Page wrote: I have created what I think may be a useful Python module, but I'd like to share it with the Python community to get feedback, i.e. if it's Pythonic. If it's considered useful by Pythonistas, I'll see about hosting it on Sourceforge or something like that. Is this a good

Re: latex/bibtex python paper?

2005-07-07 Thread Jules Dubois
On Wednesday 06 July 2005 09:28, [EMAIL PROTECTED] [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote: Hi All, Does anyone have a good template that I might use for writing a python paper in latex/bibtex? [...] When I cite these, I get something like this (Foundation[2005]). Questions like

Re: Conditionally implementing __iter__ in new style classes

2005-07-07 Thread Thomas Heller
[EMAIL PROTECTED] (Bengt Richter) writes: On Thu, 07 Jul 2005 09:51:42 +0200, Thomas Heller [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (Bengt Richter) writes: On Wed, 06 Jul 2005 17:57:42 +0200, Thomas Heller [EMAIL PROTECTED] wrote: I'm trying to implement __iter__ on an abstract base class

Re: Lisp development with macros faster than Python development?..

2005-07-07 Thread Terry Reedy
jayessay [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] 1. Someone recently remarked that good Lisp macros are basically executable pseudo code. I think that is pretty much exactly right and is a pretty good sound bite distillation of what it is all about. Several years

Re: Thoughts on Guido's ITC audio interview

2005-07-07 Thread Ville Vainio
Fabio == Fabio Zadrozny [EMAIL PROTECTED] writes: I agree about the project management part. Though I would still love to use Eclipse instead, if it only was supported for my line of work :-/. Fabio What line of work is not supported in eclipse? C++ programming for Symbian

Re: Lisp development with macros faster than Python development?..

2005-07-07 Thread Terry Reedy
Antoon Pardon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'll clarify. A lot of the time I hear arguments against features that boils down to. 1) I don't need it. 2) Having the feature will make my job more difficult. 3) I don't understand the merrits of the feature or I

Re: Lisp development with macros faster than Python development?..

2005-07-07 Thread Robert Kern
Terry Reedy wrote: jayessay [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] 1. Someone recently remarked that good Lisp macros are basically executable pseudo code. I think that is pretty much exactly right and is a pretty good sound bite distillation of what it is all about.

Re: Why anonymity? [was Re: map/filter/reduce/lambda opinions andbackground unscientific mini-survey]

2005-07-07 Thread Terry Reedy
The difference in readability between func = lambda x: x**3 - 5*x def func(x): return x**3 - 5*x def func(x): return x**3 - 5*x is obviously a matter of personal vision. The fuctional difference (and, I believe, the only difference) is that the def form attaches the specific name 'func'

Calculating average time

2005-07-07 Thread GregM
Hi, I'm hoping that someone can point me in the right direction with this. What I would like to do is calculate the average time it takes to load a page. I've been searching the net and reading lots but I haven't found anything that helps too much. I'm testing our web site and hiting +6000 urls

Re: Python Module Exposure

2005-07-07 Thread Jacob Page
Robert Kern wrote: Jacob Page wrote: I have created what I think may be a useful Python module, but I'd like to share it with the Python community to get feedback, i.e. if it's Pythonic. If it's considered useful by Pythonistas, I'll see about hosting it on Sourceforge or something

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-07 Thread Terry Reedy
Pawe³ Sakowski [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Tom Anderson wrote: def flatten(ll): return reduce(lambda a, l: a.extend(l), ll, []) How would one do that as a list comp, by the way? I'm really not very good with them yet. Not really a list-comprehension based

Re: Calculating average time

2005-07-07 Thread Skip Montanaro
greg 1. Is there a better time function to use? For this particular scenario I think time.time() is probably what you want: cumulative = 0.0 n = 0 for link in links: t = time.time() ie.Navigate(link) cumulative += time.time() - t n += 1 print

Re: ANN: python-constraint 1.0

2005-07-07 Thread Gustavo Niemeyer
Hello Alexandre, People interested in CSP and python may also want to check Logilab's constraint module which has been available from some time at: http://www.logilab.org/projects/constraint/ Indeed! And please send us some notes comparing both. :-) The AIMA book inspired me to write that

Re: Python Module Exposure

2005-07-07 Thread Rocco Moretti
Robert Kern wrote: Jacob Page wrote: Does this newsgroup find attachments acceptable? No. Please put files somewhere on the web and post a URL. This would be a good forum to informally announce and discuss your module. To add to what Robert said, keep in mind this newsgroup is also

  1   2   >