Considering moving from Delphi to Python [Some questions]
Hi, We program in Delphi in our shop and are generally very happy with it. We are now looking at cross-platform options especially for middle tier and web server. I have been doing a lot of reading and testing of Python, I am falling in love with the language :-) But seems to be be very difficult for what I am trying to do :-( So looking for advise here We would like to work as following. Front ends in Delphi. Middle tier in Python working as SOAP servers: Serious work on Twisted needed here ?elementree? are there any other options. Lots of learning to do. Doesnt seem to be simple way to do this. Most of our applications are business applications so we basically we want to do a lot of data entry forms including entry in grid like interfaces etc. At this point i am looking at nevow with twisted. Again lot of learning to do here. darkcowherd -- http://mail.python.org/mailman/listinfo/python-list
Re: Considering moving from Delphi to Python [Some questions]
Stupid of me. I want some feedback on folllwing: anybody who has experience in writing SOAP servers in Python and data entry heavy web applications. Any suggestions? darkcowherd On 7/4/05, Dark Cowherd <[EMAIL PROTECTED]> wrote: > Hi, > > We program in Delphi in our shop and are generally very happy with it. > We are now looking at cross-platform options especially for middle > tier and web server. > > I have been doing a lot of reading and testing of Python, I am falling > in love with the language :-) > > But seems to be be very difficult for what I am trying to do :-( > > So looking for advise here > We would like to work as following. > > Front ends in Delphi. > Middle tier in Python working as SOAP servers: > Serious work on Twisted needed here ?elementree? are there any other > options. Lots of learning to do. Doesnt seem to be simple way to do > this. > > Most of our applications are business applications so we basically we > want to do a lot of data entry forms including entry in grid like > interfaces etc. At this point i am looking at nevow with twisted. > Again lot of learning to do here. > > > darkcowherd > -- http://mail.python.org/mailman/listinfo/python-list
Re: Should I use "if" or "try" (as a matter of speed)?
http://www.joelonsoftware.com/items/2003/10/13.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Should I use "if" or "try" (as a matter of speed)?
> > def joels_function(args): >error_result = 0 >good_result = None >process(args) >if error_condition(): >error_result = -1 # flag for an error >elif different_error_conditon(): >error_result = -2 >else: >more_processing() >if another_error_conditon(): >error_result = -3 >do_more_work() >good_result = "Success!" >if error_result != 0: >return (False, error_result) >else: >return (True, good_result) > > > and then call it with: > > status, msg = joels_function(args) > if status == False: >print msg ># and fail... > else: >print msg ># and now continue... > > > This is how I would write it in Python: > > def my_function(args): >process(args) >if error_condition(): >raise SomeError("An error occurred") >elif different_error_conditon(): >raise SomeError("A different error occurred") >more_processing() >if another_error_conditon(): >raise SomeError("Another error occurred") >do_more_work() >return "Success!" > > and call it with: > > try: >result = my_function(args) >print "Success!!!" > except SomeError, msg: >print msg ># and fail... > # and now continue safely here... > > > In the case of Python, calling a function that may raise an exception is I tend to use exceptions, but I think Joel has a point. Taking the example code that you have given above. Let us assume that somebody else is using my_function and DOES NOT write a try except block. This code will run fine except, when the exception is thrown and it will suddenly pop up in some other error handler which may not be handling the situation correctly. You have to plan and create a series of errorhandling classes to handle such situations. However Joels_function forces the caller to write some kind of error handler. If he doesnt write the program will not run. After reading that I have been giving this option some thought. The nice thing about Python is I can easily return tuples. In C++ you have to jump through hoops because you cant return two values easily. DarkCowherd -- http://mail.python.org/mailman/listinfo/python-list
Why does reply to messages on this list put the sender in the To
Most lists when i hit reply it puts the list address back in the To address and some lists allow you to configure this. But in this list reply sends the mail back as a private mail and there seems to be no option to configure this. Am I missing something DarkCowherd -- http://mail.python.org/mailman/listinfo/python-list
Fwd: Should I use "if" or "try" (as a matter of speed)?
I use Delphi in my day job and evaluating and learning Python over the weekends and spare time. This thread has been very enlightening to me. The comments that Joel of Joel on Software makes here http://www.joelonsoftware.com/items/2003/10/13.html was pretty convincing. But I can see from the comments made by various people here that since Python uses Duck typing and encourages typless styles of functions exceptions may actually be the better way to go. But one advise that he gives which I think is of great value and is good practice is "Always catch any possible exception that might be thrown by a library I'm using on the same line as it is thrown and deal with it immediately." DarkCowherd -- http://mail.python.org/mailman/listinfo/python-list
Re: Help with inverted dictionary
As Steven said this looks too much like home work But what the heck I am also learning python. So I wrote a small program. A very small program. I am fairly new to Python, I am stunned each time to see how small programs like this can be. Since I am also learning can somebody comment if anything here is not Pythonesque. dictwords = dict() for line in open('testfile.txt','r'): for word in line.rstrip('\n').split(): dictwords.setdefault(word,set()).update((line.rstrip('\n'),)) for wordfound in dictwords.items(): open(wordfound[0],'w').write('\n'.join(wordfound[1])) -- http://mail.python.org/mailman/listinfo/python-list
Re: Fwd: Should I use "if" or "try" (as a matter of speed)?
OK, I can see that the Python way of doing things is very different. However I think Roy made a very pertinent point "Imagine if do_setup_code or do_stuff_with(f) unexpectedly threw an IOError for some reason totally unrelated to the file not existing." This is the kind of situation that the rule 'catch it on the next line' is trying to avoid What I didnt realise till I read Thomas comment is that the try except had an else clause. This is nice. But seriously, if you expected to write reasonably large business applications with multiple people in the team and teams changing over time what would you give as a guideline for Error handling DarkCowherd -- http://mail.python.org/mailman/listinfo/python-list
Re: email format in python
This seems to give reasonable results. import re pattern = r'[EMAIL PROTECTED],4}\b' pattobj = re.compile(pattern) ps = pattobj.search if ps(stringtocheck): But as lots of people have already told you on this list. This should only be used to give a warning and not prevent the use of that particular address. DarkCowherd -- http://mail.python.org/mailman/listinfo/python-list
Re: What is your favorite Python web framework?
Hi, I have also been looking around to start web development. Almost everybody says - "Zope h steep learning curve", so looking at alternatives. But to people have got past that curve. Is Zope worth it. My applications would be data entry heavy. Think inventory and accounting apps. Would going past the learning curve allow me to write applications like that. -- Dark Cowherd -- http://mail.python.org/mailman/listinfo/python-list
Re: smtplib
On 7/19/05, Alberto Vera <[EMAIL PROTECTED]> wrote: > Hello: > > Do you know If the smtplib routine have been changed in last releases? > > I used this script: > > http://docs.python.org/lib/SMTP-example.html > > but it didn't work with the last release. > > Do you know any idea about this change? > > Regards > > -- > http://mail.python.org/mailman/listinfo/python-list > > If you are using Windows there is no SMTP server running on localhost by default so you may be getting an error. If you post the error you are getting it may help -- Dark Cowherd -- http://mail.python.org/mailman/listinfo/python-list
Re: Python vs. Access VBA
> better to go with SQLite. Its cross platform and well proven. I think > Firebird will give you that too, though I have never used it. > Firebird is a great option, cross platform, it can work like access without any server running, using embedded mode to a full blown server which can handle terabytes of data. -- Dark Cowherd -- http://mail.python.org/mailman/listinfo/python-list
Re: Getting a dictionary from an object
> voiceless-ly'rs What does this mean?? Just curious (googled that and ly'rs and didnt find anything relevant) -- Dark Cowherd -- http://mail.python.org/mailman/listinfo/python-list
Re: First app, thanks people
Hmm, I was looking at the code as I am also learning Python. In case you are interested in bug report. class LineTool method OnLeftUp needs self.done = True or else if you are in Line mode and you just click with out moving the mouse you get an error. DarkCowherd -- http://mail.python.org/mailman/listinfo/python-list
Re: [Pythoncard-users] Grid problems
> > info = dbc.fetchall() > > > self.dbTable=DBTable(¿?¿?¿?¿?) ß here is where I have problems, I > used cursor, argument but no data shown > Hmm, Not sure, but isnt the data in the variable 'info' try self.dbTable = info -- Dark Cowherd -- http://mail.python.org/mailman/listinfo/python-list
Re: Ten Essential Development Practices
I am new to Python. I tried it out and think it is fantastic. I really loved this from import this statements: There should be one-- and preferably only one --obvious way to do it. But this not true of Python. GUI, Web development, Application Framework - it is shambles. It is so frustrating for a person who comes from a well designed environment / framework like Delphi. -Quote - Phillip J. Eby from dirtsimple.org Python as a community is plagued by massive amounts of wheel-reinvention. The infamous web framework proliferation problem is just the most egregious example. Why is Python "blessed" with so much reinvention? Because it's often cheaper to rewrite than to reuse. Python code is easy to write, but hard to depend on. You pretty much have to: 1. limit yourself to platforms with a suitable packaging system, 2. bundle all your dependencies into your distribution, or 3. make your users do all the work themselves Ouch. No wonder rewriting looks easier. The only way to stop this trend is to make it easier to reuse than to rewrite, which has been my mission with setuptools and EasyInstall -UnQuote My organisation writes products for Small and Medium Enterprises. We are using Delphi, we want to do more web based and Linux solutions, so I was evaluating Python, but even though I love the language and will probably do hobby programming using the language, I wouldnt really recommend our organisation to plan and execute a tranisition. We have been around a while and we have planned and done transitions from Clipper to FoxproW to VB to Delphi. >From what I understand Database access was in similar shambles in Python but a SIG took up the task and made some decisions which has now streamlined database access in Python. I really would love to have a Python where TOOWTDI Is there some place to discuss topics like this? Is this the right place? -- DarkCowherd -- http://mail.python.org/mailman/listinfo/python-list
Python language ver 2.4 , development platform 0.4
The Python language is at ver 2.4 and a thing of beauty. As a development environment IMHO it is probably 0.4 I really like what I read when I say "import this" in Python. But as a development environment - TOOWTDI and "batteries included" are just not true. I would like to place my position in context. I work in a bread and butter development shop. There are one or two competent long term programmers. The others are freshers or average programmers who join and leave after a year or two etc. But we develop business products and projects for small companies. The natural development environment for companies like us are products like VB or Delphi. We wanted to move towards Linux instead of being purely Windows - centric. So I evaluated Python. This is the impressions I got. It is a hyper-productive environment for the following scenarios. Utilities - fetchmail being a prime example Really futuristic programming paradigms - an example being http://kamaelia.sourceforge.net/Home Large in house programming projects - Just a feeling I have, but I felt that most of the frameworks were scratchin the itch in such scenarios and they got released as open source projects. For a bread and butter programming shop Python looks like Shambles. Until TOOWTDI for GUI, 3 tier applications, Web applications are in place I would hesitate to jump in for day to day use. Calvin had pointed out WSGI and the anygui package. But long way to go. I have looked at DABO, it is impressive. So there are signs that things are going in the right direction but still I feel it is somewhere around 0.4 Small projects, utilities which I am going to code myself I will continue to use Python because I love it. I hope to learn Python well enough to be able to contribute to some projects to achieve this. But I still see that as six to nine months away. -- DarkCowherd -- http://mail.python.org/mailman/listinfo/python-list
Standards not standard
Hi, Multiple threads running currently about reinventing the wheel, Multiple GUI's etc. Being able to write a usable GUI is key task for all programmers today - read. ESR's http://www.catb.org/~esr/writings/cups-horror.html And look at ESR's reason to come over to Python - he wanted to write a GUI !!! I love the Delphi Environment and the Python language. So I would like to share here why I find the Delphi environment so productive. They have taken key concepts and defined standards for them and shipped a default implementation. To illustrate - They have the concept of a TDataset which is sort of like a cursor in the DBAPI. They have their default implementations but ANYBODY can write their own class which is TDataset compatible. Then they define how widgets should interact with TDataset. Now anybody can write a widget which interacts with any TDataset. So this means that anybody can write a widget and know that it will work with any Dataset. There are literally hundreds of open source projects using Delphi - You can take any open source widget that you like and hook it up with any open source TDataset that you like. It will work first time without any problem. And a sort of MVP is inbuilt. You can for example tie a dataset with a chart and grid on the same screen. Type in the grid and see the chart change. All this with zero code. Made my eyes bug out the first time I saw this. Wishful thinking here about Python. Suppose I like templating system from framework A. but prefer framework B. What if I could drop the existing templating in Framework B and use the templating from A. Somebody pointed out Java is just as "bad' with lots of Web frameworks but the key here as mentioned in http://www.python.org/peps/pep-0333.html is interoperability. I think the Python community did a great job with DBAPI 2.0 Rather than more code projects the community should work towards putting interface standards in such a way that for e.g. I could use Zope's templating and twisted as framework and kinterbas for data access and it should all work together because all of them are writing to the same standards. The language is so elegant with introspection and mixins and so many other things. And nowdays the pattern community has helped us all focus so much on designing for interoperability. I really think that the community needs a lot more of STANDARDS not a STANDARD GUI Just my thoughts. -- DarkCowherd -- http://mail.python.org/mailman/listinfo/python-list
Re: Standards not standard
> > I really think that the community needs a lot more of STANDARDS not > > a STANDARD GUI > > Standards happen in one of two ways. Either an 800-lb gorrilla > establishes them by fiat, or a group of people interested in having > their code play well together hashes out something after they've all > taken a crack at implementing it. The latter is slowly happening in > the Python community. But it's a slow process. > > -- OK let me talk in specifics instead of abstractions. Lets take a GUI. Consider something like wxGlade or XRCed which generates a XML resource file and then wxPython works from it. Suppose the python community works on defining a standard XML resource file. Then all wrappers for GUI libraries in Python can optionally support this XML resource file. So if you are unfortunate enough to have to develop GUI applications :-) you use the standard XML resource file and pick the wrapper and the toolkit that you like. Then for some reason - you have to switch wrapper or toolkit - you dont have a major crisis, you only have a minor crisis. ;-) Of course the wrappers and toolkits are free to provide additional functionality which the developers using those toolkits may or may not choose to use. I think this is what has happened with the DBAPI 2.0 for e.g. kinterbasdb provides DBAPI 2.0 compliant methods for access to firebird and also other non-standard methods. This is a GOOD THING and my suggestion is that this GOOD THING must propogate into other areas like GUI and the Web Toolkits. -- DarkCowherd -- http://mail.python.org/mailman/listinfo/python-list
UCALC equivalent
http://www.ucalc.com/mathparser/index.html There is a great library called UCALC which allows you to set up an expression and evaluate it for e.g. you an define an expression by calling a function in UCALC then call it with various values of x for e.g. see this page http://www.ucalc.com/mathparser/sample6.html It is very fast. I have used it in VB when there is lot of number crunching to be done. Is there a Python equivalent. I looked at numPy and SciPy sites (just skimmed through) did'nt seem to have what I wanted. Any pointers? -- DarkCowherd -- http://mail.python.org/mailman/listinfo/python-list
Re: UCALC equivalent
thx, Well moving to Python from another language needs lots of chanegs inside your head. -- DarkCowherd -- http://mail.python.org/mailman/listinfo/python-list