Re: BaseHTTPServer and Apache
On Apr 13, 8:44 pm, Ron Garret [EMAIL PROTECTED] wrote: In article [EMAIL PROTECTED], Ron Garret [EMAIL PROTECTED] wrote: Does anyone know of a straightforward way to get Apache to forward requests to a given path to another HTTP server running on a different port? Never mind, I think I figured it out. Apparently what I need is the ProxyPassReverse directive. I'd still be interested in hearing about people's experience using BaseHTTPServer for real applications. Thanks, rg Some python web frameworks use the aproach you described by means of mod_rewrite. For example, Karrigell and Cherrypy (although they offer also other ways of deployment). This page in Karrigell's docs show how: http://karrigell.sourceforge.net/en/apache.htm -- http://mail.python.org/mailman/listinfo/python-list
Re: Shed Skin Python-to-C++ Compiler 0.0.21, Help needed
On Mar 31, 8:38 am, Bjoern Schliessmann usenet- [EMAIL PROTECTED] wrote: Mark Dufour wrote: Shed Skin allows for translation of pure (unmodified), implicitly statically typed Python programs into optimized C++, and hence, ^ highly optimized machine language. Wow, I bet all C++ compiler manufacturers would want you to work for them. Regards, Björn -- BOFH excuse #23: improperly oriented keyboard Mark has been doing an heroic job so far. Shedskin is an impressive piece of software and, if pypy hadn't been started some time ago, it should have gotten more attention from the community. I think he should be taken very seriously. He is the first programmer I know who actually released working code(and a lot of it) of a project that actually manages to speed up python by a large margin, by means of advanced type inference techniques. Other people, in the past, have attended conferences and made spectacular announcements of projects that could speed up python by 60x or more, but never ever released any code. Mark has been working quietly for a long time, and his works deserves a lot of credit (and hopefully, some help). -- http://mail.python.org/mailman/listinfo/python-list
Re: Shed Skin Python-to-C++ Compiler 0.0.21, Help needed
On Mar 31, 10:31 pm, Bjoern Schliessmann usenet- [EMAIL PROTECTED] wrote: Luis M. González wrote: I think he should be taken very seriously. Agreed. Okay, it seems focusing a discussion on one single point is difficult for many people. Next time I'll be mind-bogglingly clear that even the last one understands after reading it one time ... Regards, Björn Fup2 p -- BOFH excuse #46: waste water tank overflowed onto computer Bjoern, I understood what you said. It's just that it seemed that you were mocking at the poster's message. I apologize if that wasn't your intention. Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: PyPy 1.0: JIT compilers for free and more
Carl Friedrich Bolz wrote: == PyPy 1.0: JIT compilers for free and more == Welcome to the PyPy 1.0 release - a milestone integrating the results of four years of research, engineering, management and sprinting efforts, concluding the 28 months phase of EU co-funding! Although still not mature enough for general use, PyPy 1.0 materializes for the first time the full extent of our original vision: - A flexible Python interpreter, written in RPython: - Mostly unaware of threading, memory and lower-level target platform aspects. - Showcasing advanced interpreter features and prototypes. - Passing core CPython regression tests, translatable to C, LLVM and .NET. - An advanced framework to translate such interpreters and programs: - That performs whole type-inference on RPython programs. - Can weave in threading, memory and target platform aspects. - Has low level (C, LLVM) and high level (CLI, Java, JavaScript) backends. - A **Just-In-Time Compiler generator** able to **automatically** enhance the low level versions of our Python interpreter, leading to run-time machine code that runs algorithmic examples at speeds typical of JITs! Previous releases, particularly the 0.99.0 release from February, already highlighted features of our Python implementation and the abilities of our translation approach but the **new JIT generator** clearly marks a major research result and gives weight to our vision that one can generate efficient interpreter implementations, starting from a description in a high level language. We have prepared several entry points to help you get started: * The main entry point for JIT documentation and status: http://codespeak.net/pypy/dist/pypy/doc/jit.html * The main documentation and getting-started PyPy entry point: http://codespeak.net/pypy/dist/pypy/doc/index.html * Our online play1 demos showcasing various Python interpreters, features (and a new way to program AJAX applications): http://play1.codespeak.net/ * Our detailed and in-depth Reports about various aspects of the project: http://codespeak.net/pypy/dist/pypy/doc/index-report.html In the next few months we are going to discuss the goals and form of the next stage of development - now more than ever depending on your feedback and contributions - and we hope you appreciate PyPy 1.0 as an interesting basis for greater things to come, as much as we do ourselves! have fun, the PyPy release team, Samuele Pedroni, Armin Rigo, Holger Krekel, Michael Hudson, Carl Friedrich Bolz, Antonio Cuni, Anders Chrigstroem, Guido Wesdorp Maciej Fijalkowski, Alexandre Fayolle and many others: http://codespeak.net/pypy/dist/pypy/doc/contributor.html What is PyPy? Technically, PyPy is both a Python interpreter implementation and an advanced compiler, or more precisely a framework for implementing dynamic languages and generating virtual machines for them. The framework allows for alternative frontends and for alternative backends, currently C, LLVM and .NET. For our main target C, we can can mix in different garbage collectors and threading models, including micro-threads aka Stackless. The inherent complexity that arises from this ambitious approach is mostly kept away from the Python interpreter implementation, our main frontend. PyPy is now also a Just-In-Time compiler generator. The translation framework contains the now-integrated JIT generation technology. This depends only on a few hints added to the interpreter source and should be able to cope with the changes to the interpreter and be generally applicable to other interpreters written using the framework. Socially, PyPy is a collaborative effort of many individuals working together in a distributed and sprint-driven way since 2003. PyPy would not have gotten as far as it has without the coding, feedback and general support from numerous people. Formally, many of the current developers were involved in executing an EU contract with the goal of exploring and researching new approaches to language and compiler development and software engineering. This contract's duration is about to end this month (March 2007) and we are working and preparing the according final review which is scheduled for May 2007. For the future, we are in the process of setting up structures to help maintain conceptual integrity of the project and to discuss and deal with funding opportunities related to further PyPy sprinting and developments. See here for results of the discussion so far: http://codespeak.net/pipermail/pypy-dev/2007q1/003577.html 1.0.0 Feature highlights == Here is a summary list of key features included in PyPy 1.0: - The Just-In-Time compiler generator,
Re: PythonCard thoughts
On Mar 19, 11:44 am, king kikapu [EMAIL PROTECTED] wrote: I don't know much about PythonCard or wxGlade, but I use wxPython (which wxGlade uses, right?) and you now have the option to separate your GUI and code using an XRC file (xml file that describes layout). So perhaps this is something you can do with wxGlade, but at the same time it might still create the problem you describe above. However, it's very to have your Python files contain just logic. Yes, both products (PythonCard and wxGlade) uses wxPython. It's just that PythonCard is sitting on top of wxPython and it intercepts the events generated. Then it search for an appropriate declared function on your code and call it (all this happens at runtime). It shield us from much of the boilerplate code that gui toolkits require and in the case that you need to address directly wxPython, you just can! I discovered that when you run your designed GUI from PythonCard's layoutEditor, you have the ability to define a command line option that is called Message Watcher. This, will show you the names of the actual events that you have to write code for, so you, at least for this, do not have to dig the docs for their names. Pretty good! Would you please explain more in detail this Message Watcher option? I use PythonCard from time to time, and I find it very easy to use and practical, even considering the small shortcomings you mentioned above, but I have no idea of this feature you're talking about.. Regards, Luis -- http://mail.python.org/mailman/listinfo/python-list
Passing arguments to a command line from a python script
Please forgive me if what I'm asking is non sense... I created a little program to authomate the creation of the setup.py script for py2exe. It simply prompts for the main executable script name and then creates setup.py, as follows: # this is makesetup.py nombre = raw_input('File name?: ') f = open('setup.py', 'w') f.write(''' from distutils.core import setup import py2exe setup( name = %s, windows = [%s.pyw], data_files = [ (., [%s.rsrc.py]) ] ) ''' %(nombre, nombre, nombre)) f.close() # end of script What I want now is execute the script I just created. As far as I know, the only way to execute the script is from a command line and typing setup.py py2exe. Can I do this authomatically right from my program? If so, how? Any hint would be highly appreciated... regards, Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Passing arguments to a command line from a python script
On Mar 19, 9:25 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Mon, 19 Mar 2007 20:46:56 -0300, Luis M. González [EMAIL PROTECTED] escribió: What I want now is execute the script I just created. As far as I know, the only way to execute the script is from a command line and typing setup.py py2exe. A few ways: - os.system(commandline). Simplest way, but you don't have much control, and it blocks until the process finishes. - os.popen[234]? or the functions in the popen2 module - the subprocess module - the most complete way, but simple enough for most cases. -- Gabriel Genellina I'm sorry, but still I can't figure out this... Would you please show me a sample usage of os.system or os.popen for passing arguments to the command line? In this case, I should pass to the command line setuppy py2exe. Thanks! Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Passing arguments to a command line from a python script
On Mar 19, 10:49 pm, zacherates [EMAIL PROTECTED] wrote: On Mar 19, 9:42 pm, Luis M. González [EMAIL PROTECTED] wrote: On Mar 19, 9:25 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Mon, 19 Mar 2007 20:46:56 -0300, Luis M. González [EMAIL PROTECTED] escribió: What I want now is execute the script I just created. As far as I know, the only way to execute the script is from a command line and typing setup.py py2exe. A few ways: - os.system(commandline). Simplest way, but you don't have much control, and it blocks until the process finishes. - os.popen[234]? or the functions in the popen2 module - the subprocess module - the most complete way, but simple enough for most cases. -- Gabriel Genellina I'm sorry, but still I can't figure out this... Would you please show me a sample usage of os.system or os.popen for passing arguments to the command line? In this case, I should pass to the command line setuppy py2exe. Thanks! Luis [EMAIL PROTECTED]:~$ python Python 2.4.4c1 (#2, Oct 11 2006, 21:51:02) [GCC 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)] on linux2 Type help, copyright, credits or license for more information. import os rt = os.system(ls) apps Firefox_wallpaper.png s2tux_sshot_0.ppm xorg.conf.diff Desktopmedia s3work downloads permutation.py squeakworkspace Examples permutation.pyctrackers xorg.conf.aiglx rt 0 This implies that `os.system(setuppy py2exe)` should do what you want. It works! Thank you, this is just what I wanted. Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Passing arguments to a command line from a python script
On Mar 19, 11:52 pm, Steven Bethard [EMAIL PROTECTED] wrote: Luis M. González wrote: On Mar 19, 10:49 pm, zacherates [EMAIL PROTECTED] wrote: This implies that `os.system(setuppy py2exe)` should do what you want. It works! Thank you, this is just what I wanted. You'll get better error checking if instead you do:: import subprocess subprocess.call(['setup.py', 'py2exe']) Actually, you probably should really be doing:: subprocess.call(['python', 'setup.py', 'py2exe']) so that you don't have to assume the OS knows how to run a .py file. STeVe Noted. Thanks STeVe! -- http://mail.python.org/mailman/listinfo/python-list
Re: class declaration shortcut
On Mar 2, 8:29 pm, MonkeeSage [EMAIL PROTECTED] wrote: On Feb 28, 1:26 pm, Luis M. González [EMAIL PROTECTED] wrote: I've come across a code snippet inwww.rubyclr.comwhere they show how easy it is to declare a class compared to equivalent code in c#. I wonder if there is any way to emulate this in Python. I posted like 10 minutes ago, but it looks like it didn't go through. The ruby code is not an easy way to declare a class, it is a ruby class for creating c-like struct objects. This is the basic idea behind the ruby Struct class (but this is quick and dirty, the real implementation is different and done in c, but you should get the basic idea): class Struct2 def initialize(*args) @@attrs = [] args.each { |arg| eval(class self; attr_accessor :#{arg} end) @@attrs.push(arg) } end def new(*args) args.each_index { |i| eval(self.#{@@attrs[i]}=args[i]) return self } end end Person = Struct2.new(:name) bob = Person.new('bob') puts bob.name A python equiv. would be something like: class Struct(): def __init__(self, *args): self.attrs = [] for arg in args: setattr(self, arg, None) self.attrs.append(arg) def __call__(self, *args): for i in range(len(args)): setattr(self, self.attrs[i], args[i]) return self Person = Struct('name') bob = Person('bob') print bob.name Regards, Jordan Thanks for your detailed reply! So after all, the www.rubyclr.com code is not a fair comparison. Because the c# code shows a class definition, and the ruby code shows a struct definition, which is not equivalent to a class. Is that right? -- http://mail.python.org/mailman/listinfo/python-list
Re: class declaration shortcut
On Mar 1, 3:03 pm, Arnaud Delobelle [EMAIL PROTECTED] wrote: On Mar 1, 4:01 pm, Steven Bethard [EMAIL PROTECTED] wrote: Arnaud Delobelle wrote: [...] This does pretty much the same thing as the recipe I posted: Not at all. My new_struct create returns a new class which is similar to a C struct (notice the __slots__). The recipe you refer to is nothing more a class which can be initialised with some attributes. It does not address the OP's question at all. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/502237 Note that your approach requires repetition of the 'Person' and quotes around each attribute name, which the OP complained about. The recipe at least gets rid of the repetition of 'Person'. The 'name' argument is not necessary. It is just here to give a user- friendly name to the newly created class. One could just as well write the new_struct function so that Person = new_struct('name', 'tel', ...) Of course it would be impossible for the function written as above to name the class in a user-meaningful way. The recipe you refer to does not face this problem because it is not a method to quickly create a new class, it is merely a class whose __init__ method allows you to initialise some attribute at instance-creation time. As for the quotes around the attribute names, well... Let's say that if it was possible to do without, I don't think I would be using python... -- Arnaud This is the closest we got so far to the intended result. If there was a way to enter attributes without quotes, it would be almost identical. Anyway, I wonder if the code comparison in www.rubuclr.com between the c# and ruby code is fair... As far as I know, classes and structs are not the same thing. In the case of that ruby example, can someone add methods later? Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: PyCon blogs?
On Feb 27, 9:36 pm, [EMAIL PROTECTED] wrote: Was anybody blogging about PyCon (talks and/or sprints)? Got any pointers? Thanks, Skip http://blogsearch.google.com/blogsearch?hl=entab=wbq=pyconbtnG=Search+Blogs -- http://mail.python.org/mailman/listinfo/python-list
class declaration shortcut
I've come across a code snippet in www.rubyclr.com where they show how easy it is to declare a class compared to equivalent code in c#. I wonder if there is any way to emulate this in Python. The code is as follows: Person = struct.new( :name, :birthday, :children) I tried something like this, but it's nothing close to what I'd like: def klass(table, *args): cls = new.classobj(table, (), {}) for i in args: setattr(cls, i, i) return cls But this above is not what I want. I guess I should find a way to include the constructor code inside this function, but I don't know if this is possible. Also, I wonder if there is a way to use the variable name in order to create a class with the same name (as in Personabove). Well, if anyone has an idea, I'd like to know... Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: class declaration shortcut
On Feb 28, 6:21 pm, Steven Bethard [EMAIL PROTECTED] wrote: Luis M. González wrote: I've come across a code snippet inwww.rubyclr.comwhere they show how easy it is to declare a class compared to equivalent code in c#. I wonder if there is any way to emulate this in Python. The code is as follows: Person = struct.new( :name, :birthday, :children) How about something like:: class Person(Record): __slots__ = 'name', 'birthday', 'children' You can then use the class like:: person = Person('Steve', 'April 25', []) assert person.name == 'Steve' assert person.birthday == 'April 25' assert not person.children Is that what you were looking for? If so, the recipe for the Record class is here: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/502237 STeVe Hmmm... not really. The code above is supposed to be a shorter way of writing this: class Person: def __init__(self, name, birthday, children): self.name = name self.birthday = birthday self.children = children So the purpose of this question is finding a way to emulate this with a single line and minimal typing. There are a few problems here: 1) How to get the variable name (in this case Person) become the name of the class without explicity indicating it. 2) How to enter attribute names not enclosed between quotes. The only way I can do it is by entering them as string literals. It's not that I desperately need it, but I'm just curious about it... Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: what is the idiom for copy lots of params into self?
Emin wrote: Dear Experts, When writing large classes, I sometimes find myself needing to copy a lot of parameters from the argument of __init__ into self. Instead of having twenty lines that all basically say something like self.x = x, I often use __dict__ via something like: class example: def __init__(self,a,b,c,d,e,f,g,h,i,j,k,l,m,n): for name in ['a','b','c','d','e','f','g','h','i','j','k','l','m','n']: self.__dict__[name] = locals()[name] This saves a lot of code and makes it easier to see what is going on, but it seems like there should be a better idiom for this task. Any suggestions? Thanks, -Emin How about using variable length argumens? class example: def __init__(self, *args): for i in args: self.__dict__[i] = i x = example('uno','dos','tres') Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Python - C# interoperability
mc wrote: Is there an easy way to compile a Python class (or set of classes) into a .DLL that a C# program can call? Or otherwise to use an existing library of Python classes from a C# program as seamlessly as possible? I'm affraid this is not possible. Ironpython (the .NET python implementation) can consume assemblies written in other statically typed languages, such as c#, but not the other way around. This is because Ironpython is still a dynamic language, and the lack of type information makes it impossible to be compiled as c#. For the time being, if you really need to write reusable assemblies that could be consumed from other .NET languages, you shouldn't use Ironpython. You should use c#, vb.net or any other static language implementation for .NET. If you want a more pythonic alternative, you could use Boo ( http://boo.codehaus.org ). It's a static language with a python-like syntax, and it's very easy to pick up if you already know python. For consuming Boo assemblies from Ironpython, you should compile them as .DLL, and place them into a DLLs folder in your Ironpython root directory (where ipy.exe is located). Then you simply import them as you would with any other python module. Make sure to add also the boo assembly. If you are using c# instead, you don't have to add anything else. Hope this helps, Luis -- 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 type 'str' 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) == type 'list': 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: 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. /F 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: 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?
- 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: 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: 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: 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 snip 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? snip 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: 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: 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: 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: 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: 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 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: 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: 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( form action = mysite.py/printMyName method = post input type = text name = myname input type = submit ) 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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=alllang=psycolang2=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: 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: 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: 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: IronPython 1.0 Beta 7 Released
Ravi Teja wrote: Also, IronPython cannot access CPython libraries. So it cannot be used as a drop-in replacement for CPython in most non-trivial apps. Python for .NET however allows you to both use both CPython and .NET libraries. It will be able to access the standard libraries, as long as they are rewriten in a .NET language. People are doing it already, it's just a matter of time... -- http://mail.python.org/mailman/listinfo/python-list
Re: IronPython 1.0 Beta 7 Released
Ravi Teja wrote: Also, IronPython cannot access CPython libraries. So it cannot be used as a drop-in replacement for CPython in most non-trivial apps. Python for .NET however allows you to both use both CPython and .NET libraries. It will be able to access the standard libraries, as long as they are writen in pure python, otherwise they should be rewriten in a .NET language. People are doing it already, it's just a matter of time... -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Programming Books?
Free online resources for learning Python: To get started, I strongly suggest Josh Cogliati's Non-Programmers Tutorial for Python ( http://honors.montana.edu/~jjc/easytut/easytut/ ). I learned programming with this little tutorial, which is a very good introduction. After that, you could check these ones: A Byte of Python by Swaroop CH Learning to Program by Alan Gauld (http://www.freenetpages.co.uk/hp/alan.gauld/) The last one is specially good to grasp the basics of object oriented programming. It has a very good example of a banking application that was a real eye opener to me. Good luck, LUIS -- http://mail.python.org/mailman/listinfo/python-list
IronPython 1.0 Beta 7 Released
Check it out: http://www.gotdotnet.com/workspaces/workspace.aspx?id=ad7acff7-ab1e-4bcb-99c0-57ac5a3a9742 -- http://mail.python.org/mailman/listinfo/python-list
Re: IronPython 1.0 Beta 7 Released
Well, basically, ironpython is to .NET what jython is to JAVA. It is a faithful implementation of the python language, written in c#, created to run on and take full advantage of the .NET framework. That means that you have access to all the available libraries of the .NET framework and you can use your favorite language. It is 100% compliant with cpython. If you want to take advantage of ironpython, all you have to do is learn more about the .NET framework and its libraries. You don't need to learn anything new regarding language features. It's just plain and regular python. You have to bear in mind something very important though: Ironpython is not a first class .NET language. That means that although you can write programs that run on .NET and you have access to all its libraries, you can't write libraries that could be consumed by other languages. This is because ironpython is still a dynamic language, while all the other .NET languages are static. So it cannot be compiled like c# or VB, for example. It is not a problem if all you want is to create end user programs, but if you want to write reusable libraries, you're better off using any other statically typed language. In this case, a good alternative is Boo, which is very similar to python (syntax wise), but statically typed. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python - Web Display Technology
IMHO, there's nothing more annoying that a website showing me a progression bar, indicating how much time it will get to provide the information I'm looking for... And when the progression bar ends, I have to wait until the flashy graphics and stupid presentation shows me the go to html site... I use the web for working. I work in international trade and I'm all the time looking for new products, searching for information, technical specifications, etc, etc... Flash, when using sparingly, could give an elegant touch to a web site. But when abussed, it is very annoying. It makes me waist my time and my patience And finding a website that uses Flash apropiately, is very unusual. Most of the times, they are loaded with heavy animations (most of them boring). The more I see it, the more I like the old fashioned html style... And now with Vista, Avalon, and all those new buzzwords coming soon, I don't know where we are going...all I know is that we will need 1 GB of ram just to keep on seeing the same stupid animations that get on my way when I'm working... -- http://mail.python.org/mailman/listinfo/python-list
Re: combining a C# GUI with Python code?
PythonCard is based on wxpython and it's free: http://pythoncard.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: combining a C# GUI with Python code?
First of all, you should be thinking about ironpython instead of cpython. This way you can forget about c# and do it all in (iron)python. I don't know its current state, but Microsoft is working in a Visual Studio - Ironpython integration. For more info: http://lists.ironpython.com/htdig.cgi/users-ironpython.com/2006-February/001752.html -- http://mail.python.org/mailman/listinfo/python-list
Re: combining a C# GUI with Python code?
Now that I think about it, I'm not sure if Visual Studio can create GUIs with ironpython already. I guess that at this moment, its integration is as a text editor only (I may be wrong though). I almost forgot it, but someone was working in a little tool that converts C# forms into python classes (for being used with ironpython). Check it out: http://www.digitalfanatics.org/e8johan/projects/cs2py/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Is PythonCard dead?
18 months? Wow!.. time flies... Anyway, PythonCard is a fine product, and it's very good just the way it is. It would be great if a new release comes up though... -- http://mail.python.org/mailman/listinfo/python-list
Re: Coming from delphi - looking for an IDE - willing to spend money
I suggest checking out PythonCard. It's a GUI builder based on wxPython and it's very easy to use. It offers the basic functionality of Delphi or VB, letting you drag drop widgets on a form. This visual way of dealing with widgets authomatically creates a file with the form and its controls description, and the events associated to these widgets are writen in another separated file as simple functions. http://pythoncard.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Recommended IDE for creating GUI?
Check PythonCard: http://pythoncard.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Should I learn Python instead?
First of all, let me tell you that you can now write apps for .NET with Python. There's a python implementation for the .NET framework called Ironpython (in beta 5 now). Regarding XML, I can't tell you much but in general, python is much easier, cleaner, concise and intuitive than all the other alternatives you mention. Being a dynamic language, you can achieve more with less lines of code. Easy tasks are easier with python, and complex tasks can look simple with too. I also think that Python is an excellent first language to learn. Learn it, get used to think as a programmer, learn the basics (functions classes, oop.) and then, when you're reasonably comfortable, you'll be ready to pick any other language (or you'll be happy enough to know that you don't need to learn any other one). -- http://mail.python.org/mailman/listinfo/python-list
Re: New Karrigel page in Wikipedia
When you talk about the Karrigell folks it looks like there's a bunch of guys out there ploting to rule the world. It's nothing like that. I just read Pierre's comments about this article, and decided to post a message in comp.lang.python to let everybody know about it. Perhaps my post looked like a sales pitch... well, I'm sorry! I think Karrigel needs some promotion. It's an excellent product and it's been almost ignored by the community... I appreciate all the observations regarding Wikipedia's nature, but I confess that I'm surprised to see you, python folks, so annoyed by this article. -- http://mail.python.org/mailman/listinfo/python-list
New Karrigel page in Wikipedia
For those interested in the simplest, easiest and most pythonic web framework out there, there's a new page in Wikipedia: http://en.wikipedia.org/wiki/Karrigell -- http://mail.python.org/mailman/listinfo/python-list
Re: Python2CPP ?
You should check Shed Skin (Python-to-C++ Compiler): http://shed-skin.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list
PyPy is now able to compile efficient extension modules!
PyPy is now able to compile efficient extension modules!. This was recently announced by Christian Tismer on Pypy's mailing list. To learn more: http://codespeak.net/pipermail/pypy-dev/2006q1/002911.html -- http://mail.python.org/mailman/listinfo/python-list
Re: New-style Python icons
This is strange... I've been trying to access this site since yesterday, but I couldn't (Firefox can't stabilish connection with server www.doxdesk.com). However, I seem to be the only one with this problem... -- http://mail.python.org/mailman/listinfo/python-list
Re: New python.org site
I wouldn't want to sound like I'm criticizing other people's work. To those who offered their time to create this site, which is quite an improvement over the old one, thank you! However, I like the idea of a contest. Both for the site and for the logo. Perhaps something cool could come up from the new crop of Django/TurboGears fans our there... For many people, these things may seem superfluos or not important at all, but good marketing and good design helps to create an image and an identity. -- 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: 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: 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: 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 / 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: 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: 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: 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: 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?
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: 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: 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