Re: Python Card alternatives?
As you said, desktop apps are losing appeal. I suggest looking for a web based solution. Perhaps python + silverlight? (I haven't tried it though). Unfortunately, the client-side (browser) is the domain of javascript. What I'm doing is polishing my html/css skills coupled with jquery. I have lost faith in a python solution for these tasks. Although there's something close enough that can make your experience totally different: Coffeescript. This is an enhanced syntax layer on top of javascript, inspired in python and ruby, which feels like a breath of fresh air to any python or ruby programmer. It plays very well with jquery and gives you all the pythonic goodies you are used to, like list comprehensions (called array and object comprehensions), slicing, ranges, etc. Coffeescript pre compiles your code to pure javascript so there's no performance degradation at all. If it does not convince you and you still prefer a python solution, you may want to check pyjamas (a port of GWT to python). There are also some experiments such as Skulp to have python running in the browser, although this approach implies a serious performance hit, since it's a full python implementation in javascript. regards, Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Anyone here can do a comparation between Djang and RoR
On Aug 16, 2:11 pm, Seebs wrote: > On 2011-08-16, smith jack wrote: > > > what is the advantage of Django over RoR:) > > This question is pretty much... I mean, you're not gonna get useful > answers. They're based on such different languages that I think any > comparison past that is likely going to be uninteresting to a programmer, > and I'm not sure any non-programmers are going to use either. > > I will say, the things I most value in Rails are pretty much contrary > to conventional Python design philosophy. Python's stress on explicit > over implicit is probably in contradiction with the Rails philosophy of > convention over configuration. > > So for instance, if all you want of a class that maps to a database table > in Rails is that it map the fields in the database, the class body is > empty because that's the default. If you want to tell it that the database > column foo_id represents the id of the foo object with which this record > is associated, and you want to call that .foo, you write: > belongs_to :foo > and the rest is all implicit. > > This is really handy sometimes, but it's not very Pythonic... > > Mostly, I think you'd probably be better off asking in a completely > different kind of forum, but even then, you're going to get mostly language > advocacy. > > -s > -- > Copyright 2011, all wrongs reversed. Peter Seebach / > usenet-nos...@seebs.nethttp://www.seebs.net/log/<-- lawsuits, religion, and > funny pictureshttp://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get > educated! > I am not speaking for my employer, although they do rent some of my opinions. Seebs answer is spot on. The advantages or disadvantages of both frameworks are subjective. It all comes down to each person's language of preference, since each framework reflects its language philosophy. -- http://mail.python.org/mailman/listinfo/python-list
Re: pairwise combination of two lists
This is the easiest and most pythonic way (IMHO): l3 = [i+e for i in li1 for e in li2] l3 ['a1', 'a2', 'b1', 'b2'] Regards, Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Please enlighten me about PyPy
Hmmm... I know it's complicated, and all these questions can make your head explode. I'll tell you what I understand about Pypy and, at the same time, I'll leave the door open for further explanations or corrections. As you know, python is a dynamic language. It means, amongst other things, that the programmer doesn't provide type information when declaring variables, like in statically typed languages. Its code doesn't get translated to machine code through a compiler, like in C. Instead, it is "interpreted" by the interprter, which finds out each variable type at run-time. This interpretation makes scripting languages like python much slower than traditional static languages. Recently, Python got a speed boost via Psyco, which is something like a proof of concept for a just-in-time compiler. It is a cpython extension and it can improve python's speed by analyzing run-time information and generating machine code on the fly. However, psyco can only analize python code and as you know, python relies on many extensions coded in c, for performance. So its author decided that having a python implementation written in python would laid a much better basis for implementing psyco-like techniques. This implementation requires a minimal core, writen in a restricted subset of python called "rpython". This subset avoids many of the most dynamic aspects of python, making it easier to authomatically translate it to C through a tool that uses top-notch type inference techniques. This translated version of the rpython interpreter (which got already auto-translated to c), is the basis of Pypy. On top of it, New Psyco-like and just-in-time techniques will be implemented for achieving maximum performance. However, I still doubt that I really understood it... I'm still not sure if the type inference techniques will be used to improve the performance of programs running on pypy, or if these techniques were only intended for getting the rpython interpreter translated to c. As far as I know, pypy is currently about 10/20 times slower than cpython, although many optimizations remain to be done. And I 'm not sure, but I think that its developers rely on the psyco-like techniques to achieve the big speed boost their looking for. Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Please enlighten me about PyPy
Well, first and foremost, when I said that I leave the door open for further explanations, I meant explanations by other people more knowlegeable than me :-) > Now I'm confused again--psyco translates Python into machine code--so > how does this tie in with the fact that the interpreter written in > Python is translated into another language (in this case C?) No, the psyco-like techniques come later, after the rpython interpreter is auto-translated to c. They are not used to translate the interpreter to c (this is done through a tool that uses type inference, flow-graph anailisis, etc, etc). Getting the rpython auto-translated to C is the first goal of the project (already achieved). That means having a minimal core, writen in a low level language (c for speed) that hasn't been writen by hand, but auto-translated to c from the python source -> much easier to improve and maintain from now on. Think about this: improving and maintaining a hand coded c implementation like cpython is a nightmare. The more complex the code, the more dificult is its improvement and experimentation. Now, they have it all written in python (rpython) instead, which is easier, nicer and more flexible. And this python code can get authomatically translated to C (no hand coding, this is done by the tool I mentioned above). Now this is both, a conclusion and a question (because I also have many doubts about it :-): At this moment, the traslated python-in-python version is, or intends to be, something more or less equivalenet to Cpython in terms of performance. Because it is in essence almost the same thing: another C python implementation. The only difference is that while Cpython was written by hand, pypy was writen in python and auto-translated to C. What remains to be done now is implementing the psyco-like techniques for improving speed (amongst many other things, like stackless, etc). Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Guido at Google
> Java => Sun > .Net => Microsoft > C# => Microsoft > Linux => too many big name IT companies to mention > Python => ? I know at least one company responsible for a linux distro (Cannonical - Ubuntu), which encourages and even pays programmers for developing applications in Python. His founder, Mark Shuttleworth, is a python fan. -- http://mail.python.org/mailman/listinfo/python-list
Re: Please enlighten me about PyPy
Thanks Carl for your explanation! I just have one doubt regarding the way Pypy is supposed to work when its finished: We know that for translating the rpython interpreter to C, the pypy team developed a tool that relies heavily on static type inference. My question is: Will this type inference also work when running programs on pypy? Is type inference a way to speed up running programs on pypy, or it was just a means to translate the Rpython interpreter to C? In other words: Will type inference work on running programs to speed them up, or this task is only carried out by psyco-like techniques? -- http://mail.python.org/mailman/listinfo/python-list
Re: Please enlighten me about PyPy
Carl Friedrich Bolz wrote: > The static type inference is just a means. It will not be used for the > speeding up of running programs. The problem with the current type > inference is that it is really very static and most python programs are > not static enough for it. > > Therefore we will rather use techniques that are similar to Psyco (note > that our JIT work is still in the early beginnings and that my comments > reflect only what we currently think might work :-) ). The idea is that > the JIT looks at the running code and assumes some things it finds there > to be constant (like the type of a variable), inserts a check that this > still holds, and then optimizes the code under this assumption. Thanks! I think I completely understand the whole thing now :-) Anyway, I guess it's just a matter of time untill we can use this translation tool to translate other programs, provided they are written in restricted python, right? So we will have two choices: 1) running normal python programs on Pypy. 2) translating rpython programs to C and compiling them to stand-alone executables. Is that correct? -- http://mail.python.org/mailman/listinfo/python-list
Re: Please enlighten me about PyPy
> Anyway, I guess it's just a matter of time untill we can use this > translation tool to translate other programs, provided they are written > in restricted python, right? > So we will have two choices: > 1) running normal python programs on Pypy. > 2) translating rpython programs to C and compiling them to stand-alone > executables. > > Is that correct? Oh, forget this question... You already made this clear in another post in this thread... Thanks! Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Please enlighten me about PyPy
Carl Friedrich Bolz wrote: > Actually, one of our current rather wild ideas (which might not be > followed) is to be able to even use RPython to write extension modules > for CPython. I don't think this is a wild idea. In fact, it is absolutely reasonable. I'm sure that creating this translation tool was a titanic task, and now that you have it why not using it? This is a treasure that opens up many possibilities... Even if Pypy ends up being not as fast as intended (I hope not!), the fact that you guys created this translation tool was well worth the effort. Thanks again for your explanations and keep up the good work! Cheers, Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Please enlighten me about PyPy
> Thanks for clearing up some of my confusion with PyPy, Luis! Hey, I'm glad you brought up this topic! This thread really helped me to understand some dark corners of this exciting project. I also want to thank Carl and all the other Pypy developers for their outstanding work! I've been quietly following the evolution of Pypy through its mailing list, and I eagerly wait for every new announcement they make, but I never dared to ask any question fearing that I would look like a fool amongst these rocket scientist... Cheers, Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Guido at Google
[EMAIL PROTECTED] wrote: > JB wrote: > > > long life to Guido & Goole ! many things to come ;) > > Google is merely the new Microsoft and surely just as unethical > at its core. > > And your spelling Goole is probably closer to the mark, > since it is merely the next ghoulish big company, > come to restrict our freedoms and blot out the sky. I beg to disagree. Google is what it is because it creates good and useful products which everybody enjoy for free. For doing this, they hire the best guns and, guess what? These talented people have to eat, like you and me. Do you expect them to work for free? Every company needs to make money, otherwise they would die. But there are many ways to make it, and I think they are as good and ethical as they can be. -- http://mail.python.org/mailman/listinfo/python-list
Re: Guido at Google
rbt wrote: > Go right ahead. Perhaps we should do one for Perl too: > > It's like having King Kong as your very own personal body guard ;) Good analogy: You know, they call Perl the "eight-hundred-pound gorilla" of scripting languages. Although most of the time, it would be a a very unsuitable body guard (can't get into a car, into a plane, go to a party, etc..). OTHOH James Bond is always perfect. He would sleep with your wife though... -- http://mail.python.org/mailman/listinfo/python-list
Re: Please enlighten me about PyPy
Christian Tismer wrote: > Christian Tismer wrote: > > > This is not trying to split apart from PyPy, or to short-cut its > > goals. I'm completely with PyPy's goals, and it will do much > > more than RPython translation ever will, this is out of question. Hi Christian, I'd like to know, in your opinion, how far is the goal of making pypy complete and fast? Regarding the current state of the project, are you confident that the goals will be met, or you still have doubts? (The same questions go for the RPython translator project as stand-alone tool)... Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: some suggestions about GUI toolkits?
This question comes up in this mailing list every two or three days... I suggest taking some time to read previous threads (use Google Groups for en easier experience) and you'll find thousands of opinions and suggestions. My advice: check PythonCard http://pythoncard.sourceforge.net/ Good luck! Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: - E04 - Leadership! Google, Guido van Rossum, PSF
Anton Vredegoor wrote: > Google's not a nice company (yeah, I know I'm posting from a google > account). If you look at their job requirements it's clear they will > only hire people with long backstabbing histories. There seems to be no > room left for world improving undamaged souls in that company. > > > (Especially if he uses PyPy to experiment and play in ... :) > > Yes PyPy could save Python, or destroy the world. I have the impression > not many enough people realize that a selfhosting programming language > is something on the same level as a nano assembler or an artificial > intelligence. There is not much time anymore for idealists to start > trying to save the world, and I don't think we can count on google in > that respect. Huh? -- http://mail.python.org/mailman/listinfo/python-list
Guido working on Pypy?
This article is in Dutch: http://www.computable.nl/nieuws.htm?id=1039941&WT.mc_id=rss According to this blog entry, it says that Guido has been hired by Google to work on Pypy: http://zephyrfalcon.org/weblog2/arch_e10_00870.html Is there anyone who can confirm this information? Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Sort dictionary
This function return a tuple of value-key pairs, sorted by value: >>> x = {'a':3, 'b':2, 'c':4} >>> def sortByValue(myDict): return sorted( [(v,k) for k,v in myDict.items()] ) If you want to get the first two value-key pairs: >>> sortByValue(x)[:2] [(2, 'b'), (3, 'a')] Hope this helps... Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Sort dictionary
This function returns a tuple of value-key pairs, sorted by value: >>> x = {'a':3, 'b':2, 'c':4} >>> def sortByValue(myDict): return sorted( [(v,k) for k,v in myDict.items()] ) If you want to get the first two value-key pairs: >>> sortByValue(x)[:2] [(2, 'b'), (3, 'a')] Hope this helps... Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Sort dictionary
You can't get a dictionary ordered by values, but you can get a list of key-value pairs ordered by value: def sortByValue(myDict): x = sorted( [(v,k) for k,v in myDict.items()] ) return [(k,v) for v,k in x] For getting only the first two pairs: sortByValue(x)[:2] Hope this helps... Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Microsoft IronPython?
Ironpython has been in development from awhile, and now it's in beta version 1.0. Is it good to have Python running on every existing platform out there? Of course it is. Is it good to have Python running on Java and .NET? Sure, why not? One of the good things about Python is that it runs everywhere, thus making your code more portable and usable. Many people program for a living and often they are forced to work with certain technologies that are beyond their preference. If your company uses Microsoft software, wouldn't you like being able to run Python on it? Personally, I'd like to see Python going everywhere. I want it to be ubiquitous. This way there will be no excusses for rejecting it (by your bos, your company, your colleagues..). Will Microsoft hurt Python? How? If sometime in the future, MS decides to modify the language by creating something different, you'll have the choice to decide whether you like it or not. Nobody will steal Python, it is free and it will always be. What's more, if you decide that you want to use Python on .Net and you don't ike the official Microsoft release, you can fork it (the code is freely available) and you can call it "MyGroovyNewLanguage" if you want. Right now there are other languages based and inspired in Python (Boo for example) that run on .Net and Mono, and they are useful and have an enthusiast comunity behind them. It's good to have many choices and it's good to be free to choose. Although it's also very good to have a main implementation, lead by its creator, who will always take care that there will be a pure and legitimate Python for those who like it just the way it is. Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Microsoft IronPython?
> IronPython as it is now is already slightly different from CPython > isn't it? Because it has to capture features of CLR languages that are > not in Python (such as using generic containers). Hmm... I'm not sure what you mean by "capture features of CLR". I think Ironpython is a faithful implementation of python but, of course, it's aimed at allowing programmers to take advantage of the framework, it's classes and components. If not, there would be no reason to port Python to .Net. Don't you think? -- http://mail.python.org/mailman/listinfo/python-list
Re: Microsoft IronPython?
> Oh, yeah, that's undoubtedly true. What I was referring to were things > such as using [] for generic, that doesn't exist in current CPython > does it? I'm not en expert on the subject, but I guess that any language implementation running on .Net should be able to at least "understand" generics or any other feature available on this framework, because languages are supposed to interact and use all kinds of classes and assemblies regardless of the language they were written in. As for using generics, I think this is not very important in python, I guess, because it is dyamic and you don't declare types. So writing x =List[str](), for example, doesn't buy you anything. You're better off using a regular list: x = []. Someone more knowledgeable please kindly correct me... Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Quickest way to make py script Web accessible
Karrigell lets you run pure python scripts, although not directly in Apache. It uses its own server running behind apache. You can code in 4 styles: -pure python scripts -python in html (like in PHP) -html in python -karrigell services (mapping functions to urls) http://karrigell.sf.net Hope this helps... Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Microsoft IronPython?
Ray wrote: > But then again, once you start using .NET class you're tied to .NET > anyway so this is not a big problem, I think--although the more > perfectionist among us might like to isolate parts of Python code that > are .NET/IP specific to make porting easier if it ever comes to that... That's exactly what they did with version 1.0. For example, if you wanted to turn a string into uppercase, in previous versions you could have done: 'hello'.upper() or 'hello'.ToUpper() That means, the python way and the .NET way. But now if you want to do it the .NET way, you have to add the statement "import clr" before. So I guess you can isolate your coding to standard python if you want or go forward and use all the CLR capabilities. -- http://mail.python.org/mailman/listinfo/python-list
Re: Microsoft IronPython?
EP wrote: > - create a more prevalent version of "Python" that is less Pythonic or > undermines some of the principles of the language, basically usurping > Python as we conceive it in the process... I understand all the concerns, the evil empire and all that.. But I think nothing of this will happend. Nobody said anything when Jim Hugunin created Jython (python for java). What about Sun? Isn't it a big corporation? Is Java Open source? The result of Jython is that it made python a little bit more popular, because it's cool to leverage your skills while still "doing Java". The same will happen with Ironpython. Many people needs to work with .NET, because their companies use this technology or because their customers want it, and because the market needs .NET developers.So if you are in this situation, wouldn't you like to use Python, while still doing .NET? Besides, MS goal is not controlling python (or killing it). What they want is making the CLR (.NET) an attactive and succesful framework, and they plan to do this by supporting as many languages as possible. They are also planning to help other developes port their languages to .Net and they want it to be a good runtime for runing dynamic languages. MS product is not Ironpython (or C# or VB). It's product is the CLR, the .NET framework. They don't care who creates or develops a language, as long as it runs on the CLR. And if the CLR turns out to be good and succesful, I want Python to run on it. What's more, I got the feeling that MS understood that they have to win the programmers hearts in order to attract them, and they won't do this by "stealing" what they love most. The key of their success is in attracting programmers to their field, not to C# or to VB.Net, but to the CLR. Don't you think? Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Microsoft IronPython?
I think that this posted message in Jim Hugunin's weblog clearly shows what are Microsoft intentions regarding Python and other dynamic languages: http://blogs.msdn.com/hugunin/archive/2006/01/05/509812.aspx We're hiring full-time and summer interns! We're looking for a few exceptionally talented individuals with dynamic language experience (Python, Ruby, PHP, JavaScript, etc.) to come join our efforts to make the Common Language Runtime (CLR) the world's best platform for dynamic languages and dynamic scenarios. The CLR already has a lot of dynamic support with reflection, runtime code generation, and cross-language interaction. IronPython has shown that the CLR can be a great platform for building dynamic languages. We want you to help us take this support to the next level. We have one developer (not yet posted), one program manager, one tester and at least one summer intern positions available. If you're interested, please send me email ([EMAIL PROTECTED]) that clearly explains why you'd be the best choice for one of these jobs and attach a current resume. posted on Thursday, January 05, 2006 1:11 PM by hugunin -- http://mail.python.org/mailman/listinfo/python-list
Re: free python hosting !
John Salerno wrote: > Luis M. González wrote: > > > I'm curious, why it didn't work? > > I sent them an email recently, asking about mod_python support, and > > they replied afirmatively, and very quickly. They also said that they > > can install other scripts on demand. > > But I never tried them though... > > I'd like to know more about your experience with this hosting, if > > possible. > > Their support was always great, and they tried several things to get it > to work, but I soon got the feeling that although they "support" > mod_python, they didn't really have it set up correctly. They tried > different variations of setting up the proper handlers, but nothing ever > worked for me, whereas other places I've tried with mod_python, it > simply works when you go to a .psp page, for example. > > Perhaps by now they've fixed it. It is certainly cheap enough to give a > shot, and they allow you a few months in which you can cancel and get a > refund. I see. Perhaps the solution to these problems is configuring your handlers as .htaccess in your web folders. This way, you don't need to ask your hosting provider to fiddle with Apache configurations in order to suit your needs. I know by working on my own computer that these configurations are very tricky... -- http://mail.python.org/mailman/listinfo/python-list
Re: free python hosting !
John Salerno wrote: > Luis M. González wrote: > > John Salerno wrote: > >> Luis M. González wrote: > >> > >>> I'm curious, why it didn't work? > >>> I sent them an email recently, asking about mod_python support, and > >>> they replied afirmatively, and very quickly. They also said that they > >>> can install other scripts on demand. > >>> But I never tried them though... > >>> I'd like to know more about your experience with this hosting, if > >>> possible. > >> Their support was always great, and they tried several things to get it > >> to work, but I soon got the feeling that although they "support" > >> mod_python, they didn't really have it set up correctly. They tried > >> different variations of setting up the proper handlers, but nothing ever > >> worked for me, whereas other places I've tried with mod_python, it > >> simply works when you go to a .psp page, for example. > >> > >> Perhaps by now they've fixed it. It is certainly cheap enough to give a > >> shot, and they allow you a few months in which you can cancel and get a > >> refund. > > > > I see. > > Perhaps the solution to these problems is configuring your handlers as > > .htaccess in your web folders. This way, you don't need to ask your > > hosting provider to fiddle with Apache configurations in order to suit > > your needs. > > I know by working on my own computer that these configurations are very > > tricky... > > > > I tried that too, but I just think that something wasn't right on their > end. Some days I would see certain configurations, and then the next day > it was gone and then later back again. It was obvious they were changing > things and adding extra support, but it just never worked for me. > > But I do encourage you to try it. You're probably more knowledgeable > than I am on the subject anyway, and at the least you can get a refund. Thanks for your comments! I'll take this hosting service into account for my future website... Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Using Python for my web site
I don't have experience with Django or any other python framework, but I have used bare-bones mod_python and it rocks. I wouldn't use PSP though... It is not very polished, and they way it handles the "indentation problem" in python is a little bit confussing. IMHO the best way of using mod_python is with its publisher handler. It let's you code your applications in a MVC (model view controller) style. This way you can cleanly separate presentation and logic, making your code more concise, clear and mantainable. With publisher, every function defined in your script represents a web page in your site, and the html code can be moved to a template, that could be PSP itself or Cheetah, for example (Cheetah is very good). A very simple example: #mysite.py def index(req): req.content_type = 'text/html' req.write(""" """) def printMyName(req, myname): req.content_type = 'text/html' req.write(myname) # end of mysite.py In this script, the function "index" is executed by default when you go to http://yourserver/mysite.py, and it displays a text box and a submit button. (The first line indicates that the output will be in html format, and "req.write" is equivalent to "print".) If you enter your name and hit the submit button, your name is passed to the "printMyName" function and printed in your browser's screen. This way, both functions can be viewed like two separate pages within your site. So, with only one script, you can write a whole site if you want. For more complex pages where html is used, you can place this presentation code in templates, and then import them into your main script. Or else, you could simple use "req.write" to print your html directly (as I did in "index"). Hope this helps... Luis northband wrote: > Hi, I am interested in re-writing my website in Python vs PHP but have > a few questions. Here are my specs, please advise as to which > configuration would be best: > > 1.Dell Poweredge Server, w/IIS, currently Windows but considering > FreeBSD > 2. Site consists of result pages for auctions and items for sale (100 > per page) > 3. MySQL (Dell Poweredge w/AMD) database server connected to my web > server > 4. Traffic, 30 million page loads/month > > I am trying to have the fastest page loads, averaging 100 items per > result page. I have read about using Apache's mod_python so I could > use PSP. Any help or tips are appreciated. > > -Adam -- http://mail.python.org/mailman/listinfo/python-list
Re: Using Python for my web site
Cliff Wells wrote: > On Mon, 2006-07-31 at 22:25 -0700, Luis M. González wrote: > > I don't have experience with Django or any other python framework, but > > I have used bare-bones mod_python and it rocks. > > I wouldn't use PSP though... > > It is not very polished, and they way it handles the "indentation > > problem" in python is a little bit confussing. > > > > IMHO the best way of using mod_python is with its publisher handler. > > It let's you code your applications in a MVC (model view controller) > > style. > > While I agree (or at least consider the point moot) that this is > possibly the best way to use plain mod_python, I'd disagree that it's a > good way to develop modern web applications in Python. By the time > you've decided on every bit of framework to use, and made all the little > decisions that go into turning a fresh, clean spot on your hard drive > into an application, what you've done is reinvent TurboGears rather than > develop your application. Worse, you've probably reinvented it poorly. > I've done so many times and am well aware of what a time-waster it is. > > You say that you haven't tried Django or any other Python framework. > Perhaps you should. You seem to have at least the start of the right > idea about web application organization, so I think you'd be pleasantly > surprised with what you'll find already done for you by the major Python > frameworks and how much time you'll stop wasting on code that isn't part > of your application. > > Regards, > Cliff Well... yes, you're right. I guess that the reason for not having used a framework already is laziness... I have experience with Karrigell, which rocks too, but it lacks some deployment options (no mod_python, no fastcgi, etc). And as far as I could see in the Django docs, I should learn many new things to do exactly the same, such as yet another templating language or how to map urls with regular expressions (I still couldn't wrap my head around regex... I find them very boring to learn...). But you are absolutely right. I should definetely try Django sometime. I guess I'll do it when I have a real need to do some serious web stuff. As for TurboGears, I'm not very impressed... This is a pile of different components picked by someone according to his liking, very well glued together. Althouh its quality may be good, why should I stick with a number of components chosen according the criteria of some other guy? For example, why kid instead of Cheetah? Why CherryPy? Really, it isn't that hard to install cheetah and, if you want an object relational mapper, sqlobject. Once you have them, using raw mod_python is just a pleasure. I feel I'm in front of a white clean canvas and I just start coding. I like the flexibility of being able to choose each part of "my own framework". I even created a small script that does the automatic crud stuff for me (not as polished as Django for sure, but it works like a charm). Anyway, there's still an issue with using these frameworks: Availability. It's very hard, if not impossible, to find a decent web host at an affordable price. Although I guess many of those who use Django, for example, run their own host. Being able to use raw mod_python gives you an advantage here. Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Programming newbie coming from Ruby: a few Python questions
Delaney, Timothy (Tim) wrote: > Edmond Dantes wrote: > > > Of course, it's all what you really mean by "clever". To me, being > > "clever" partly means writing code without bugs in the first place, > > so there is nothing that needs debugging > > "Clever" in this context generally means using a trick/hack that is > non-obvious (often even after you understand it). "Cleverness" often > leads to difficult-to-understand code, which is contrary to the "python > philosophy". > > There are occasionally times when cleverness is useful, but in those > cases it should always be commented explaining exactly what it is doing, > and why a non-clever solution was not used. Most of the time there's > still a better non-clever way to do it, but the coder is not clever > enough to find it ;) > > Tim Delaney Is this kind of cleverness what is usually known as "magic"? I suspect that this has something to do with it, but not completely sure... Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Programming newbie coming from Ruby: a few Python questions
BartlebyScrivener wrote: > [EMAIL PROTECTED] wrote: > > >> The Ruby crowd says you guys are no where > >> near as friendly as them! > > Slander! Defamation! The time to crush our enemies has come. This is the Jihad! Death to the infidels -- http://mail.python.org/mailman/listinfo/python-list
Re: looking for a simple way to load a program from another python program..
Try this: import os os.startfile('cabel.py') This should work with any program or file, not only python ones. Hope this helps, Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: programming with Python 3000 in mind
[EMAIL PROTECTED] ha escrito: > At http://www-03.ibm.com/developerworks/blogs/page/davidmertz David > Mertz writes > > "Presumably with 2.7 (and later 2.x versions), there will be a means of > warning developers of constructs that are likely to cause porting > issues [to Python 3000]. In the simplest case, this will include > deprecated functions and syntax constructs. But presumably the warnings > may cover "potential problems" like the above example." > > The current beta version of Python is 2.5 . How can a Python programmer > minimize the number of changes that will be needed to run his code in > Python 3000? In general, he should know what is being removed from > Python 3000 and if possible use the "modern" analogs in Python. A > manager of Python programmers might want external evidence of > portability, though (such as an absence of interpreter warnings). > > Some basic syntax such as > > print "hello world" > > is going away to make print look like a function. IMO, fixing what is > not broken because of the aesthetic tastes of the BDFL is a bad idea. > His reasoning is at > http://mail.python.org/pipermail/python-dev/2005-September/056154.html > . Check this out: http://video.google.com/videoplay?docid=-6459339159268485356 Additionaly, you can make a simple Google search: "guido python 3000" There is quite a lot of information. Hope this helps... LUIS -- http://mail.python.org/mailman/listinfo/python-list
Re: How to get database metadata information (i.e. existing tables and columns in tables)
If you want to know the names of the fields on a recordset, you can use cursor.description. For example, lets say you have a connection to a MySQL database: con = MySQLdb.connect('localhost','root','','mydb') cur = con.cursor() cur.execute('select * from customers') result = cur.fetchall() fields = [i[0] for i in cur.description] ... Description gives a list with information about your recordset, being the first item the name of the field. Hope this helps... Luis Chris Brat wrote: > Hi, > > Is it possible to retrieve details about the database, specifically a > list of the tables in the database; and then to retrieve the columns > and their types for the tables? > > Is this dependant on the database? > > Thanks > Chris -- http://mail.python.org/mailman/listinfo/python-list
Re: Learning Python
kaushal wrote: > Hi > > How do i start Learning Python,is there any reference material which I > can refer since I dont have > any programming experience > > Thanks and Regards > > Kaushal If you have no programming experience at all, I highly recomend "Non Programmers Tutorial for Python" by Josh Cogliati: http://www.honors.montana.edu/~jjc/easytut/easytut/easytut.html This is how I got my feet wet with Python, and it's very easy to follow. I also recomend "A Byte of Python" by Swaroop: http://swaroopch.info/text/Byte_of_Python:Main_Page Both ebooks are available in multiple formats and are free. God luck! Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Python v PHP: fair comparison?
> - Python is more readable, and more general purpose Yes, php is only for web. On the other hand, Python is a general purpose language and it can be used for nearly anything you may want to do. > - PHP has awful backward compatibility Yes. And it's also an ugly language to work with. > - PHP has a lower barrier to entry I don't think it is any easier than python. Not even to begin with. > - Most inexpensive web-hosters support PHP, but not Python Sad but true. > - PHP has far more pre-writen scripts available For web projects, perhaps. But I'm sure you can do everything better with python, especially with the new crop of web frameworks (Django, Turbo Gears, etc...). > - Newer versions of mod_python require Apache 2.0, which few hosters > have You can also get alder versions of mod_python. What's the problem? > - There is more demand for PHP developers, than Python developers So you want to be a web developer? Then look no further. Learn python and go kick php developers asses in the market place. There are thousands of php developers out there. Do you want to be just one more? I'd rather learn something newer, and much more powerful. And once you get a job, you will do everything better and faster than the others, your quality will stand up from the rest and so your reputation. Then there will be more demand for "your skills". -- http://mail.python.org/mailman/listinfo/python-list
Re: Python v PHP: fair comparison?
>> Yes, php is only for web. > > Absolutely false. Most of my standalone, command-line scripts for > manipulating my unix users in LDAP are written in PHP, although we're > rewriting them in python. > > Although I can't think of a single app written in php that's not web- > based (other than standalone scripts I have written), there are up-to- > date php bindings for GTK: http://gtk.php.net/ > > Michael Fair enough, this has been possible due to the enormous popularity of php. You can also hit a nail with your shoe instead of using a hammer, and if you try hard you may even succeed. You can also digg a a grave with a spoon instead of a shovel, and after a couple of days you'll be finished. You may be able to use php to create a stand alone app, but php was created with the solely purpose of being a tool for creating dynamic web sites. And you have to admit that using php for a non-web app is like trying to fit a a square into a round hole. Php is no more than a simplified C-ish language, dynamically typed with a lot of functions aimed at web tasks. Without these built-in functions, there's little you can do with it in your web apps. On the otehr hand, you don't need a thousand built-in functions in python for achieving every single task on a web site. You just write them, often with just a couple of lines, because the language is that flexible an consice. You don't have to remember each and every function for every task, this is ridiculuous. I think that even as a general purpose language, python is still much more adecuate, fast, fun and flexible than php for building web apps. Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Python v PHP: fair comparison?
walterbyrd ha escrito: > Luis M. González wrote: > > the new crop of web frameworks (Django, Turbo Gears, etc...). > > > > > - Newer versions of mod_python require Apache 2.0, which few hosters > > > have > > > > You can also get alder versions of mod_python. What's the problem? > > The problem is that the system requirements for django and turbogears > are sky-high. I think Django requires Apache 2.0 (and maybe mod_python > 3.x), and CherryPy (part of turbogears) requires Python 2.4. If you are > developing for a hosted environment, this can be a big problem. Few > enough hosters provide python to begin with, then add to that such > requirements as apache 2.0 - and you left with almost nothing. You are right. Although this is not a problem to me, because I just use bare-bones mod_python, with no framework on top of it. Not many people know that mod_python comes with its own built-in handlers suitable for different programming styles, such as PSP (similar to php) or publisher (M-V-C style). Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Python v PHP: fair comparison?
Cameron Laird ha escrito: > In article <[EMAIL PROTECTED]>, > Luis M. González <[EMAIL PROTECTED]> wrote: > . > . > . > >Then look no further. Learn python and go kick php developers asses in > >the market place. > >There are thousands of php developers out there. Do you want to be just > >one more? > >I'd rather learn something newer, and much more powerful. > . > [more Python > cheerleading] > . > . > Perhaps it's timely to clarify the "newer" above: Guido > made Python public in '89-90, and Rasmus showed PHP to > others in '94-95. OK. But since when has python been considered a viable alternative for web development? As a generalp purpose language, it's older. But as a web development language, it's olnly when people started to look for the "rails killer" and many python alternatives started to come up (although Django has been in development for a long time before all this hype). I remember well, just a few months ago, there were many alternatives (remember "subway"?). -- http://mail.python.org/mailman/listinfo/python-list
Re: Python v PHP: fair comparison?
Fredrik Lundh ha escrito: > Luis M. González wrote: > > > But as a web development language, it's olnly when people started to > > look for the "rails killer" and many python alternatives started to > > come up (although Django has been in development for a long time before > > all this hype). > > nah, people have built web stuff on Python for as long as we've had a web. > > I know, but would you consider a python cgi application a good competence against php? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python v PHP: fair comparison?
[EMAIL PROTECTED] ha escrito: > Luis M. González wrote: > > Cameron Laird ha escrito: > > > Perhaps it's timely to clarify the "newer" above: Guido > > > made Python public in '89-90, and Rasmus showed PHP to > > > others in '94-95. > > > > OK. But since when has python been considered a viable alternative for > > web development? > > As a generalp purpose language, it's older. > > But as a web development language, it's olnly when people started to > > look for the "rails killer" and many python alternatives started to > > come up (although Django has been in development for a long time before > > all this hype). > > Huh? I've been doing paid python web work since 2000. I'm fairly sure > that Yahoo! groups predates that by a while, and I know that > mod_python/httpdapy goes back at least to 1998 (and Python CGI predates > that significantly). Do not forget the subject of this thread. Nobody is criticizing python here. I am a "believer"! We are talking about important details that matter when choosing a language, and specially when choosing one for web development. I'm sure Yahoo, Google and other companies can afford having knowledgeable people, hardware and resources to use python they way they like. The problem is (or was) for mere mortals trying to create a web site on shared hostings. We all know that mod_python has its issues, and still is not a common or affordable feature in the vast mayority of web hosts. And prior to that, you only had cgi or other rather unknown solutions. mod_php had a clear advantage here. Perhaps not as a language but as an ubiquitous and cheap alternative. In the last months (and I said "months" not years) the situation improved a lot, but still it is a fair to make a comparison. My opinion is that python, as a language, is by far a much better alternative for any use. But php, as a platform, still has a many advantages, being availability the main one. Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Very good Python Book. Free download : Beginning Python: From Novice to Professional
I didn't know it wasn't a free ebook. I realized it once I downloaded it. But it's such a good book that I decided to buy a hard copy. This way I will support its author, while getting a very good book on Python. Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: DB-API: how can I find the column names in a cursor?
I don't know if it works this way with Oracle, but the python dbpai has the cursor.description method that can help. For example: cur.execute( "your query here" ) columns = [i[0] for i in cur.description] cur.description gives a lot of data about your recordset, and the first field is the column name. Hope this helps... Luis A.M wrote: > Hi > > > > I use a code similar to this to retrieve data from Oracle database: > > > > import cx_Oracle > > > > con = cx_Oracle.connect("me/[EMAIL PROTECTED]") > > cur = con.cursor() > > outcur = con.cursor() > > cur.execute(""" > > BEGIN > > MyPkg.MyProc(:cur); > > END;""", cur=outcur) > > > > for row in out_cur: > > print row > > > > > > The problem is I don't know how to find out what are the column name and > type that comes out of query (each row in cursor). > > > > Is there any possibility that my Python code can find out the column name > and type in each row in cursor? > > > > The other problem is accessing data in each row by column name. In Ruby I > can say: > > > > Print row["ColName"] > > > > In Python; however, I must access to row contents by integer index, like > PRINT ROW[0], which reduces my program's readability. > > > > Can I access to row's contents by column name? > > > > Any help would be appreciated, > > Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: C# equivalent to range()
Erik Max Francis wrote: > Yeah, what jerks. They actually wanted to talk about Python, not some > random other language that you're trying to learn that has nothing to do > with it ... There are thousands of threads to choose from in this forum. If they didn't like this question, they could have picked any other one to discuss. There's no need to be disagreeable :-) Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Are there something like "Effective Python"?
Mike Meng wrote: > Hi all, > I just finished reading Learning Python 3rd ed, and am doing my > first Python application, which retrieves and process text and XML > documents from Web. Python helped me to write the application in a few > hours, I'm very happy with its productivity. But the performance is not > satisfactory. I decide to optimized it in Python before trying C/C++ > extensions. But I don't know Python much and have no clu to tune my > program. Also, I don't know what Pythonist's preferred styles. Are > there any books/documents which play the similar role for Python as > 'Effective C++' does for C++? > > For example, one of my friends read my program and suggest me to > move the re.compile() out of a for-loop, since the regular pattern is > fixed, and re.compile() is slow. I want to find more such advice, where > can I find them? > > Thank you. > > Mike http://wiki.python.org/moin/PythonSpeed/PerformanceTips Also, I suggest checking Psyco ( http://psyco.sourceforge.net/ ), which can easily improve your program's speed with no change in your code. Hope this helps... Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: C# equivalent to range()
Fuzzyman wrote: > FWIW I agree. If anyone didn't want to answer the question they didn't > need to. > > Why be rude to someone asking a polite question. It's not as if there > isn't much more *worse* noise on this group. I also agree. Although the question may have appeared out of place, it wasn't totally. The poster asked the question very politely, apologizing in advance for what may be consider an off-topyc question. He also said he only knew python, and he probably wasn't able to explain the intended behaviour he wanted in C# without refering to Python. He is also very right when he says that those who were not interested in the question could have simply ignored it. In exchange, he got a couple of slighty rude replies and an ironic comment. What reaction do you expect from him? -- http://mail.python.org/mailman/listinfo/python-list
Re: Combining The Best Of Python, Ruby, & Java??????
[EMAIL PROTECTED] wrote: > Scala seems terse and fast enough, few examples: > > http://shootout.alioth.debian.org/gp4sandbox/benchmark.php?test=all&lang=psyco&lang2=scala > > Bye, > bearophile Static typing, type inference, "sequence comprehensions"... Looks that there's a new crop of programming languages on top of the main .NET and JAVA with these characteristics. This one seems to be following the trend initiated by Nemerle and Boo. The good thing about these languages is that they offer the performance of static languages, with the feel of dynamic ones. Thanks to their local type inference, you don't have to declare types or return types so often, and with generics, type castings are also reduced to a minimum. Anyway, I think that from a python programmer perspective, those looking for a static language for .NET or Mono would find Boo more appealing. For example, I use it for writing extenssions for Ironpython when I need more performance. -- http://mail.python.org/mailman/listinfo/python-list
Re: Very nice python IDE (windows only)
[EMAIL PROTECTED] wrote: > I happen to have delphi, so if someone wants me to make small changes, > just let me know, I'll try to help Hmm... now that you offer, would it be possible to have the colors of text just like in IDLE? I tried configuring the colors, but some of them don't exist as options in this IDE (for example "orange"). I like how text looks in IDLE, with orange for reserved words, green for strings, etc... -- http://mail.python.org/mailman/listinfo/python-list
Re: Very nice python IDE (windows only)
Jonathan Ellis wrote: > ago wrote: > > I have just discovered Python Scripter by Kiriakos Vlahos and it was a > > pleasant surprise. I thought that it deserved to be signalled. It is > > slim and fairly fast, with embedded graphical debugger, class browser, > > file browser... If you are into graphical IDEs you are probably going > > to enjoy it. Windows only unfortunately. > > > > http://mmm-experts.com/Products.aspx?ProductId=4 > > Not to rain on anyone's parade, but I'd recommend using an IDE that > isn't based on an obviously dead-end platform. (PyScripter is written > in Delphi.) > > -Jonathan As long as people keep on using win32, it will be just fine. After that, who knows what would be the best option? Delphi.Net perhaps? -- http://mail.python.org/mailman/listinfo/python-list
Re: Very nice python IDE (windows only)
Jan Bijsterbosch wrote: > Hello Luis, > > "Luis M. González" <[EMAIL PROTECTED]> schreef in bericht > news:[EMAIL PROTECTED] > > > > [EMAIL PROTECTED] wrote: > >> I happen to have delphi, so if someone wants me to make small changes, > >> just let me know, I'll try to help > > > > Hmm... now that you offer, would it be possible to have the colors of > > text just like in IDLE? > > I tried configuring the colors, but some of them don't exist as options > > in this IDE (for example "orange"). > > Hmm, it's a little bit hidden, but if you go to Options / Editor / Syntax > Colors and be sure to select Python language as editor syntax then select > 'reserved words' and after that from the color dropdown box select Custom... > (the topmost option) a color dialog pops up and you can select any color You > want...;-)) > > > I like how text looks in IDLE, with orange for reserved words, green > > for strings, etc... > > With the above, no problem at all...;-)) > > Greetings from sunny Amsterdam, > > Jan Thank you! You're right, the custom option is a litle bit hiddenm but now I customized it just as I wanted. Great IDE! I love it... Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Combining The Best Of Python, Ruby, & Java??????
Diez B. Roggisch wrote: > > But semantically it is a proper functional language. The features may > > not attract Python users who might prefer Boo/Jython/IronPython. But it > > does offer something to disillusioned Groovy users. > > Are they disillusioned? Just wondering. > > Diez Whay talking about disillutioned programmers? These are tools, not religions... I love python, and I like it more everyday. And with the advent of Pypy, its future looks brighter than ever. But I also find very interesting these new options that are coming up. Although I'm not a professional programmer (not even a serious aficionado), I love to be able to translate my python skills very easily to .NET through Boo, for example. I even find it more appealing than Ironpython, because it was created from the ground up to take advantage of the CLR. On the other hand, porting pure python to .NET is in many aspects like trying to fit a square on a circle (I don't know if this sentence makes sense in english...). Because many of the design choices taken by GvR back in the early nineties were surely conditioned by the platform he chose to write python, which is the c language. The good thing is that python is having a lot of influence in these new languages. As far as I could see, even C# 3.0 is showing up some pythonic traits. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python is fun (useless social thread) ;-)
Thomas Guettler wrote: > There are some things in Python I don't know very well: Decorators and > generators. But somehow I don't think that I really need them. I think that I learn best when I have a problem and I'm trying to solve it. There are features that you don't know what they're for, and you never use it, but when you come across an scenario where none of the features you know can help you, you start wondering "there must be something else..." and a quick search in google, or a python recipe, will give you the solution and a sample usage of these features. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python is fun (useless social thread) ;-)
BartlebyScrivener wrote: > >> I'd like something a bit like a module, > >> but I'd like to make several of them, > >> and not have them interfere with each other." > > Thank you. I sense what you are saying, but at this point I'd be > thinking, "Why not just make several modules?" :) I'll get to it. I've > got my hands full just learning everything else. > > rd To grasp the basics of OO, I strongly suggest you start with an example of a banking application. It is in Alan Gauld's tutorial here: http://www.freenetpages.co.uk/hp/alan.gauld/ Check the bank account class in "Object oriented programming". I think it is a very good real-life example of how to work with objects, and it was a real eye opener to me when I was in your situation. By the way, the whole tutorial is very good. I also recommend: Josh Cogliati's Python Tutorial for Non-Programmers A Byte of Python Hope it helps... Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython GUI designer
[EMAIL PROTECTED] wrote: > I am newbie learning wxPython. I tried using GUI designer called > wxGlade. When it generated code I couldnt get the same level of > flexibility as writing the code by oneself. > > Any view on what you think about using GUI designer tools. > > Every help is appreciated. Try PythonCard. It's based on wxPython, and it's more higher level than Boa. Very simple and very easy to learn and use. -- http://mail.python.org/mailman/listinfo/python-list
Re: Iterating a list in reverse ?
Andy Dingley <[EMAIL PROTECTED]> wrote: > Python newbie: I've got this simple task working (in about ten > different ways), but I'm looking for the "favoured" and "most Python > like" way. > > Forwards I can do this > for t in listOfThings: > print t > > Now how do I do it in reverse? In particular, how might I do it if I > only wanted to iterate part-way through (with a conditional test and a > break), or if I had a large list ? > > reverse( listOfThings ) > for t in listOfThings: > print t listOfThings = [1,2,3,4,5,6] for i in listOfThings: print i# print from 1 to 6 for i in listOfThings[::-1]: print i # prints from 6 to 1 -- http://mail.python.org/mailman/listinfo/python-list
Re: web Develop question
[EMAIL PROTECTED] wrote: > hi guys , > > I' m new to python ...and I would like to ask you , wich is the best > template for developing dinamic generated pages using python ? > > I would like to use something easy to install and develop like php ? > tags and with a lots of features . > > thanks in advance and sorry for this silly question . > > regards, > > richard I suppose you're asking about frameworks. There are many to choose from. There are two that are getting a lot of attention lately: Django and Turbogears, but it seems there are as many options as developers out there... If you're running your own server, you can choose anyone. The real problem is finding a shared hosting service with the option of your choice (at an affordable price). I am very comfortable with bare-bones mod_python. Mod_python is a module that embeds the python interpreter into Apache (a la php). It is not a framework (what's more, many frameworks rely on mod_python), but it gives you many facilities for web development. I find specially handy its publisher handle, which lets you match urls to pages. It can be complemented with a template system, like Cheetah (very good) or its own PSP (python server pages implementation) as a template system. It also gives you the best performance (as far as I know, please correct me if I'm wrong). Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: compiling python (or ironpython) to .exe or .dll for or not for .NET
per9000 wrote: > Hi python people, > > I am working with .NET (in C++/CLI and C#) but since I really love > python I'd like to do things for .NET (or whatever) from python. > > Has anyone tried it? > > What (costless) compilers are good? > > Are there any (costless) editors like MS Visual Express you have tried? > > Is the newest Ironpython really as old as from 2004 July 28 (as stated > on http://www.ironpython.com/)? > > Thanks. > > /Per Erik Strandberg > yet another Fibonaccilover Ironpython development is going full steam towards version 1 (right now is in beta 8), and it's close to completion (see the codeplex link above). It is a faithful implementation of the python language for the .NET framework. Regarding IDEs for Ironpython, I know they are developing a Visual Studio integration (I've not tried it though) and I don't know what's its current state. I'm sure that sooner or later, someone will write a binding for the free SharpDevelop ide. luis -- http://mail.python.org/mailman/listinfo/python-list
Re: web Develop question
[EMAIL PROTECTED] wrote: > Dear Luis , > > Thanks for your kindly answer , so you say that installing mod_python > and a template like chetaah or dyango I can do like as I do with php > and Apache ? Do not get confussed: Django is a complete web development framework, and "Cheetah" is just a template engine. You don't need any framework to use mod_python (although many frameworks use mod_python as a deployment option, as well as CGI or FastCGI, etc). Mod_python is just the module that lets you use python with Apache. However, it has some built-in capabilities for letting you build web sites. They are called "handlers". You can write your own handlers, or you can use the ones included within mod_python. The main two handlers are: 1) PSP: this stands for Python Server Pages, and it is a way to parse scripts in a PHP-like way. For example, you enclose your python instructions between <% and %> tags, and your can mix them within html. However, it is not very polished and I would recomend it... 2) Publisher: It lets you write scripts where you define functions, that correspond to different pages. For example, if you define a function "index" it will contain the code to display your main page. This way you can create a whole site with only one script. You can include html code within these functions, but it is recommended to use a template system combined with publisher, in order to separate presentation and logic. Cheetah is a very good templating engine. I suggest you start by reading mod_python's documentation, and then, when you are up and running with all your installation, you can check Cheetah... Hope it helps... Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: web Develop question
Just to give you an idea of what it is, you can check this article: http://www.onlamp.com/pub/a/python/2004/02/26/python_server_pages.html... This explains the whole thing much better than I did with my poor english... Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Correr Programas Externos
Gabriel wrote: > Hola a todos: > > Necesitaría correr otros programas desde python. Es decir Cuando > aprieto un boton que se abra el block de notas (por ejemplo) ¿Alguien > sabe como hacerlo? > Gracias > > -- > Gabriel Se hace así: import os os.startfile("notepad.exe") Esto te sirve para abrir cualquier archivo que funcione con cualquier programa. Por ejemplo, del mismo modo podés abrir un archivo de word: os.startfile('miarchivo.doc') (A propósito, busca en google que me parece que hay una lista de python en español por ahí, por que acá te van a putear un poco...). Saludos, Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Correr Programas Externos
La lista en español esta acá: http://listas.aditel.org/listinfo/python-es Saludos, Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Reddit broke - should have remained on Lisp?
Alok wrote: > While posting a comment on http://www.reddit.com I got an error page > with the following curious statement on it. > > "reddit broke (sorry)" > "looks like we shouldn't have stopped using lisp..." > > See screenshot at > http://photos1.blogger.com/blogger/1773/1980/1600/reddit-broke.jpg > > Whether they truly repent not using lisp or otherwise, their site > appears to be 3 times slower ... > > Alok I don't know if this is true or not, but blaming a language for a poor development is a little bit ridiculous... -- http://mail.python.org/mailman/listinfo/python-list
Re: Reddit broke - should have remained on Lisp?
Alok wrote: > I was merely describing my experience and inviting others' response > about theirs. That's exactly what I'm doing. > Please don't misconstrue that as a blame on any language. I think it can be interpreted in many ways. Now if you're not ready to read other people's oppinions, don't ask. > And of course, I disagree with your comments about ridicule etc. Ok. -- http://mail.python.org/mailman/listinfo/python-list
Re: Reddit broke - should have remained on Lisp?
K.S.Sreeram wrote: > Have people lost all sense of humor?? Its just reddit's attempt at > humor! I've rarely seen any server errors on reddit, but even when I do > see one.. its funny! > > Here's another one: > http://www.flickr.com/photos/pvera/sets/72057594050280833/ > > Check out their testimonials, its hilarious! > http://reddit.com/static/spreddit/testimonials.html Sure, it looks like a joke! And I don't find it offensive at all. It's just the comment he added below (their site appears to be 3 times slower ...), which seemed to be looking for an argument :-) -- http://mail.python.org/mailman/listinfo/python-list
Re: Reddit broke - should have remained on Lisp?
Alok wrote: > Luis M. González wrote: > > Alok wrote: > > > I was merely describing my experience and inviting others' response > > > about theirs. > > > > That's exactly what I'm doing. > > You misinterpret, I was talking about my experience with the site and > inviting response from other people about their experience with the > site. Now, I don't know much about python or lisp, but I have read > about this web-site's history with the two programming languages. And > hence I chose to post in comp.lang.lisp and comp.lang.python. > > Now if there were a reddit.technology.lisp or > reddit.technology.python, and if they had the same traction as these > usenet groups, then I could have posted there. But that was not an > option was it. > > > > > > Please don't misconstrue that as a blame on any language. > > > > I think it can be interpreted in many ways. > > Can you please explain what your interpretation is? > > > Now if you're not ready to read other people's oppinions, don't ask. > > > > Now, I think you are unfairly prejudiced about my not wanting to read > other people's opinion. I would rather have a 1000 acrid responses to > something I write and learn from it, than post into a responseless > vacuum. > > > > And of course, I disagree with your comments about ridicule etc. > > > > Ok. Dear Alok, I think is you who are misinterpreting me (or I didn't make myself clear). You posted a link to a joke from reddit, which is perfectly fine, is very funny. But below, you added a comment wondering whether the change from Lisp to Python may be a reason for a huge performance loss. I'm not a python bigot, but I just said that blamming a language choice for such a deficieny was ridiculous. There are hundreds of very complex web sites developed in python that doesn't suffer these problems, and, even if they are developed in python, you must take into account which other technologies they are using for deployment (web server, framework, mod_python, cgi, fastcgi, hardware, etc, etc...). Also, the fact that someone could be more versed or knowledgeable of one language compared to another one, doesn't make it better or worse. This is s subjective fact, and has nothing to do with the language. It has to do with who's using the language. Also, as someone pointed out above, don't you think that the huge incresement of traffic since they switched to python may have had something to do with this problem? Perhaps, their lack of experise in a new language didn't prepare them for facing such a challenge. Who knows? Yeah, perhaps if they sticked to Lisp, they could have handled the problem better. They are lispers, aren't they? Anyway, you posted a comment, you asked for opinons, you got mine. Sorry if I ofended you. It wasn't my intention. I'll make sure I place more smileys in my posts to avoid hurting feelings from now on :-) Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: For a fast implementation of Python
. wrote: > What is the fast way for a fast implementation of Python? > > -- > JavaScript implementation of Python > http://groups.google.it/group/JSython/ Check this out: http://codespeak.net/pypy/dist/pypy/doc/news.html -- http://mail.python.org/mailman/listinfo/python-list
Re: For a fast implementation of Python
Pypy aims to become (probably sometime next year) a strong candidate to replace cpython as the main python implementation. Its goals are very ambicious and one of them is making it fast. Some of its developers even think it can get as fast as C, although I think that if it can get as fast as java, it would be great. Its other goal is making it flexible and easier to develop and mantain. Note that the project already produced a tool for writing extensions in rpython that are, in theory, as fast a C extensions. So we can say that in some way, the speed goal is already achieved. Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: I thought I'd 'got' globals but...
Bruno Desthuilliers wrote: > > def doIt(name=None): > global gname > if name is None: > name = gname > else: > gname = name > Sorry for this very basic question, but I don't understand why I should add the global into the function body before using it. This function works even if I don't add the global. Just to try this out, I wrote this variant: gname = 'Luis' def doIt2(name=None): if name is None: name = gname return name print doIt2() --> returns Luis. So, what's the point of writing the function this way instead? def doIt2(name=None): global gname if name is None: name = gname return name luis -- http://mail.python.org/mailman/listinfo/python-list
Re: I thought I'd 'got' globals but...
nate wrote: > try this: > > gname = 'nate' > def test(): >gname = 'amy' >print gname > > test() > print gname > > outputs: > 'amy' > 'nate' > > whereas this: > gname = 'nate' > def test(): >global gname >gname = 'amy' >print gname > > test() > print gname > > outputs: > 'amy' > 'amy' OK, so I should include the global only if I plan to modify it. Otherwise, I don't need to include it. Am I right? -- http://mail.python.org/mailman/listinfo/python-list
Re: I thought I'd 'got' globals but...
Markus Wankus wrote: > On Fri, 07 Jul 2006 19:41:36 -0400, Luis M. González <[EMAIL PROTECTED]> > wrote: > . > . > > OK, so I should include the global only if I plan to modify it. > > Otherwise, I don't need to include it. Am I right? > > > > Correct. Globals are always available to read from. You need to declare > them if you want to modify them in another scope. Like nate, I also tend > to declare them all the time if I am going to use them, just for clarity. > > M. Thank you guys! Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: free python hosting !
John Salerno wrote: > John Salerno wrote: > > Bayazee wrote: > > > >> i want a free hosting for python . > >> so i can make my scripts and upload to server . > >> i want to use mod_python ... > > > > good luck with that... > > p.s. you might look into http://dollar-hosting.org/ > > it's very cheap and supposedly supports mod_python, although i could > never get it to work, so some effort and communication with them might > be required... I'm curious, why it didn't work? I sent them an email recently, asking about mod_python support, and they replied afirmatively, and very quickly. They also said that they can install other scripts on demand. But I never tried them though... I'd like to know more about your experience with this hosting, if possible. Thanks! Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: mod_python fails to load under wamp
Gaurav Agarwal wrote: > Hi, > > Am using WAMP5 and python 2.4.3. I tried to install mod_python 3.2.5 > for python2.4. When i tried starting wamp, Firstly there was no error > message in the apache error log. I saw error message in windows event > viewer : > > "The Apache service named Apache.exe reported the following error: > >>> Syntax error on line 194 of c:/wamp/apache/conf/httpd.conf: <<< > before the error.log file could be opened. > > "The Apache service named Apache.exe reported the following error: > >>> Cannot load c:/wamp/apache/modules/mod_python.so into server: (126) The > >>> specified module could not be found: <<< > before the error.log file could be opened." > > I tried searching the net and found this > http://www.modpython.org/FAQ/faqw.py?req=all#2.10 but i don't have > depends.exe. if somebody has faced this problem before, can you please > assist in fixing this bug.. I'm not an expert in the subject, but I have experienced many troubles in the past while installing and configuring apache and mod_python... It is important to know that each version of apache may match or not a given version of mod_python, so make sure to install the correct versions of each component. Right now, I'm running on windows the following versions: Apache/2.0.55 (Win32) mod_python/3.2.8 Python/2.4.2 I installed "xampp" which is a single application that installs all at once (Apache, php, mysql, etc...) except mod_python, which should be installed separately. I suggest you search the download files on Xampp's sourceforge site and look for an older version with Apache 2.0.55 . I'm not sure, but I think xampp version 1.5.1 will be ok (http://sourceforge.net/project/showfiles.php?group_id=61776) Then, get the mod_python installer (version 3.2.8) http://www.apache.org/dist/httpd/modpython/win/3.2.8/ After that, all you have to do is a few modifications in Apache httpd.config file. Uncomment (or add) the following line: LoadModule python_module modules/mod_python.so And finally, if you want, you can set the configurations of the handler's you want to use with mod_python (they can be publisher, psp, or any other custom one). These configurations can be set on this file, or separately on each web folder as .htaccess files. Hope it helps... Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Python web service ...
[EMAIL PROTECTED] wrote: > My question is how difficult is to set up a web server that can run > python easy ? should I try ZOPE or there is something better in mind ? I also second the suggestion of using Karrigell. It comes with its own built-in server, and the task would be as simle as writing the script and starting the server. If performance and scalability is an issue, you could try mod_python, which is an Apache module for running python, but this would require installing and configuring Apache and mod_python separately. luis -- http://mail.python.org/mailman/listinfo/python-list
Re: python web framework for straight sql (no ORM)?
falcon wrote: > Can someone please recommend a python web app framework which doesn't > abstract away sql in favor of python objects? > > As far as I can tell, frameworks such as django, turbo gears, etc. > allow one to drop down the the sql layer, however that is not the most > effecient use of the framework. I would like to use sql (similar to > how JSP's JSTL provides tag libraries for sql), yet not have to build > my own components such as: site administration, user registration, > authentication, rss feeds, etc. (I guess I'm thinking of a Django with > straight db-api database interface). > > Is there such a framework? > > Thanks. Nothing prevents you from using staright sql with Django or other frameworks. Quoted from Django's home page: "Define your data models entirely in Python. You get a rich, dynamic database-access API for free - but you can still write SQL if needed." Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: IronPython 1.0 released today!
Chris wrote: > Diez B. Roggisch wrote: > > Chris wrote: > > > >> Jim Hugunin wrote: > >>> I'm extremely happy to announce that we have released IronPython 1.0 > >>> today! > >>> http://www.codeplex.com/IronPython > >> > >> > >> I'm no code guru but it sounds interesting. So can I import numpy, > >> scipy, matplotlib, wxpython etc like I do now with CPython and expect, > >> short of a few tweaks, that my code will work? > > > No, you can't. I'm not sure if there are any bridging attempts being made, > > but in this respect IronPython is the same as Jython - a completely > > different runtime which executes its own byte-code. > > > > Diez > Disappointing because, apart from python itself, what I find amazing is > the wealth of additional packages that, by association, come to be > considered part of "python". Anyway thanks for saving me from some > fruitless explorations. People are already porting some of these libraries. Those that are written in pure python don't need to be ported, but those that rely on c extensions can be rewritten in c# or any other .NET language. -- http://mail.python.org/mailman/listinfo/python-list
Re: SQL reports like in MS Access
This isn't probably the answer you are looking for, but a good solution that worked for me is Cheetah. Cheetah is a template engine, which is mainly used for web applications, but that can be used for generating all kinds of text documents. For example, I use it for creating invoices in html format, that can be easily opened in MS Word. Cheetah is very easy to use and I highly recommend it. Luis [EMAIL PROTECTED] wrote: > Hi, what is the best unit for creating reports like in Microsoft > Access, i.e. with page header / footer, grouping, group headers / > footers etc., with Wysiwyg editor? > > Thanks a lot, Jakub -- http://mail.python.org/mailman/listinfo/python-list
Re: How to detect what type a variable is?
Leandro Ardissone wrote: > great, thanks > > And how I can compare this "" output ? > I want to decide what to do if the var is an string and what to do if > not.. > > Tried with: > if type(artistList) == "": > > and > if type(artistList) == "list": > > but nothing.. You shouldn't enclose "list" inside quotes. This is the correct way: if type(artistList) == list: do something... or as someone suggested: if isinstance(l, list): do something... hope this helps. Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: VB to Python migration
I second the suggestion of using Boo for this case. Why use Delphi or VB when you have a more "pythonic" first class .NET language? You already have a very good IDE for creating your project (SharpDevelop), which is free, open source and already has the Boo bindings included (download here the latest version: http://build.sharpdevelop.net/BuildArtefacts/). Boo is a perfect language for someone wanting to develop Windows GUI apps because it has all the nice features and syntax of Python, while being specifically created to run on the .NET framework. However, if you still want to use pure Python, it won't take too long to get what you need. Ironpython is in version 1.0 Beta 2, and moving full steam towards a stable release. I'm sure that soon it will be integrated to Visual Studio. -- http://mail.python.org/mailman/listinfo/python-list
Re: Learning Python
Use "input" to enter numbers, and "raw_input" to enter strings. For example: x = input('Enter your age: ') y = raw_input('Enter your name: ') -- http://mail.python.org/mailman/listinfo/python-list
Re: Is python very slow compared to C
Steven D'Aprano wrote: > What is slow? Slow compared to what? Would you prefer to spend three days > writing a program that will run in twenty milliseconds, or three hours > writing the same program which runs in eighty milliseconds? Is the > computer's execution time more important than your development time? If > the computer's time is more valuable than your time, then you should be > writing in assembly language. > > Python helps you write shorter code with fewer bugs, much quicker, than C. > If you discover a specific problem that runs too slow in Python, it is > possible to write a C extension to solve that specific problem, while > still having all the other advantages of Python. You are right, we all know that, but I think the person who asked this question doesn't want to hear a sales pitch. He asked a very specific question regarding execution speed. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python / Apache / MySQL
Just a few comments... Database: As with anything else, try to keep it simple until you need to make it complex. Sqlite is the simplier alternative, and it's also the fastest for the intended use (small number of users, simple selects, etc). MySQL is also a very good alternative and much more powerful. Mod_python: Mod_python is the best choice (AFAIK, please correct me if I'm wrong) if you want speed, performance and scalability. Many frameworks are based on mod_python (Django, for example), so you can't go wrong with it. But let me tell you that if you just want to use bare-bones mod_python, without any framework on top of it, you can do it, and it's not difficult at all. Mod_python comes with its own implementation of PSP (python server pages), which lets you program a la PHP (intermingling python and html). If you want, you can also separate logic and presentation by using its "publisher handle" along with PSP templates. If you prefer other kinds of templetaing system, you can use them too (for example Cheetah). For a long time I steered away of mod_python because I had the impression it was too difficult and not user friendly enough, what once I tried and followed the examples in the documentation, I found it to be a very good alternative. And the community on its mailing list is very kind and supportive. They reply any question in a matter of minutes. -- http://mail.python.org/mailman/listinfo/python-list
Re: how to get function names from the file
"eval" is not necessary in this case. If you have a tuple with function names such as this: x=(printFoo, printFOO) you can execute them this way: >>> for f in x: f() -- http://mail.python.org/mailman/listinfo/python-list
Re: Python vs. Lisp -- please explain
>IMO, it's the lack of competing implementations. I beg to differ in this point. There are other implementations, but they are not called "python" and they are not a 100% python in syntax and features. For example, Boo is 95% python syntax wise, but statically typed. This fundamental difference makes it as fast as C# or any other .NET (or mono) language. Being statically typed doesn't mean that you have to declare types everywhere, like in C. It uses type inference, so you can declare a variable x= 5 and the compiler will know that x is an integer of value 5. Pyrex is statically typed too, but it's used mainly as an extension language for Cpython. Now talking specifically about python, there are projects aimed at speeding it up substantially: Pypy is a project that relies heavily in type inference (for translation to lower level code) and dynamic optimization. It's based mainly on psyco, which has already probed that it can massively speed up python code. Shed-Skin: it's a pyton-to-c++ compiler. It won't support the most dynamic features of python, and requires the programmer to restric a little bit his coding style in order to allow static compilation, but so far it looks great (only one developer though..). -- http://mail.python.org/mailman/listinfo/python-list
Re: Python vs. Lisp -- please explain
Carl Friedrich Bolz wrote: > Paul Rubin wrote: > Well. "... the PyPy team works on ..." is definitively much too strong. > It is more like "... the PyPy team is thinking about ...". It is very > unclear whether it will work on a technical level and whether the EU > will allow us to allocate resources accordingly. In this thread http://groups.google.com/group/comp.lang.python/msg/5132f0d48c9e7be9 Christian Tismer said that he would work on this, even if this is not pursued by the Pypy team, because he has personal reasons for doing it. So I'm confident that sooner or later, it will be possible to create extension modules written in Rpython. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is Python a Zen language?
I don't know if python is Zend. It's quite minimalistic and it "flows" very well, so I guess it is a... "Feng-shui" language? -- http://mail.python.org/mailman/listinfo/python-list
Re: sqlite newbie questions
On Jun 21, 4:24 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hello, > > I have a sqlite database table which has a table named "Transmittal". > Before inserting a new record into the database, i'd like to perform > some checking. How do i select all records with certain value (say > "Smith") for a column (say "Last_Name")? Knowing almost nothing about > SQL, i just selected everything and process the returned list. > > cur.execute('select * from Transmittal') > records = cur.fetchall() > > Also, how do i delete records with certain value for centain column. I > was thining of something like > cur.execute('delete * from Transmittal where Last_Name=?', "Smith") > but the syntax it's not correct. > > Thanks for your help. > > kelie You need to learn sql if you want to deal with databases. Don't worry, it's very easy, and here is a very good resource to get you up and running in a few minutes: http://www.sqlcourse.com Good luck! Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: visual gui ides for python/jythpn
On Jun 20, 3:16 pm, kromakey <[EMAIL PROTECTED]> wrote: > Hi, > > Are there any free visual GUI IDE's available for python/jython, which > have a drag and drop form designer similar to Visual Studio or > Delphi ? > > Cheers > kromakey PythonCard is an extremely easy to use alternative. It's like a simplified Visual Basic or Delphi IDE. Check IT out: www.pythoncard.org -- http://mail.python.org/mailman/listinfo/python-list
Re: visual gui ides for python/jythpn
On 24 jun, 04:23, "Ethan Kennerly" <[EMAIL PROTECTED]> wrote: > Luis M. Gonzalez wrote: > > PythonCard is an extremely easy to use alternative. > > It's like a simplified Visual Basic or Delphi IDE. > > Check IT out:www.pythoncard.org > > I second that! PythonCard is a rapid way to prototype an ugly Windows GUI. > (It's not PythonCard's fault that Windows are ugly. ;) ) I use it for > prototyping. > > But ONLY for prototyping. At least with my version in Windows, it's got > bugs in the resource editor. For example, Korean characters in Korean fonts > are rotated sideways. And the color of a font can't be changed; only the > foreground color can, which corrupts button display. The send to back/front > options don't seem to work. Transparent images (like PNG) don't seem to > work ... for me, anway. > > Yet, still, when I'm rapidly developing the mechanics of a game and need a > GUI front-end, PythonCard was a quick solution. It brilliantly stores the > GUI as a recursive dictionary, which is like XML, only easy for a human to > read. The widgets require very little of your coding. It's got a lot of > samples, which makes some of its peculiar conventions easy to apply. And > any Python app made with the PythonCard framework has a namespace viewer, > shell, and GUI message integrated into the application. > > Flash and Python: The ultimate GUI prototyping combo? > > In my dreams, I would use Flash for the GUI portion of a Python app. Flash > is by far my favorite environment for rapidly designing interfaces. It is > an (almost) object-oriented drawing environment that can quickly produce > good visual design. Because the elements are instances of prototypes (Flash > calls them symbols), they can be easily replaced and updated at any time. > The timeline, animation, color, layer, and drawing tools are wonderful. You > can quickly make traditional or experimental interfaces. The only thing > that sucked (for me), was ActionScript. It's not bad. It's quite good for > interface scripting. But for back-end procedures it is prison compared to > Python. > > Does anyone successfully use a Flash front-end and Python back-end in > real-time? I've tried an example of XMLRPC servers where a Flash app (SWF) > communicates with Python (http://www.cs.unc.edu/~parente/tech/tr01.shtml), > but that has a round-trip time that is too slow for something like a > videogame (updates at 30 frames per second). Some of the projects at OS > flash look promising (http://osflash.org/ext_howto), but I haven't found the > part that says that my interface made in Macromedia Flash (which is a > fantastic design environment) can be used with my code in Python with a > real-time frame rate. > > -- Ethan Ethan, If you are looking for something more ´advanced´ than a simple windows GUI, I suggest checking out Silverlight, wich is the new deployment technology that ties Ironpython to the browser. With it, you can use Ironpython (wich is Python for .NET) to create apps that run on the browser, the same way you would use javascript, with a lot of new features like animations (ala flash). You are not only limited to Ironpython though. You can use any .NET language, includin other dynamic ones such as Ironruby (not released yet). It is a Microsoft technology, but it works on Firefox as well as IE, on Windows and Mac. It will also run on linux through a Mono project called Moonlight. Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: PyDAO - Python Hibernate-like Object-Relational Mapper
On Jun 27, 4:08 pm, [EMAIL PROTECTED] wrote: > PyDAO is very thin object-relational mapper similar to Hibernate (but > much simpler). It's created to speed-up application development. It's > very simple, but powerful, based on POPO (Plain Old Python Objects). > > http://aplikacja.info/PyDAO.html > > Main features: > > - can use any database that has DB-API interface (MySQLdb, psycopg >tested) > - can work without database at all (useful for early phases of >development) > - speeds up unit testing (dedicated in memory database) > > What is not handled: > > - automatic scheme generation > - separate query language > - automated handling of associations (replaced by filtering by >foreign keys) > > Here's an example how to use PyDAO: > > class User: > def __init__(self): > self.id = None > self.login = None > self.password = None > > dao = pydao.InMemoryDao() > > # filling database > user = User() > user.login = "user1" > user.password = "roh8OoPh" > dao.save(user) > > # filtering based on example > userSearch = User() > userSearch.login = "user1" > userList = dao.list(userSearch) > > # updating > user.password = "eew8Me8g" > dao.update(user) > > Enjoy! > > -- > Dariusz Cieslakhttp://aplikacja.info- custom software systems Interesting, but The link to AbstractDaoTest.py gives me an error message... -- http://mail.python.org/mailman/listinfo/python-list
Re: Shed Skin Python-to-C++ Compiler 0.0.21, Help needed
On Jun 29, 7:48 am, "Mark Dufour" <[EMAIL PROTECTED]> wrote: > Hi all, > > I have just released version 0.0.22 of Shed Skin, an experimental > Python-to-C++ compiler. Among other things, it has the exciting new > feature of being able to generate (simple, for now) extension modules, > so it's much easier to compile parts of a program and use them (by > just importing them). Here's the complete changelog: > > -support for generating simple extension modules (linux/windows; see README) > -dos text format fix (long overdue) > -improved detection of dynamic types (avoid hanging on them) > -improved overloading (__nonzero__, __int__, __abs__ etc.) > -add str(ing).{capitalize, capwords, swapcase, center, ato*) > -fix string.maketrans > -several other minor bug fixes > > For more details about Shed Skin and a collection of 27 programs, at a > total of about 7,000 lines, that it can compile (resulting in an > average speedup of about 39 times over CPython and 11 times over Psyco > on my computer), please visit the homepage at: > > http://mark.dufour.googlepages.com > > I could really use some help in pushing Shed Skin forward. Please try > the latest release and send in bug reports, or join the project via > the homepage. > > Thanks, > Mark Dufour. > > On 3/31/07, Mark Dufour <[EMAIL PROTECTED]> wrote: > > > > > Hi all, > > > I have recently released version 0.0.20 and 0.0.21 of Shed Skin, an > > optimizing Python-to-C++ compiler. Shed Skin allows for translation of > > pure (unmodified), implicitly statically typed Python programs into > > optimized C++, and hence, highly optimized machine language. Besides > > many bug fixes and optimizations, these releases add the following > > changes: > > > -support for 'bisect', 'collections.deque' and 'string.maketrans' > > -improved 'copy' support > > -support for 'try, else' construction > > -improved error checking for dynamic types > > -printing of floats is now much closer to CPython > > > For more details about Shed Skin and a collection of 27 programs, at a > > total of about 7,000 lines, that it can compile (resulting in an > > average speedup of about 39 times over CPython and 11 times over Psyco > > on my computer), please visit the homepage at: > > >http://mark.dufour.googlepages.com > > > I could really use more help it pushing Shed Skin further. Simple ways > > to help out, but that can save me lots of time, are to find smallish > > code fragments that Shed Skin currently breaks on, and to help > > improve/optimize the (C++) builtins and core libraries. I'm also > > hoping someone else would like to deal with integration with CPython > > (so Shed Skin can generate extension modules, and it becomes easier to > > use 'arbitrary' external CPython modules such as 're' and 'pygame'.) > > Finally, there may be some interesting Master's thesis subjects in > > improving Shed Skin, such as transforming heap allocation into stack- > > and static preallocation, where possible, to bring performance even > > closer to manual C++. Please let me know if you are interested in > > helping out, and/or join the Shed Skin mailing list. > > > Thanks! > > Mark Dufour. > > -- > > "One of my most productive days was throwing away 1000 lines of code" > > - Ken Thompson > > Mark Dufour. > -- > "One of my most productive days was throwing away 1000 lines of code" > - Ken Thompson I love it! This is absolutely fantastic!!! I can't belive I can write extension modules that easily... Keep up the good work and thank you!!! Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?
On Apr 20, 2:06 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Please help me think of an example where immutable tuples are > essential. > > It seems that everywhere a tuple is used one could just as easily use > a list instead. > > chris I don't remember exactly where I read about it, but Guido said once that tuples are being kept mainly for historical reasons. This is what Python uses internally from the beginning and it's just an implementation detail that makes sense in some contexts. Although I guess you can ignore them and use only lists instead if you want.. luis -- http://mail.python.org/mailman/listinfo/python-list
Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?
On Apr 20, 3:28 pm, Bjoern Schliessmann wrote: > Luis M. González wrote: > > I don't remember exactly where I read about it, but Guido said > > once that tuples are being kept mainly for historical reasons. > > Weren't tuples added when lists already existed? > > Regards, > > Björn > > -- > BOFH excuse #101: > > Collapsed Backbone I tried googling for these comments, but I couldn't find them. Perhaps I never read them and it was just my imagination... Anyway, I suggest reading this chapter of "Dive into Python" for a good explanation of the differences between tuples and lists: http://diveintopython.org/native_data_types/tuples.html The article explains that, amongst other things, tuples are faster than lists, so if you are working with constant values (inmutables) they are more indicated than lists. luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Microsoft's Dynamic Languages Runtime (DLR)
On May 4, 6:12 pm, Fuzzyman <[EMAIL PROTECTED]> wrote: > On May 4, 5:27 pm, Kaz Kylheku <[EMAIL PROTECTED]> wrote: > > > > > On May 2, 5:19 pm, sturlamolden <[EMAIL PROTECTED]> wrote: > > > > On May 3, 2:15 am, Kaz Kylheku <[EMAIL PROTECTED]> wrote: > > > > > Kindly refrain from creating any more off-topic, cross-posted threads. > > > > Thanks. > > > > The only off-topic posting in this thread is your own (and now this > > > one). > > > You are making a very clumsy entrance into these newsgroups. So far > > you have started two cross-posted threads. The first is only topical > > in comp.lang.python (how to emulate macros in Python). This one is > > topical in neither one, since it is about Microsoft DLR. > > > It's quite possible that some Lisp and Python programmers have a > > strong interest in Microsoft DLR. Those people who have such an > > interest (regardless of whether they are Lisp and Python user also) > > and who like to read Usenet will almost certainly find a Microsoft DLR > > newsgroup for reading about and discussing Microsoft DLR. Do you not > > agree? > > Given that the DLR is a dynamic language framework, abstracted out of > the IronPython 1.0 release, and that it also runs on top of the core > CLR shipped with SilverLight meaning that for the first time sandboxed > Python scripts can run in the browser... > > It would seem entirely on topic for a Python newsgroup very on- > topic... > > Fuzzymanhttp://www.voidspace.org.uk/ironpython/index.shtml > > > Also note that there is very rarely, if ever, any good reason for > > starting a thread which is crossposted among comp.lang.* newsgroups, > > even if the subject contains elements that are topical in all of them > > (yours does not). > > > > Begone. > > > You are childishly beckoning Usenet etiquette to be gone so that you > > may do whatever you wish. But I trust that you will not, out of spite > > for being rebuked, turn a few small mistakes into a persistent style. Indeed, the subject is absolutely on-topic. If can't talk about a so called "Dynamic Languages Runtime" in a pyhton mailing list, I wonder what it takes to be considered on-topic. Frankly, this on-topic/off-topic fascism I see in this list is pissing me off a little bit. I suggest reading this paragraph right from http://www.python.org/community/lists/: "Pretty much anything Python-related is fair game for discussion, and the group is even fairly tolerant of off-topic digressions; there have been entertaining discussions of topics such as floating point, good software design, and other programming languages such as Lisp and Forth." Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Web Programming - looking for examples of solid high-traffic sites
On May 16, 6:04 pm, Victor Kryukov <[EMAIL PROTECTED]> wrote: > Hello list, > > our team is going to rewrite our existing web-site, which has a lot of > dynamic content and was quickly prototyped some time ago. > > Today, as we get better idea of what we need, we're going to re-write > everything from scratch. Python is an obvious candidate for our team: > everybody knows it, everybody likes it, it has *real* objects, nice > clean syntax etc. > > Our main requirement for tools we're going to use is rock-solid > stability. As one of our team-members puts it, "We want to use tools > that are stable, has many developer-years and thousands of user-years > behind them, and that we shouldn't worry about their _versions_." The > main reason for that is that we want to debug our own bugs, but not > the bugs in our tools. > > Our problem is - we yet have to find any example of high-traffic, > scalable web-site written entirely in Python. We know that YouTube is > a suspect, but we don't know what specific python web solution was > used there. > > TurboGears, Django and Pylons are all nice, and provides rich features > - probably too many for us - but, as far as we understand, they don't > satisfy the stability requirement - Pylons and Django hasn't even > reached 1.0 version yet. And their provide too thick layer - we want > something 'closer to metal', probably similar to web.py - > unfortunately, web.py doesn't satisfy the stability requirement > either, or so it seems. > > So the question is: what is a solid way to serve dynamic web pages in > python? Our initial though was something like python + mod_python + > Apache, but we're told that mod_python is 'scary and doesn't work very > well'. > > And althoughhttp://www.python.org/about/quotes/lists many big names > and wonderful examples, be want more details. E.g. our understanding > is that Google uses python mostly for internal web-sites, and > performance is far from perfect their. YouTube is an interesting > example - anybody knows more details about that? > > Your suggestions and comments are highly welcome! > > Best Regards, > Victor. Take a look at reddit.com . It's been developed with WEBPY and it receives millions of visits every day. There are also many sites built with Django (check their website) with a lot of traffic and very good performance And I'm sure other frameworks can show other success stories... just check their websites. Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Web Programming - looking for examples of solid high-traffic sites
On May 16, 6:04 pm, Victor Kryukov <[EMAIL PROTECTED]> wrote: > Hello list, > > our team is going to rewrite our existing web-site, which has a lot of > dynamic content and was quickly prototyped some time ago. > > Today, as we get better idea of what we need, we're going to re-write > everything from scratch. Python is an obvious candidate for our team: > everybody knows it, everybody likes it, it has *real* objects, nice > clean syntax etc. > > Our main requirement for tools we're going to use is rock-solid > stability. As one of our team-members puts it, "We want to use tools > that are stable, has many developer-years and thousands of user-years > behind them, and that we shouldn't worry about their _versions_." The > main reason for that is that we want to debug our own bugs, but not > the bugs in our tools. > > Our problem is - we yet have to find any example of high-traffic, > scalable web-site written entirely in Python. We know that YouTube is > a suspect, but we don't know what specific python web solution was > used there. > > TurboGears, Django and Pylons are all nice, and provides rich features > - probably too many for us - but, as far as we understand, they don't > satisfy the stability requirement - Pylons and Django hasn't even > reached 1.0 version yet. And their provide too thick layer - we want > something 'closer to metal', probably similar to web.py - > unfortunately, web.py doesn't satisfy the stability requirement > either, or so it seems. > > So the question is: what is a solid way to serve dynamic web pages in > python? Our initial though was something like python + mod_python + > Apache, but we're told that mod_python is 'scary and doesn't work very > well'. > > And althoughhttp://www.python.org/about/quotes/lists many big names > and wonderful examples, be want more details. E.g. our understanding > is that Google uses python mostly for internal web-sites, and > performance is far from perfect their. YouTube is an interesting > example - anybody knows more details about that? > > Your suggestions and comments are highly welcome! > > Best Regards, > Victor. Take a look at reddit.com . It's been developed with WEBPY and it receives millions of visits every day. There are also many sites built with Django (check their website) with a lot of traffic and very good performance And I'm sure other frameworks can show other success stories... just check their websites. Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Web Programming - looking for examples of solid high-traffic sites
On May 16, 6:04 pm, Victor Kryukov <[EMAIL PROTECTED]> wrote: > Hello list, > > our team is going to rewrite our existing web-site, which has a lot of > dynamic content and was quickly prototyped some time ago. > > Today, as we get better idea of what we need, we're going to re-write > everything from scratch. Python is an obvious candidate for our team: > everybody knows it, everybody likes it, it has *real* objects, nice > clean syntax etc. > > Our main requirement for tools we're going to use is rock-solid > stability. As one of our team-members puts it, "We want to use tools > that are stable, has many developer-years and thousands of user-years > behind them, and that we shouldn't worry about their _versions_." The > main reason for that is that we want to debug our own bugs, but not > the bugs in our tools. > > Our problem is - we yet have to find any example of high-traffic, > scalable web-site written entirely in Python. We know that YouTube is > a suspect, but we don't know what specific python web solution was > used there. > > TurboGears, Django and Pylons are all nice, and provides rich features > - probably too many for us - but, as far as we understand, they don't > satisfy the stability requirement - Pylons and Django hasn't even > reached 1.0 version yet. And their provide too thick layer - we want > something 'closer to metal', probably similar to web.py - > unfortunately, web.py doesn't satisfy the stability requirement > either, or so it seems. > > So the question is: what is a solid way to serve dynamic web pages in > python? Our initial though was something like python + mod_python + > Apache, but we're told that mod_python is 'scary and doesn't work very > well'. > > And althoughhttp://www.python.org/about/quotes/lists many big names > and wonderful examples, be want more details. E.g. our understanding > is that Google uses python mostly for internal web-sites, and > performance is far from perfect their. YouTube is an interesting > example - anybody knows more details about that? > > Your suggestions and comments are highly welcome! > > Best Regards, > Victor. Reddit.com was built with webpy, and it's amongst the top 1000 websites in volume of traffic. So if you liked it, go with it... I believe one of the authors of reddit is also webpy's developer. Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: PHP5 programmer learning Python
On May 27, 12:41 pm, romiro <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm a PHP5 developer looking to "broaden my horizons" so to speak by > learning a new language. I emphasize the 5 in PHP since I have fully > engrossed myself in the full OOP of version 5 with my own ground-up > projects as well as some work with PRADO (http://pradosoft.com) > > I've dabbled with a number of languages in the past, Python being no > exception, but always ended up coming back to PHP due to being > comfortable with it. Python has stuck to me as a language I _really_ > think I should know more about. I've recently tried C#, a very short > lived re-attempt at C++ and Java, and Ruby. None of those seemed > "fun" except for Ruby, although from what I've seen the syntax between > Ruby and Python are very similar to each other compared to the other > languages. > > Anyway, my first question was if anyone knows of a tutorial that > focuses on PHP -> Python learning, in such that there might be a block > of PHP code alongside an example of how to do the same thing in > Python. One example of something I've already mapped a comparison to > thanks to standard tutorials is a PHP numeric indexed array being > similar to a list and a PHP associative array being similar to a > dictionary. Of course finding such of a tutorial isn't a deal breaker > by any means, but I figured that having it available would be a boon > for me to actually make some headway in my Python learning adventure. > > If there's anything else that could be said about the migration > between the two languages, I'm all ears. I also don't really need to > hear about how "disgusting" php is as a language...I am aware of the > contained chaos that is PHP4, which is why I develop strictly in 5 > using its OOP to the extent my feeble brain allows, a wariness toward > the insecure pitfalls the language has begat in the past, and an > attempt to produce as clean of a syntax as the language can allow. > > Thanks in advance for any help. I don't know of anything like a PHP to Python migration guide. But I think that you should just forget about PHP for awhile an inmerse yourself into learning Python, which is a general purpose programming language suitable for many tasks, and not only for the web. Start with the official tutorial or, if you want something more advanced, read "Dive into Python". Once you get a rough idea of all the cool things you can do with Python, you can concentrate again in web development. You'll be able to write more complex web sites with less code and a cleaner syntax, although you will have to spend some time deciding how to use Python in a web development context. There are many frameworks to choose from, and trying them all can be a daunting task... The choices range from the so called "full stack frameworks" (such as Django or TurboGears) that give you everything you need to build complex web sites and even more (templates, dispatching mechanisms, object-relational mappers, etc, etc) to minimalist solutions such as webpy. But this is something to evaluate after you have a good grasp of the language itself. Be warned: Python is highly addictive and it can make you a hopeless junkie... Good luck! Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: python + XUL
On Aug 12, 3:21 am, Stefan Behnel <[EMAIL PROTECTED]> wrote: > Madhu Alagu wrote: > > Hi > > > Python + XUL Success Stories > > > Thanks > > > Madhu Alagu > > Any chance you forgot to ask a question? > > Stefan My telepatic powers tell me that this means: "I don't really feel like googling, so just give me the info, ok?" -- http://mail.python.org/mailman/listinfo/python-list