Re: Application Generators
Steve Hannah wrote: > I know that this is an older thread, but I came across it on Nabble.com. > Just wanted add some updated info on Walter's observations about Dataface > (http://fas.sfu.ca/dataface) . It is much further along in development now > and it does support authentication now. > Thanks, for the particular project that I was working on, I went with AppGeni, and added my own authentication. I do have other projects in mind. Dataface seems almost like a free version of codecharge. One thing I don't much like about codecharge, is that it's windows only. -- http://mail.python.org/mailman/listinfo/python-list
easy questions from python newbie
This is the first real python program I have ever worked on. What I want to do is: 1) count identical records in a cvs file 2) create a new file with quantities instead duplicate records 3) open the new file in ms-excel For example, I will start with a file like: 1001 1012 1008 1012 1001 1001 and finish with a file like: 1001,3 1008,1 1012,2 What I need to know: 1) is there a function in python that will sort a file into another file. Something like: sort file1.txt > file2.txt from the DOS command line. I know there is also a similar "sort" funtion in Unix. 2) is there a function in python that will correctly load a csv file into an excel spreadsheet, and open that spreadsheet. 3) I will probably be working with 50 items, or less, would it be best for me to do this with a multi-diminsional array? For example: sort the file, read a rec into the array, if the next rec is the same then incr the count, otherwise add a new rec with a count of 1. Then write the array to a file? -- http://mail.python.org/mailman/listinfo/python-list
Re: easy questions from python newbie
Thanks to all who replied. As I mentioned, I am new to python. I will have to look some of this stuff, but that is fine. I am trying to learn. I am sorry I forgot to mention, the platform is windows-xp. I am doing this for a client who has a small warehouse operation. Personally, I usually use debian at home. If it matters, the origianl file is coming from a portable scanner. After it's uploaded to the PC, the file needs to be hand processed, then loaded into an remote site with a mysql backend. When new items are recieved, they are scanned into a portable device, then transferred to a file on a PC. The python app will then process that file to provide item counts so that the shipment can be easily compared to the packing list (there has been a lot of trouble with shipments not matching). Once the list is checked, the items will have to placed into bins - this is why I need the file to be loaded into excel. The corresponding bin numbers will have to entered into that spreadsheet, then saved to a cvs, then the cvs will be processed into the online database. -- http://mail.python.org/mailman/listinfo/python-list
Accessing files on a PocketPC device
I want my python app to read a file from a pocketpc mobile device, if possible. Assume I am running windows-xp, and activesync 3.8. Assume I have "exported" the file. As I understand it, exported files are not really on the PC, even after syncing. You have to use your stylus on the PDA to get to the file in question, then use your PC mouse to drag the file onto the PC. I hate this. As it is, to get to the file, I have to open "my computer" then open the "mobile device" icon. Is there any way for a python script to access a file on the PDA? Assume, I know exactly where the file is located, and what the file is named. -- http://mail.python.org/mailman/listinfo/python-list
wxPython for web development?
I assume that wxWidgets can not be used if all you have is mod-python? -- http://mail.python.org/mailman/listinfo/python-list
is mod_python borked?
I am considering python, instead of php, for web-application development. I often see mod_python.criticisized as being borked, broken, or just plain sucking. Any truth to any of that? -- http://mail.python.org/mailman/listinfo/python-list
Re: is mod_python borked?
Shreekar Patel wrote: > No, I've been using mod_python for a long time, and I haven't run in to > any problems. In fact I use python server pages for my web development, > which is much faster than python cgi scripts. > Researching further, it looks to me like mod_python may only work well on apache 2.X. I noticed that django only works with apache 2.X, and I'm not sure about turbogears. (btw: it always annoys me when I can't find the system requirements for a project. Those requirements should be easy to find. I shouldn't have to google for two hours, and post to several forums). If I'm right about mod_python only working well with apache 2.x, then I think that's a shame, because few web-hosters use apache 2.x. -- http://mail.python.org/mailman/listinfo/python-list
Re: is mod_python borked?
[EMAIL PROTECTED] wrote: > One of the biggest problems is that a lot of ISPs still use Apache 1.3 > and so only mod_python 2.7.X is available on those platforms. Yes, I think that is a big problem. I don't think django or turbogears will work with apache 1.3. And it seems to me that practically all web-hosters use apache 1.3. *sigh* maybe I'll just use php until the web-hosters catch up, if they ever do. -- http://mail.python.org/mailman/listinfo/python-list
Python v PHP: fair comparison?
I don't know if this is a fair comparison or not. Any comments appreciated. - Python is more readable, and more general purpose - PHP has awful backward compatibility - PHP has a lower barrier to entry - Most inexpensive web-hosters support PHP, but not Python - PHP has far more pre-writen scripts available - Newer versions of mod_python require Apache 2.0, which few hosters have - There is more demand for PHP developers, than Python developers -- http://mail.python.org/mailman/listinfo/python-list
Re: Python v PHP: fair comparison?
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. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python v PHP: fair comparison?
Larry Bates wrote: > I'd be surprised if there was more demand for PHP developers > than Python developers. Prepare to be surprised. From what I have seen demand for PHP developers is off-the-scale higher than demand for Python developers. If you search the job boards, then -IMO- it is only fair to not include jobs where the language is listed as an also-ran. For example a typical sys-admin job will list about 24 skills, and python is often thrown into the landry list. To my way of thinking, that is not really an ad for a python developer. Trying to be as fair as I can be, my research shows that demand for developers where PHP is the primary is *far* higher than jobs where Python is the primary skills. Of course, at best, that only shows the demand part of the equation. There is also the supply side to consider. From what I have seen for salary offers for PHP developers, it may be fair to say that PHP developers are a dime a dozen. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python v PHP: fair comparison?
Bjoern Schliessmann wrote: > walterbyrd wrote: > > > - PHP has a lower barrier to entry > > Which kind of barrier do you mean -- syntax, availability, ...? > Putting php into a web-site is as easy as throwing some php code into a my html file, and maybe giving the file a php extension. I can get php hosting for $10 a year easy. This may not be what you want for a major developement project, but the barrier to entry is very low. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python v PHP: fair comparison?
Michael Torrie wrote: > 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. > I would say that you are one of very few who use PHP for sys-admin tasks - and even you have switched to Python. In general, it does not seem to me that PHP has caught on as a sys-admin language. However, as sys-admin scripting langanges go, I would also say that Python is far less popular than butt-ugly Perl. Again - just based on what I've seen. -- http://mail.python.org/mailman/listinfo/python-list
Will GPL Java eat into Python marketshare?
Some think it will. Up untill now, Java has never been standard across different versions of Linux and Unix. Some think that is one reason that some developers have avoided Java in favor of Python. Now that Java has been GPL'd that might change. IMO: it won't make much difference. But I don't really know. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python v PHP: fair comparison?
Bruno Desthuilliers wrote: > walterbyrd a écrit : > You mean there are web hosting companies that are still using Apache > 1.3.x ? > Practically all web-hosters still use Apache 1.3.x. Certainly all of the lower priced hosters. > C'mon, let's be serious. I just ordered a dedibox - a small dedicated > web server - for my personal use. It's only 30 euros a month, you know... What if I only need 25mb of space? I can that with a PHP hoster for $10 a year. That is about 1/36th the price that you posting about. Maybe you don't mind paying 30 euros a month, but a lot others do. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python v PHP: fair comparison?
Gabriel Genellina wrote: > - php sucks :) > I think that it's such a braindead > language which turns people into braindead programmers :) > > In fairness, a lot of very serious work is done in PHP. I think yahoo and other major web-sites use php. I have issues with PHP as well. They will break backward compatibility on a whim, and it is an ugly language - especially when mixed with html. But, PHP does have it's streaths, and Python is not without it's weaknesses. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python v PHP: fair comparison?
James Cunningham wrote: > Nope. It disproves your assertion that "certainly all of the lower > priced hosters" use Apache 1.3. Okay, where can I get Python and Apache 2.X for $10 a year? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python v PHP: fair comparison?
Tim Chase wrote: > I can't say I've come across any hosting places that serve up PHP > for $10/yr either...the closest I've found is about $3.50/mo > (which also provides Python CGI). dollar-hosting.net offers php5 and python 2.3, for $10 a year. the-protagonist.net has PHP 4.4 hosting for $10 a year. I'm sure I could find more. Both of those sites use Apache 1.3. -- http://mail.python.org/mailman/listinfo/python-list
does anybody earn a living programming in python?
If so, I doubt there are many. I wonder why that is? -- http://mail.python.org/mailman/listinfo/python-list
Re: does anybody earn a living programming in python?
> > Well I do. So do the other dozen or so developers at my company. We're looking > to hire a few more, in fact. > I'm surprised. It seems I never see listings for python developers. I didn't mean any disrespect. I think python is a great language. It just doesn't seem like there is much demand for professional python developers. -- http://mail.python.org/mailman/listinfo/python-list
Re: does anybody earn a living programming in python?
Fredrik Lundh wrote: > someone just posted this > > > Site Perl Python > > Hotjobs 2756 655 > > Monster >1000 317 > > Dice 4828 803 > >From what I have seen, most of listings are not for python developers. Rather they list python as a "nice to have as an extra" skill. Same goes for perl. For example, sys admin jobs often list every scripting language the job writer can think of. There seem to be very few jobs where perl, or python, are the primary skills being sought. -- http://mail.python.org/mailman/listinfo/python-list
Re: does anybody earn a living programming in python?
Max M wrote: > walterbyrd skrev: > > If so, I doubt there are many. > > > > I wonder why that is? > > Because you are ignorant? In this particular subject: yes. My research of this subject was very limited, just looked at the major job boards, and compared demand for python developers to demand for other languages, such as java, c++, visual basic, or php. An unscientific test, I realize. But, it's not easy to get good data on such a subject: everybody has an agenda, it seems. I don't count jobs where python is an "also ran" skill. For example, sys-admin jobs where python is listed with a dozen other skills. The posts in this thread have been helpful. -- http://mail.python.org/mailman/listinfo/python-list
Python v PHP for web, and restarting Apache?
I think I have read somewhere that using Python to develop web-applications requires some restarting of the Apache server, whereas PHP does not. Also, I seem to remember reading something about PHP being able to recover from Apache restarting more easily than Python. I am not trying to suggest anything here. I'm just asking. -- http://mail.python.org/mailman/listinfo/python-list
What do I look for in a shared Python host?
For example: - If I want to use Django, I need either FastCGI or Apache 2.X/mod_python 3.x - if I want to use TurboGears, I need Python 2.4: not 2.3 and not 2.5 - I have just learned that some hosters have T&Cs that forbid long running processes. I am not sure exactly what that means. Except I understand it can be a problem if using Cherrypy/TurboGears - I have read that mod_python before 3.x can be difficult What other "gotchas" would I look for? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python v PHP for web, and restarting Apache?
[EMAIL PROTECTED] wrote: > > Python is much better suited to writing and mainting large web > applications though. > I have to ask: why is that? Because Python is more readable? Because Python runs faster? Is Python more stable for large scale applications? Does this apply when using Python with CGI, FastCGI, mod_python, or what? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python v PHP for web, and restarting Apache?
Fredrik Lundh wrote: > > modularity, modularity, and modularity. > Can't PHP be made to be just as modular? As a matter of popular practise, I suppose that is not done. I would think that it could be. My big problem with PHP is the lack of backward compatibility. My big problem with Python is that popular frameworks like django and turbogears have sky-high system requirements. Few web-hosters have Apache 2.X, mod_python 3.x, FastCGI, or Python 2.4. -- http://mail.python.org/mailman/listinfo/python-list
Re: Trying to understand Python objects
Thanks everybody. I will sort all of this out, but right now my head is spinning. Is there some book, or other reference, that explains of this? I was thinking about "Python for Dummies." The "Think like a Computer Scientist" book, and "Dive into Python" book don't seem to explain Python's object model clearly enough for me. -- http://mail.python.org/mailman/listinfo/python-list
Is PyGTK only for local - not web?
I have noticed that there is also pygtk-web project, I suppose that is what you use for the web? -- http://mail.python.org/mailman/listinfo/python-list
Who uses Python?
I mean other than sysadmins, programmers, and web-site developers? I have heard of some DBAs who use a lot of python. I suppose some scientists. I think python is used in bioinformatics. I think some math and physics people use python. I suppose some people use python to learn "programming" in general. Python would do well as a teaching language. I would think that python would be a good language for data analysis. Anything else? Finance? Web-analytics? SEO? Digital art? -- http://mail.python.org/mailman/listinfo/python-list
Re: Who uses Python?
On Jun 5, 3:01 am, Maria R <[EMAIL PROTECTED]> wrote: > I tend to agree with some earlier poster that if you use Python you > are, in a sense, a programmer :o) > Yes, in a sense. But, in another sense, that is sort of like saying that people who post on message boards are "writers." I should have been more clear, when I posted "programmers" I meant "professional programmers" i.e. people who develop software applications for a living. I am getting the idea that most python "programmers" use python more like a tool, rather than as their primary specialization. In other words, python is usually not the primary specialization. I think this is different than other languages, such as Java, or even PHP. Few python users are specifically "python programmers" rather, they are data analysts, scientists, etc. who use python in the same way that some might use excel - as a tool. BTW: I am seriously impressed with the stuff that many here are doing with python. And I would like to thank those who responded to my post. -- http://mail.python.org/mailman/listinfo/python-list
What's with "orange" ??
The maker of the skeletonz python based CMS, amonge other things: http://orangoo.com/skeletonz/ One of the few hosts that really provides good support for django: http://asmallorange.com/ The python component-based data mining software: http://www.ailab.si/orange -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie question: how to get started?
On Jun 16, 8:48 pm, ed <[EMAIL PROTECTED]> wrote: > Hi, > > I'm interested in starting to learn python. I'm looking for any > reccomendations or advice that I can use to get started. Looking > forward to any help you can give! > > Thanks! > > -e Here are two very well regarded online books - both free: http://www.diveintopython.org/ http://www.ibiblio.org/obp/thinkCSpy/ -- http://mail.python.org/mailman/listinfo/python-list
newbie opinion: easygui rocks
I barely even know how to program in python. I downloaded this easygui, and I was writing useful gui application within a few minutes. I can hardly believe it. Any other noobs here, you may want to give this a try. http://www.ferg.org/easygui/ -- http://mail.python.org/mailman/listinfo/python-list
Collections of non-arbitrary objects ?
Python seems to have a log of ways to do collections of arbitrary objects: lists, tuples, dictionaries. But what if I want a collection of non-arbitrary objects? A list of records, or something like that? -- http://mail.python.org/mailman/listinfo/python-list
Re: Collections of non-arbitrary objects ?
On Jun 21, 5:38 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > That's a flippant response, but I don't understand the question. Everybody here seems to have about the same response: "why would you ever want to do that?" Maybe it's something that doesn't "need" to be done, but it seems to me that would give you a certain level of built-in integrity - you could be sure about what's in the structure. I would not expect that all of python would be that rigid, but I thought it might be worthwhile if there were one such structure. Think of this: why use tuples when lists are available? You can use a tuple to index a dictionary, but not a list - why? I the answer may be that sometimes you want some degree on inherent enforced structure. I'm sure the language could have designed to allow lists to index dictionary, but you would have to awfully careful with those lists. The burden would be on the programmer to make certain that those lists didn't change. But, it could be done, therefore tuples are not "needed" right? Languages like C are often criticized as being too rigid - you have to pre-define your variables, and pre-allocate your array sizes. But, languages like Perl and BASIC, are often criticized as being to sloppy - too few restrictions tend to lead to sloppy code. So I guess there is a sort of trade-off. I suppose I could use a database, that might give me some degree of assured integrity - depending on what database I used. -- http://mail.python.org/mailman/listinfo/python-list
Re: Collections of non-arbitrary objects ?
On Jun 22, 11:43 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > Can you help us understand, by showing a use case that would in your > estimation be improved by the feature you're describing? > Suppose you are sequentially processing a list with a routine that expects every item to be of a certain type. Something in the list that doesn't conform to the type could give you unexpected results, maybe crash your application. In python, as far as I know, there is nothing built into the language to keep any type of item from being included in a list - or any such structure. To me, that seems like a potentially vulnerability. Especially since variables in python do not have to be explicitly assigned - another variable that points to the same thing, could change the data that a variable points to. -- http://mail.python.org/mailman/listinfo/python-list
Re: Collections of non-arbitrary objects ?
On Jun 24, 10:31 pm, Bruno Desthuilliers
<[EMAIL PROTECTED]> wrote:
> > Especially since variables in python do not have to be explicitly
> > assigned
>
> ???
I have probably expressed this incorrectly. What I meant was:
>>> a = [1,2,3]
>>> b = a
>>> a[1] = 'spam'
Here, I have changed b, without an explicit assignment. After I
assigned a to b, I never did another "b =" yet b changed anyway
because I changed a. I am not saying there is anything wrong with
this, I'm just explaining what I meant.
So let's say I have list L, and I have a routine that expects every
item in L to be a dictionary like: {'name':'joe', 'job':'dev', 'pay':
min_wage}.
Not only could the app crash if an incorrect item where inserted into
L. But the app could crash if an incorrect item were inserted in lists
X,Y, or Z.
Of course, you can always work around this by just programming very
carefully, and doing a lot of error checking. That is always true in
any language.
But, I think sometimes it's helpful to use a structure that is little
more restrictive, to sort of enforce a degree of integrity. An example
I have already given: why use tuples instead of a list? Tuples are
actually a bit more restrictive.
I don't think there is anything wrong with the data structures that
exist in python. I was just wondering if there was a structure that
would restrict a collection to only allow certain types. The
"restrictedlist" class discussed in another thread may be the sort of
thing I was looking for.
BTW: I think polymorphism is great and all. But it does have (and IMO
should have) it's limitations. For example, I don't think you can
divide a string by another string.
--
http://mail.python.org/mailman/listinfo/python-list
Re: Collections of non-arbitrary objects ?
> > On Jun 24, 10:31 pm, Bruno Desthuilliers > > <[EMAIL PROTECTED]> wrote: > > You perhaps don't know this, but most statically typed languages have > the notion of either pointers or references, that can cause similar - > and usually worse - problems. > Yes, but those languages also have the notion of structures that do not allow arbitrary collections. That is what I was wondering about when I started the thread. It's fine that python has four different ways of creating collections of arbitrary data types, but I thought it might be helpful if python had, at least, one way of a creating a collection of non-arbitrary data. > > You do program carefully, don't you ?-) > I try. But things like typos are a normal part a life. > > Now did you actually had any effective problem with Python's dynamism ? > Or are you just scared ? > Just scared. > You know, Python is now something like 17 years old, and is used by a > *lot* of peoples for a *lot* of programs - some of them far from > trivial. I think you can be confident in this experience. IOW, just > write your code, and you'll find out that the kind of problems you seem > to fear so much will not happens that often. > Of course, BASIC is over 40 years old, also used by a *lot* of people. A lot of non-trivial apps have been written in BASIC. But, BASIC is often criticized for it's lack of structure. A language's longevity, and/or popularity, don't mean there isn't room for improvement. Guido must think python has a lot of room for improvement since he's completely throwing out backward compatibility with python 3000. > > You don't use tuples "instead of" lists. Lists are collections, tuples > are structured data. > It seems to me that tuple are essentially immutable lists. So why impose that immutability restriction on a data collection? Why not just have lists and not tuples? What can a tuple do that a list can not do? Why was python designed so that tuples could be used for dictionary indexes, but not lists? Could it be because imposing that restriction on a data collection insures a certain degree of integrity? My point is: sometimes imposing some restrictions can give a degree in built-in integrity. Maybe you don't need that integrity insurance, if you code carefully enough, but can you always count on that? BTW: I'm not assuming that it will always be me running my own app. Sure, if an exception occureed while I was running my own app, I'd probably know what to do. But if somebody else (who - god forbid - didn't know python was running the app, things might be more difficult. -- http://mail.python.org/mailman/listinfo/python-list
Re: Collections of non-arbitrary objects ?
On Jun 26, 8:23 am, Bruno Desthuilliers wrote: > walterbyrda écrit : > > >> You do program carefully, don't you ?-) > > > I try. But things like typos are a normal part a life. > > So are they in any language. I fail to see much difference here. > For example: if I mis-type a variable name in C, the program will probably not even compile. Whereas, with Python, the program will probably run, but may give unexpected results. > > Guido > > must think python has a lot of room for improvement since he's > > completely throwing out backward compatibility with python 3000. > > Not "completely throwing out". Just allowing *some* major breakages - > the kind you usually get with each major release of other languages, but > that Python managed to avoid as much as possible so far. I don't know, but here is a direct quote from Guido's blog: "Python 3.0 will break backwards compatibility. Totally." http://www.artima.com/weblogs/viewpost.jsp?thread=208549 > > > It seems to me that tuple are essentially immutable lists. > > They are not (even if you can use them that way too). FWIW and IIRC, > this is a FAQ. A few posters here have stated that tuples are not just immutable but when I compare lists, to tuples, I notice that both are ordered collections of arbitrary objects, with the primary difference being that list are mutable, and tuples are not. It seems to me that if a list were immutable, it would be a tuple. That is the one big difference. Tuples have been compared to records/structures in other languages. But, in general, I can not use a for loop to loop through the fields in a record, and I can not sort those fields either. -- http://mail.python.org/mailman/listinfo/python-list
Re: Collections of non-arbitrary objects ?
> > Did you try to sort a tuple ? > > >>> (1, "aaa").sort() > Traceback (most recent call last): >File "", line 1, in ? > AttributeError: 'tuple' object has no attribute 'sort' I can do this: >>> x = (3,2,1) >>> x = tuple(sorted(list(x))) Which, although senseless, effectively sorts the x tuple. But, you are right, I am not really sorting the tuple, I'm sorting a list, which has been made from the tuple, then changing it back to a tuple. Actually, I can even do it in one line: x = tuple(sorted(list((3,2,1 -- http://mail.python.org/mailman/listinfo/python-list
Does Python work with QuickBooks SDK?
My guess is that it would, but I can find no mention of python in the intuit developers site. I can find some references to PHP and Perl, but no Python. I looks to me like Intuit develops have a strong preference for visual- basic, then c/c++, then delphi. I find it just a little bit surprising, since Python does work with .Net and all. -- http://mail.python.org/mailman/listinfo/python-list
Re: Does Python work with QuickBooks SDK?
Thanks to Greg and Mike. I am not looking for specifics right now. I was just wondering if there was a practical way to do use python to integrate with intuit apps. Apparently, there is. -- http://mail.python.org/mailman/listinfo/python-list
Can python find HW/SW installed on my PC - like Belarc?
Lets suppose, I want a listing of what hardware and software is installed on my windows box. Can I do that with Python? -- http://mail.python.org/mailman/listinfo/python-list
Can I use Python instead of Joomla?
If I wanted to build a website with forums, news feeds, galleries, event calander, document managment, etc. I do so in Joomla easily. But, I would perfer to use django/python, if that would be at all practical. I suppose I could put python scripts into django, if those scripts exist. -- http://mail.python.org/mailman/listinfo/python-list
Re: Can I use Python instead of Joomla?
On May 2, 5:38 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > You're mixing apples, fishes, and cars here. Joomla is a content > management system, Django a framework and Python a language. Yes, I know, but they are all ways to create a website. If I wanted a site which included galleries, forums, etc. and I didn't want to re- invent the wheel, I could: 1) Use joomla or drupal, and possible end up "fighting the framework" to get just what I want. 2) Cooble together a web-site with various scripts, either developed by others, or myself. I would like to work with django, and include some python stuff. But, the PHP environments seem to have a much richer assortment of pre- written scripts. If I want to include my own applications, I could develop those apps with a popular PHP MVC called "CakePHP" and include those into joomla or drupal. I don't know if there is anything like that with Python development. -- http://mail.python.org/mailman/listinfo/python-list
Re: Can I use Python instead of Joomla?
On May 3, 11:08 am, Bruno Desthuilliers wrote: > I'm not sure integrating CakePHP stuff into something like Joomla or > Drupal will be that easy. I don't know either. But, there are projects called "jake" and "drake" which are specifically geared toward intergrating cakephp with joomla and drupal, respectively. -- http://mail.python.org/mailman/listinfo/python-list
Re: Can I use Python instead of Joomla?
On May 3, 7:49 pm, John Draper <[EMAIL PROTECTED]> wrote: > I admit, Joomla is easy to use I admit, but very easy to vector into > a root exploit. I had no idea. Thank you for posting that. One thing I really like about joomla is the 1600+ extensions. But, I don't need those kinds of security issues. -- http://mail.python.org/mailman/listinfo/python-list
Newbie look at Python and OO
I learned to program with Pascal, way back when. Went into software
development for a while, then went into systems admin. Have programmed
in several languages, just learning Python.
Some things I find odd:
1) 5/-2 == -3?
2) list assignment handling, pointing two vars to the same list:
With simple data types:
>>> a = 5
>>> b = a
>>> a = 3
>>> a,b
(3, 5)
Which is what I'd expect, since I have changed a, but not b.
But with lists:
>>> a = list("1234")
>>> b = a
>>> a.append("5")
>>> a,b
(['1', '2', '3', '4', '5'], ['1', '2', '3', '4', '5'])
b changes even though I have not touched b. I know why, but this is
not what I would ordinarilly expect, it does not seem intuitive. And,
IMO, it gets worse:
>>> a = list("1234")
>>> b = a
>>> a = a + ['5']
>>> a,b
(['1', '2', '3', '4', '5'], ['1', '2', '3', '4'])
Sometimes changing a changes b, and sometimes not. You also have to
remember that subseqent changes to a will not change b - after some
operation but not others. To those who think in Python, I'm sure this
all seems normal. But, having programmed in about one dozen other
language, this seems downright bizare to me. I know why it works like
this, but it seems like an odd way to do things.
3) ambiguous use of the form: this.that()
Sometimes, this.that() means module.funcion() as in:
>>> os.dirlist(".")
Other times, "this" is sort of like a parameter to the "that"
function:
>>> a = list("1234")
>>> "_".join(a)
'1_2_3_4_5'
And still other times, is seems that "this" is an object, acted upon
by "that" :
>>> a = list("1234")
>>> b = "_".join(a)
>>> b.split("_")
['1', '2', '3', '4', '5']
BTW: it seems a bit odd to that the positions of the string, and the
delimitor, are reversed between the complementory functions join(),
and split(). I suppose if it weren't for OO, we have something
terribly complicated, like:
split(str, "_")
join(str, "_")
Again, those who think in Python, will understand right away that:
math.count(x)
is counting the substring "x" in the "math" string. But can you see
where that might be confused to be a function called count() in the
math module?
I'm not complaining. Python is a great language in many respects. But,
I would take some issue with those claiming Python is intuitive and
easy. IMO: there seems to be many ambiguous, unintuitve, and
confusing, aspects to Python.
--
http://mail.python.org/mailman/listinfo/python-list
Re: Newbie look at Python and OO
Thanx for all the replies, I may be slowly getting it. But, can anybody explain this? >>> a = 'hello' >>> b = 'hello' >>> a is b True >>> a = 'hello there' >>> b = 'hello there' >>> a is b False -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie look at Python and OO
Nevermind my previous question. I found the answer in "Learning Python" >> Python internally caches and reuses short strings as an optimization, there really is just a single string, 'spam', in memory, shared by S1 and S2; hence, the is identity test reports a true result. To trigger the normal behavior, we need to use longer strings that fall outside the cache mechanism: << -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie look at Python and OO
> He's thinking in Pascal, not C. > Actually, I have programmed in many languages. I just first learned in Pascal. For me, going from Pascal, to basic,c,cobol,fortran . . was not that difficult. Python, however, feels strange. As crazy as this may sound: Python, in some ways, reminds me of assembly language. I haven' t programmed in assembly in a *long* time. But I vaugly remember doing a lot of stuff where I used memory addresses as pointers to data, and also as pointers to pointers. Although, when I first started assembly language, I think it took me a week to write a program to print "hello world." -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie look at Python and OO
> > You started this thread with a list of conceptual problems you were > having. Are they now cleared up? > Yes. Thank you, and everybody else. I'm still learning, and still getting used to Python. But, I understand the concepts that I was having trouble with before. -- http://mail.python.org/mailman/listinfo/python-list
How to do basic CRUD apps with Python
With PHP, libraries, apps, etc. to do basic CRUD are everywhere. Ajax and non-Ajax solutions abound. With Python, finding such library, or apps. seems to be much more difficult to find. I thought django might be a good way, but I can not seem to get an answer on that board. I would like to put together a CRUD grid with editable/deletable/ addable fields, click on the headers to sort. Something that would sort-of looks like an online spreadsheet. It would be nice if the fields could be edited in-line, but it's not entirely necessary. Are there any Python libraries to do that sort of thing? Can it be done with django or cherrypy? Please, don't advertise your PHP/Ajax apps. -- http://mail.python.org/mailman/listinfo/python-list
How do I count the number of spaces at the left end of a string?
I don't know exactly what the first non-space character is. I know the first non-space character will be * or an alphanumeric character. -- http://mail.python.org/mailman/listinfo/python-list
How do I tell the difference between the end of a text file, and an empty line in a text file?
Python's lack of an EOF character is giving me a hard time. I've tried: - s = f.readline() while s: . . s = f.readline() and --- s = f.readline() while s != '' . . s = f.readline() --- In both cases, the loop ends as soon it encounters an empty line in the file, i.e. xx xxx xxx < - - - loop end here xx xx x < loop should end here -- http://mail.python.org/mailman/listinfo/python-list
how do I count spaces at the beginning of a string?
The strings start with whitespace, and have a '*' or an alphanumeric character. I need to know how many whitespace characters exist at the beginning of the string. -- http://mail.python.org/mailman/listinfo/python-list
In a text file: how do I tell the EOF, from a blank line?
How do I test for the end of a file, in such a why that python can tell the EOF from a blank line? -- http://mail.python.org/mailman/listinfo/python-list
Re: In a text file: how do I tell the EOF, from a blank line?
On May 16, 10:12 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2007-05-17, walterbyrd <[EMAIL PROTECTED]> wrote: > > This has already been explained to you by at least 5 different > people -- complete with examples. Sorry about dual posting. I am using google groups. Usually, after I submit a message, I can find that message after a few minutes. This time, I could not find the messages that I posted after waiting for hours. I figured something must have gone wrong, so I re-posted. -- http://mail.python.org/mailman/listinfo/python-list
No Python for Blackberry?
I could not find a version of Python that runs on a Blackberrry. I'm just amazed. A fairly popular platform, and no Python implementation? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python compared to other language
On May 18, 2:17 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > Python is Portable - C is probably the only more portable language Small quibble: IMO, although C runs on many platforms, I don't think C code is typically portable between platorms. Unless you are doing something very simple. If you write something with Visual Studio to do something fairly advanced on Windows, I don't think the same, unmodified, code will usually run on UNIX, or MS-DOS. Maybe if you use pure ANSI C, but I don't think many people do that. I'm just learning Python. FWIW: my opinions about Python: - good for many things, but probably not the most popular for any one thing. For example: PHP is more popular for web-dev, Perl is more popular for sys-admin. - IMO: the most comparable language to Python, is Perl. Both are scripting languages. Both are free, multi-platform, and multi-purpose. Both are also very popular. - although good for beginners, Python is also used for some very advanced stuff. - IMO: people are more likely to switch from Perl, to Python, than the other way around. - Python is generally considered to be more readable than Perl, and thereby, more maintainable. - I have managed to be fairly productive with Python in a very short time, if I get good at Python, I think I could be very productive. - although Python is considered one of the most popular languages, jobs as python programmers seem to be very rare. I think Python is often used as a tool by people who specialize in other things: data analysts, scientists, systems administrators, database administrators, software testers, etc. - some will tell you that you don't need to know anything about object oriented development to use Python. But, I don't think you will get far without some OO. Just my $0.02 -- http://mail.python.org/mailman/listinfo/python-list
Re: Python compared to other language
On May 18, 8:28 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Surely the fact that Python is available on so many platforms implies > that C is a fairly portable language. Unless it's the same C code, I don't see how that means anything. If I write an app on Windows with C, and I rewrite the same app on UNIX with C - that doesn't mean the C code has been ported. My guess is that some of the C code used to develop Python is the same between the different Python distros, but much of the code is unique to the particular platform. If that is the case, then the C code may not be very portable. But, I can often take the same python code, and run it on MacOS, Linux, FreeBSD, and Windows. Often I can do this even if the app has a gui interface. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python compared to other language
On May 18, 10:24 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > > I think that Ruby, which roughly speaking sits somewhere between Python > and Perl, is closer to Python than Perl is. I don't know much about Ruby, but it does not seem to be commonly used for anything other than web-development. It may be that Ruby could be used for other purposes, but I don't seem to see it happen much. I know that PHP can used at the command line, and could be used for the same sort of sys-admin tasks for which, Perl and Python are often used, but I don't seem to see that happening either. I'm not sure if Ruby, or PHP, are as general purpose as Perl or Python. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python compared to other language
On May 19, 7:23 am, Steve Holden <[EMAIL PROTECTED]> wrote: > The reason you can do this with Python is precisely because the > developers have ironed out the wrinkles between platforms by putting the > requisite conditionals in the C source. But that is my point. With Python, the language itself takes care of the platform differences, so the same Python code will run on different platforms. I realize that, at a lower level, everything is done is C. But, from the developers point of view: developing code in C requires more attention to platform specifics, than does developing code in Python. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python compared to other language
On May 19, 9:36 am, [EMAIL PROTECTED] (Alex Martelli) wrote: > > From these numbers it would seem that Ruby (and PHP) aren't really more > web-specific than Perl (and Python). > Excellent find, nice work. However, if it is found that there are "X" many PHP programs running payroll applications, does that mean that those PHP programs are *not* web applications? I don't think that it does. I was surprised to see Ruby in the same catagory as Perl and Python, when it came to Scientific apps. I always thought of Ruby as being used for database oriented web-based stuff. Just goes to show what I don't know. I can tell you this much for sure: when it comes to UNIX system scripting, Perl is the leader, with Python as a solid second. Unless, maybe, you count bash & bourne, which I don't because those are not multi-purpose languages. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why PHP is so much more popular for web-development
On Jul 25, 2:12 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > Also, CherryPy's requirements are very > minimal. In terms of memory and CPU, maybe. But I think that *requires* apache 2.x and a very recent version of mod_python. By web-hosting standards, those are very steep requirements. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why PHP is so much more popular for web-development
On Jul 25, 2:10 pm, Jeff <[EMAIL PROTECTED]> wrote: > I can tell you exactly why PHP > is so popular: it acts as an extension of HTML and is syntactically > similar to Perl. > Although, that can lead to problems, if you're not careful: Perl: my $x = 5 + 9000 || 1; # $x is 9005 PHP: $x = 5 + 9000 || 1; # $x is 6... -- http://mail.python.org/mailman/listinfo/python-list
Re: Why PHP is so much more popular for web-development
On Jul 22, 12:17 am, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Either you are a casual user with 101 web > development skills trying to set up your personal home page But this, sort of, brings me back to my original point. Nobody starts out being advanced. There are substantial differences in cost, and deployment, between PHP and Python. It is much easier to get started with PHP. And once somebody has started with PHP, that person is likely to stay with PHP. Most PHP developers do not see a compelling reason to start all over again with Python. BTW: I have a certain amount of respect for PHP, and PHP developers. PHP5 is a big step forward over PHP4. And, there have been substantial web projects completed with PHP - probably more so than with Python. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why PHP is so much more popular for web-development
On Jul 25, 3:55 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Jeff McNeil wrote: > > Unfortunately, I also find that PHP programmers are usually more > > plentiful than their Python counterparts. When thinking of staffing > > an organization, it's common to target a skill set that's cheaper to > > employ and easier to replace down the road if need be. > > Right, that's why hospitals are replacing their surgeons with butchers. > There are so many more of them available. It's only cutting meat, after all. > Hospitals probably would if they could. Healthcare is extremely regulated. Software development, web or otherwise, is still the wild- west. Besides, I don't think it's quite fair to characterize all PHP developers as "butchers" and Python developers as "surgeons." Python may be superior to PHP, but come on now. Besides, I see about 100X more ads for PHP programmers, than Python programmers. My guess is that there probably are a lot more PHP developers, especially web- developers. > > Also, larger hosting shops are hesitant to run things such as TG and > > Rails that require an additional server process. The name of the game > > is density. Sure, it may be easy to manage and run a TG project, but > > it's a pain to set one up on a shared hosting server. > > Virtualization will solve that problem. > I can get PHP hosting for $10/year. Will I be able to get a virtual host for that? -- http://mail.python.org/mailman/listinfo/python-list
Why PHP is so much more popular for web-development
"Once you start down the Dark path, forever will it dominate your desiny. Consume you, it will." - Yoda I'm fairly new to web-development, and I'm trying out different technologies. Some people wonder why PHP is so popular, when the language is flawed in so many ways. To me, it's obvious: it's because it's much easier to get started with PHP, and once somebody gets started with a particular language, that person is likely to stay with that language. Before you can even get started with Python web-development, you have to understand this entire alphabit soup of: CGI, FASTCGI, MOD_PYTHON, FLUP, WSGI, PASTE, etc. For me, configuring fastcgi has been the most difficult part of getting django to work. PHP developers don't have to bother with anything like that. With PHP, you just throw some code in the middle of your html file. Also, PHP, and PHP frameworks, are supported everywhere. If you going to use a PHP MVC framework, like codeignitor, you would have a hard time finding a hoster that didn't support it - all you need is php4 and mysql. Dollar-hosting, for $10 a year, should work just fine with codeignitor. With codeignitor, just copy your files to whatever host, and that's it, you're done. By contrast, the most popular Python frameworks have sky-high system requirements. Take a look at the requirements and/or recomendations for popular Python frameworks like Django, TurboGears, or CherryPy: Apache 2.0, mod_python (latest version), fastcgi (at least), command line access, PostgreSQL. And a lot of low-cost hosters don't support Python at all. Don't get me wrong: I am not saying that PHP is better than Python for web-development. But, I sometimes think that Python could learn a few things from PHP. All JMHO, of course. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why PHP is so much more popular for web-development
On Jul 25, 12:40 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > What exactly could Python learn from PHP? Remember, I'm a noob, I'm not trolling. When I posted "Python" I meant the Python web-developement world. In particular, python frameworks, like CherryPy, have requirements that are not realistic for most shared hosting plans. Maybe I'm wrong, but I often get the idea that those who develop python frameworks don't give a thought to the realities of shared hosting. They seem to think that everybody has complete control over the server. Things are very different in the PHP universe. To use codeignitor as an example, again. On the "why codeignitor" part of the welcome page you will find: --- CodeIgniter is right for you if... * You need broad compatibility with standard hosting accounts that run a variety of PHP versions and configurations. * You want a framework that requires nearly zero configuration. * You want a framework that does not require you to use the command line. --- I don't seem to see Python frameworks using those sorts of selling points. Posting as a noob, who is struggling to get django configured on dreamhost, I gotta tell 'ya: those selling points look awfully attractive. The point is: PHP framework makers are very considerate of the realities of shared hosting. Python framework makers don't seem to give it a thought. Just maybe, that's something that Python could learn from PHP. -- http://mail.python.org/mailman/listinfo/python-list
Is it reasonably easy easy to something like this with python?
This is made with a php5 framework called qcodo. http://examples.qcodo.com/examples/dynamic/inline_editing.php With qcodo it's easy to make grids that are sortable and inline editable. Qcodo grids work from the database - not an xml table or array. Qcodo handles complex data relations, and fairly large datadabes. I like python better than php, but I don't know of any python tools to create these sorts of grids. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is it reasonably easy easy to something like this with python?
On Aug 28, 1:31 pm, Gerardo Herzig <[EMAIL PROTECTED]> wrote: > walterbyrd wrote: > The one who make that table sorteable is AJAX. Not php. The php part is > kind of trivial (so it would be `trivial' in python too). It just reads > some data and format it in an html table. Thank you, that is great to know. What if there were 1000 records, and the table was paginated? I suppose, ajax would sort the front end, and backend language, and database, would soft behind the scene, or something? -- http://mail.python.org/mailman/listinfo/python-list
What's with "long running processes" ?
I understand that Python has them, but PHP doesn't. I think that is because mod_php is built into apache, but mod_python is not usually in apache. If mod_python was built into apache, would python still have long running processes (LRP)? Do LRPs have to do with a Python interpreter running all the time? Or is it something else? I also understand that LRPs are the reason that shared hosting is less common, and more expensive for python than php. The LRP have a major effect on how many users can packed onto a single server. As to LRPs: does it matter if you're using mod_python, fastcgi, wsgi, scgi, cgi, or whatever? Obviously, I am a little foggy about LRPs, can somebody help me out? -- http://mail.python.org/mailman/listinfo/python-list
Is hostmonster any good for hosting python?
According to hostmonster's list of features, they do support python. Does anybody have any experience with hostmonster? -- http://mail.python.org/mailman/listinfo/python-list
Re: Is hostmonster any good for hosting python?
I should have mentioned, I am thinking about using a python framework, either django, turbogears, or pylons. I think these frameworks require a newer version of python, maybe 2.4. Also, I think some of them require a newer version of Apache - 2.0 or better. I also think these python frameworks all work with fastcgi, which - I think - is possible with hostmonster. Although fastcgi is acceptable, it is generally not the preferred solution. I do not think you will get reasonable performance with CGI, even if factcgi/mod_python/wsgi are not officially required. Also, I doubt you will find mod_python on any "standard" shared hosting. To get mod_python you will need 1) a host that speciallizes in python - like webfaction. 2) a virtual host 3) something like hcoop.net, which may be sort-of like a virtual host. BTW: hccoop.net has a long-running freeze on new memberships. Please correct me if I'm wrong about any of this. -- http://mail.python.org/mailman/listinfo/python-list
SDTimes - Trends From 2007: "Dynamic languages are on the rise."
This according to SDTimes: http://www.sdtimes.com/article/story-20071215-13.html They don't specifically mention Python. But, I think Python qualifies as a dynamic language. "1. Dynamic languages are on the rise. We went into 2007 knowing that Ruby would be a popular topic, thanks to Ruby on Rails, and that JavaScript was resurgent, thanks to AJAX-based rich Internet applications. However, we did not anticipate that there would be such broad big-company support for dynamic languages--and there was, from everyone from Microsoft to Sun, CodeGear to Eclipse. If you were learning a new language in 2007, it wasn't Java or C#; it was a dynamic language." -- http://mail.python.org/mailman/listinfo/python-list
Trying to understand Python web-development
I don't know much php either, but running a php app seems straight forward enough. Python seems to always use some sort of development environment vs production environment scheme. For development, you are supposed to run a local browser and load 127.0.0.1:5000 - or something like that. Then to run the same thing in a development environment, I have to configure some files, or touch all the files, restart the web-server, or something. Why is that? Python also seems to require some sort of "long running processes" I guess that the python interpretor has to running all of time. I am not really sure about what wsgi is supposed to accomplish. -- http://mail.python.org/mailman/listinfo/python-list
Re: Trying to understand Python web-development
Thanks for all that posts. This thread has been helpful. I have seen a lot of posts about the importance of decoupling the deployment technologies from the framework technologies. This is how I have done that in PHP. I develop on my home box. When I get something working the way I want, I ftp those files to the remote server. To me, that seems to make more sense that trying to run two different web servers on the same system. My PHP system involves no monkeying with special config files, or running special servers to couple the different environments, or setting special ports, or paths. For PHP development, I don't even need ssh access. > I think that this (the ease of PHP application deployment) is one of the things that keeps Python framework developers up at night I think you may have something there. For $10 a year I can get an account at dollar-hosting.net, copy some php files there, and that's all there to it. I have been beating my brains out trying to get anything working with a python framework, and I have not been able to do it. I even bought VPS hosting just for the sake of python development. But, I still can not seem to make the quantum leap of getting something that works locally, to work remotely. BTW: with the VPS hosting, I had to install and configure my own web-hosting and PHP, including setting up lighttpd with fastcgi and php modules - and I still found that much easier than getting anything to work with python. -- http://mail.python.org/mailman/listinfo/python-list
Can I load a python program at the interactive >>> prompt?
I am running cygwin on xp. Much to my annoyance, I can not cut-and-paste from a windows app to the python prompt. I think I could do this with putty, but I do not have the permissions to install putty on my xp box. Can I load a file into the python interactive environment? For example I have a file called test.py that consists of the following: print "hello" print "hello again" Can I load that file into python at the >>> prompt? >>> load "test.py" or something like that? -- http://mail.python.org/mailman/listinfo/python-list
Is 3.0 worth breaking backward compatibility?
IMO: breaking backward compatibility is a big deal, and should only be done when it is seriously needed. Also, IMO, most of, if not all, of the changes being made in 3.0 are debatable, at best. I can not think of anything that is being changed that was really a "show stopper" anyway. At best, I am a casual python user, so it's likely that I am missing something. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is 3.0 worth breaking backward compatibility?
On Dec 7, 12:35 pm, Andreas Waldenburger <[EMAIL PROTECTED]> wrote: > Plze. Python 3 is shipping now, and so is 2.x, where x > 5. Python > 2 is going to be around for quite some time. What is everybody's > problem? A possible, potential, problem, could arise if you were using python 2.x, but some other code, that you wanted to include, was writen in python 3.x. It always surprises me that so many python developers never consider the possibility that you may not always be working with your own code. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why no lexical scoping for a method within a class?
On Dec 17, 10:00 am, r wrote: > When writing > procedural code how would you like it if vars inside functions were > automatically global. Your code with be blowing chunks in no time. That was my point - I consider python's ordinary use of lexical scoping to be a good thing, and I was wondering why this "good thing" was not used in classes, as well as outside of classes. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why no lexical scoping for a method within a class?
On Dec 17, 9:04 am, [email protected] wrote: > Yes. It's called Object Oriented Programming. I think you mean it's *Python* Object Oriented Programming. I am not sure that every other OO language works like that. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why no lexical scoping for a method within a class?
On Dec 17, 10:17 am, "Richard Brodie" wrote: > Not really, self is a formal parameter to the function. It would be > a strange language where a function's own arguments weren't in scope. Thank you, that makes sense to me. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why no lexical scoping for a method within a class?
On Dec 17, 8:41 am, [email protected] wrote: > If scoping worked as you want, how, pray tell, would you define object > attributes?- Hide quoted text - I suppose you could do this: class className(): varname = "whatever" def fname(self, varname): . . . . Instead of having variable defined within methods to be global everywhere within the class. Anyway, it's not a matter of what I like, I am just trying to understand the reason behind the scoping rules. -- http://mail.python.org/mailman/listinfo/python-list
Why no lexical scoping for a method within a class?
For a language as well structured as Python, this seems somewhat sloppy, and inconsistant. Or is there some good reason for this? Here is what I mean: def a(): x = 99 print x def b(): print x a() b() # raises an exception because x is not defined. However in the methods are within a class, the scoping seems to work differently. class ab(): def a(self): self.x = 99 print self.x def b(self): print self.x i = ab() i.a() i.b() # this works, why no lexical scoping? -- http://mail.python.org/mailman/listinfo/python-list
New Python 3.0 string formatting - really necessary?
I have not worked with Python enough to really know. But, it seems to
me that more I look at python 3.0, the more I wonder if it isn't a
step backwards.
To me, it seems that this:
print "%s=%d" % ('this',99)
Is much easier, and faster, to type, and is also easier to read and
understand. It also allows people to leverage their knowledge of C.
This (if it's right) is much longer, and requires more special
characters.
print( "{0}={1}".format('this',99))
Maybe it's worth all the extra trouble, and breaking backward
compatibilty, and all. But, I never had the idea that the old way was
all that big a problem. Of course, I could be wrong. Was the old way
all that big of a problem?
--
http://mail.python.org/mailman/listinfo/python-list
Re: New Python 3.0 string formatting - really necessary?
On Dec 19, 9:13 am, "Giampaolo Rodola'" wrote: > You can use the old 2.x syntax also in Python 3.x: Yeah, but it's deprecated, and - as I understand it - may be removed completely in future versions. Also, in the future, if you are working with code from another developer, it's likely that developer will use the new format. I suppose you can use both - but what an awful mess that would be. It seems to me that 3.0 is changing a lot of non-problems. And it's going to be slower to boot. -- http://mail.python.org/mailman/listinfo/python-list
WAGs on when django will use Python 3.0?
Will Django be primarily using Python 3.0 one year from now? Two years from now? Any WAGs? -- http://mail.python.org/mailman/listinfo/python-list
Re: New Python 3.0 string formatting - really necessary?
On Dec 19, 12:43 pm, excord80 wrote:
> Also, I like having only *one* special symbol (`%') to worry
> about in my strings instead of two (`{' and `}').
>
Actually the new way has, at least three special symbols: ( '{', '}' ,
'.') as well as the method name "format" so
"%s=%s" % (k, v) for k, v in params.items()
becomes:
"{0}={1}".format((k, v) for k, v in params.items())
or something like that.
--
http://mail.python.org/mailman/listinfo/python-list
Re: New Python 3.0 string formatting - really necessary?
On Dec 19, 10:25 am, Michael Torrie wrote: > Personally the new string formatter is sorely needed in Python. Really? You know, it's funny, but when I read problems that people have with python, I don't remember seeing that. Loads of people complain about the white space issue. Some people complain about the speed. Lots of complaints about certain quirky behavior, but I have not come across any complaints about the string formatting. In fact, from what I have seen, many of the "problems" being "fixed" seem to be non-problems. I dunno, maybe it's just me. -- http://mail.python.org/mailman/listinfo/python-list
Re: New Python 3.0 string formatting - really necessary?
On Dec 19, 10:55 am, [email protected] wrote: > Regarding the speed of Python3 programs, > they will go faster "The net result of the 3.0 generalizations is that Python 3.0 runs the pystone benchmark around 10% slower than Python 2.5. " http://docs.python.org/dev/3.0/whatsnew/3.0.html > (Ruby programs are often slower > than Python ones (because Ruby > is a little higher level than Python) As I understand it, that may have been true at one time. But, Ruby 1.9 very significantly sped up the language. While Python has been made slower, Ruby has been made much faster. I am no expert on the subject, I am just going by stuff I have read on web. -- http://mail.python.org/mailman/listinfo/python-list
Re: New Python 3.0 string formatting - really necessary?
On Dec 20, 4:34 pm, r wrote: > Walter, > > Would you be kind enough to translate this code to the new syntax? I am sorry, but I just don't know the new syntax well enough. I am not sure if the examples that I have posted, so far, are correct. -- http://mail.python.org/mailman/listinfo/python-list
Re: New Python 3.0 string formatting - really necessary?
On Dec 20, 5:05 pm, Roy Smith > He got really hung up on the % syntax. I guess it's good to know that there is, at least, one person in the world doesn't like the % formatting. As least the move was not entirely pointless. But, you must admit, of all the things people complain about with Python, the % formatting is probably one of the least common complaints. Complaints about Python's speed seem much more common. Yet, 3.0 makes the speed worse, and "fixes" a non-problem. I can see where the new formatting might be helpful in some cases. But, I am not sure it's worth the cost. -- http://mail.python.org/mailman/listinfo/python-list
Re: New Python 3.0 string formatting - really necessary?
On Dec 21, 12:28 pm, Bruno Desthuilliers wrote: > Strange enough, > no one seems to complain about PHP or Ruby's performances... A few years back, there was a certain amount of chest thumping, when python/django easily beat ror in a benchmark test. Now that ruby is faster, I guess speed is no big issue. By the same reasoning, python advocates used to sneer at php because php constantly broke backward compatibility. Now that python does it, breaking backward compatibility is no big deal. I guess unicode support was not that important, until python caught up to perl. I guess, the way it works is: you first assume that python is superior, then you figure out why. -- http://mail.python.org/mailman/listinfo/python-list
Python's popularity
I have read that python is the world's 3rd most popular language, and that python has surpassed perl in popularity, but I am not seeing it. >From what I have seen: - in unix/linux sysadmin, perl is far more popular than python, windows sysadmins typically don't use either. - in web-development, php is far more popular than python - it's not even close. - when I did a search on dice, I found over 20X more jobs advertised for ruby on rails developers, than for python dango developers. - application development is dominated by java, c/c++, and maybe a little visual basic. - as I understand it, fortran is still the most popular language for numberical programming. Of course, these are just observations on my part, nothing scientific about it. But, I can't help but wonder how python's popularity was determined. I suspect that a lot of people use python as a secondary skill. For example, I use ms-word, but I'm not an ms-word professional. Please note: I am not confusing popularity with quality. I am not saying that php is better for web-dev, or anything like that. I am just wondering how python is rated as being so popular, when python does not seem to dominate anything. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python's popularity
On Dec 22, 10:13 am, r wrote: > Since the > advent of Ruby(Python closet competitor), Python's hold on this niche > is slipping. About the only place I ever hear of ruby being used is web development with RoR. When it comes to web development, it seems to me that ruby (because of rails) is far more popular than python. It seems to me that ruby is the niche player, and python (with fairly new frameworks) is trying to catch up to ruby in that niche. It seems to me that the python web framework that best competes with rails, is Django, and Django 1.0 just came out a few months back. > A lot of Ruby noobies don't even realize that most of > Ruby is an out-right plagiarism of Python. Maybe. But the rails framework seems to have a different philosophy than the django, turbogears, or pylons, frameworks. RoR values convention over configuration, and has a lot of "magic" whereas the python frameworks seem to have the opposite philosophy - in those regards. I see pros and cons to both approaches. I wonder what the market with think? > Now since Python *is not* the only language on it's block, we have to > compete with our main nemesis(Ruby) for survival I think both python and ruby will "survive." I think python is also competing with perl in the sysadmin space - although I see perl as being much more popular there. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python's popularity
On Dec 22, 11:42 am, "Ellinghaus, Lance" wrote: > Yes, Ruby has taken some of the popularity out of Python, but they are > also hitting different markets. Do you mean different markets within web development, or do you mean ruby is used mostly for web-dev, while python is used for other stuff? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python's popularity
On Dec 22, 11:50 am, Bruno Desthuilliers wrote: > > When it comes to web development, it seems to me that ruby > > (because of rails) is far more popular > > s/popular/hyped/ I'm not so sure. Go to dice.com, enter "ruby rails" no quotes, search all words, job titles only - I got 86 hits, and another five hits when I searched for "RoR." Do the same search, but substitue "python django" for "ruby rails" and I get 3 hits. Doing the search for just "ruby" and I get 121 hits. Doing the search for just "python" and I get 61 hits. Just "rails" and get 94 hits, just "django" and I get 4 hits. Not scientific, but there is substantial difference. > Fooled by version numbers ? No, but I am giving django the benefit of the doubt. The django project told people all along that django was not to be considered production ready before 1.0. I will accept that some people decided to wait until 1.0 came out to do any production development. Maybe django is only lagging because 1.0 just came out? > My actual CTO is a big Ruby/Rails fan, yet he settled on Python/Django > for our current 'big' project. Wonder why ? Not knowing much about RoR: yes, I wonder why? Is it because python has a cleaner syntax? Or what? -- http://mail.python.org/mailman/listinfo/python-list
Re: New Python 3.0 string formatting - really necessary?
On Dec 21, 12:28 pm, Bruno Desthuilliers wrote: > > I can see where the new formatting might be helpful in some cases. > > But, I am not sure it's worth the cost. > > Err... _Which_ cost exactly ? Loss of backward compatibility, mainly. -- http://mail.python.org/mailman/listinfo/python-list
