|
Python Webware is kind of nice for a pretty straight J2EE/Tomcat style servlet system. Nice folks too. Also, if coding for it Think ahead, about how your doing database. This poo poo is multithreaded and therefore has gotchas.
|
# ¿ Nov 5, 2007 17:05 |
|
|
# ¿ Apr 28, 2024 03:58 |
|
Triple Tech posted:What's the Python community like? Do you guys really hate Perl? And have you ever heard of or used SQL Alchemy? Don't really interact with the Python community a lot. I guess folks who really 'think' pythonic tend to see PERL as extremely clumsy and inelegant. Sort of a huge chainsaw to pythons clean scalpel. But most of us admit that sometimes when theres a wall, the Chainsaw will bust that hole pretty drat fast. It'll just be an ugly hole. That and turf war nonsense.
|
# ¿ Nov 5, 2007 17:41 |
|
The other method is to just ask the objectcode:
duck monster fucked around with this message at 23:36 on Nov 12, 2007 |
# ¿ Nov 8, 2007 00:43 |
|
Threep posted:Convince me to learn Python! I can convince you really easy. Do this tutorial;- http://docs.python.org/tut/tut.html It'll take you a few hours to an afternoon At the end of it you combine that knowledge with this page;- http://docs.python.org/modindex.html And you are now full bottle. Thats the convincing. If you can't program python vaguely competently in a couple of days, you probably are not a coder. Its that easy. Its all about objects, lists, dictionaries and tuples
|
# ¿ Nov 12, 2007 23:31 |
|
m0nk3yz posted:Nice, I totally missed that one. I am quite happy with what's coming down the pipe for py3k Ah. Nice. Much more elegant than the get_foo set_foo stuff. I'm really keen on this decorator stuff. Lots of oportunities for aspect coding type stunts.
|
# ¿ Nov 13, 2007 09:06 |
|
Yeah. Threading isn't really pythons strongest point. I think most people in the Python community pretty much acknowledge that. The reason isn't so much interpreter development, its to do with module development. Linking C libs into Python is pretty simple, but you do have to pay attention to the garbage collection. However, things get... messy... when you start threading (As they do in C). The GIL stops this messyness by putting some nice big locks in there to keep stuff sane re Garbage collection and its ilk. You certainly apreciate it when embedding python. But it is a problem, and one that really wants some thought put into fixing. For what its worth, I tend to use stackless python for multithreading stuff these days. That poo poo scales like crazy. I mean, insane-loving-lala crazy. Coroutines rock.
|
# ¿ Nov 19, 2007 08:12 |
|
Hammertime posted:I'm googling stackless python but I'm not turning up anything that useful. Stackless implements continuations and co-routines. Prepare for your head to explode. Basically a continuation is like a 'save point' in a game, although within the context of execution. Its sort of like saving the current state, then loving off and doing something else, so you can return later , refire execution and continue where you left off. co-routines are a species of continuation. I probably can't explain them well, so wikipedia them. What stackless lets you do is implement 'green threads', where essentially you supply your *own* scheduler and run potentially tens of thousands of microthreads within a single thread. They scale pretty much Big-O(1) and when a thread isnt doing anything they require zero cpu time. You really can go apeshit with threads and not worry too much about the performance overhead. A good example here would be a web server Picture this: code:
It sets x to 10 then fires off a page that says "value = x" The page then saves its continuation and lets the server do other poo poo When the link (Next) is pressed, it wakes up the continuation, increments x by 10, fires off another page, then falls asleep again, and so on till it gets to the return, and it closes the thread. Now the fun part of continuations (And alas it doesnt work so well in the current stackless I *think*, is you should be able to hit the back button, and since the continuation identifier now points to the old page, it'll roll back the execution context, and re-run the code from that point in its history. Scary huh? Seaside (A smalltalk based system) uses that extensively. For multi-page forms, its erection inducing, because maintaining state gets *MUCH* easier. It also completely flies in the face of much commonly held belief on internet best pracice. gently caress em. The point being, is it allows you to implement cooperative multithreading in an extemely lightweight manner, that scales like a motherfucker. And no it doesnt handle multiple cores well. Yet. I guess they are working on that. No idea about the GIL. duck monster fucked around with this message at 08:22 on Nov 20, 2007 |
# ¿ Nov 20, 2007 08:20 |
|
Yup. Thats the magic of python. Dictionarys, lists and tuples. So simple, and yet so expressive. Sure you can do it in other languages, but python makes it so elegant. Also, Py-game is a really fun library. Aeons ago I wrote a little game that I never finished based on a really spastic take on eve-online (Called something like "goonie lagsplot 2d" or something absurd). Although I never really bothered beyond about 4 or 5 pages of code it was loving fun to write what I wrote, and the prototype was actually kind of fun. I could see it being very easy to write a 'real' 2D game in it. What would be *real* cool would be a python version of Delphis old GLScene library. Open GL coding gets really drat cool when its turned into a first class OO library.
|
# ¿ Nov 21, 2007 02:15 |
|
Yeah. I tend to use pydev, partly because I basically try and use eclipse for everything. Its just what I'm used to. Its a loving shame that boa-constructor got shanked by a dev who doesn't seem interested in letting anyone else contribute. It would of been a spectacular IDE had it been allowed to flourish.
|
# ¿ Nov 28, 2007 16:27 |
|
I now have this strange urge to start filling my code with clown decorators.
|
# ¿ Jan 9, 2008 02:37 |
|
Himmit posted:This thread will be useful. Thats one of the biggest joys of python. It really aint hard. I learned python maybe ten years ago , slacking off at work one afternoon doing the tutorial. It was like a huge succession of lightbulbs going off above my head. Then it was straight over to the modules section, and before long I was cranking out all sorts of stuff. Fantastic. The second joy was learning the fine details of the object orientation. Python is such a good language.
|
# ¿ Jan 9, 2008 02:43 |
|
LuckySevens posted:Hey guys, I've started learning Python as my start to beginning to learn programming, hopefully I'll have the staying power to learn a thing or two. Is it alright if I post really newbie questions here? Do the tutorial on the Python site in the standard documentation. Its a ripper. Any confusion over big-word stuff, pipe up in here. When you finish it, muck around with the modules (see module help on site), of for something more fun check out the pygame module, or if its your thing, something like Django (web stuff)
|
# ¿ Jan 23, 2008 19:10 |
|
Ugg boots posted:py2exe is a bitch for pygame, though, by the way (there is a like pygame2exe or something, but it's hard to configure.) How? Every time I've used it with pygame stuff, it just sort of magically works for me. There doesn't seem to be any extra configuation required.
|
# ¿ Jan 30, 2008 15:51 |
|
deep square leg posted:cLin: I don't think you can go past the official Python tutorial, at least to start with. The essential reading list linked earlier by m0nk3yz looks good, but I haven't read all of what it suggests, yet. Yeah I think everyone hates that part. Its like you take a beautiful language and lay a gigantic turd into the middle of all that beauty. But....... Guido knows best. I'm sure he's sitting on his magical throne watching this and saying "Ah Ducks, you'll understand it one day <insert monty python joke>"
|
# ¿ Feb 10, 2008 03:45 |
|
Webware for Python is in beta for 1.0 FINALLY This is a great stack for more traditional Tomcat style servelet style development. I love it. Its got a PSP implementation in there (Think PHP or ASP but with python) , a full persistant servlett stack, Kid templates , authentication stacks, OODB abstaction, you name it. Compared with Django and the like , this bad boys a grandfather of the scene, its been that long brewing. http://www.webwareforpython.org/ Honestly after using this for servlett apps, just mentioning Tomcat gives me the heebee-jeebees. Its just nicer with python.
|
# ¿ Feb 10, 2008 17:13 |
|
I really loving wish the Python people would use an open source compiler (ie gcc) for its windows distros. It pisses me off into near nerd-rage when I need to compile poo poo for windows but woops don't own Visual studio, and I can't get it to work with the express one worth poo poo. This has been a show stopper for me numerous times now, and makes me want to summon robot-stallman to shoot motherfuckers dead.
|
# ¿ Feb 17, 2008 15:50 |
|
Because it then breaks compatibility with all the other stuff people have compiled in MS C++ And if you don't have the sources, your boned.
|
# ¿ Feb 17, 2008 18:38 |
|
Zcientista posted:Why is that once I run a script in IDLE the text highlighting disappears? Is there any way I can turn it on again? Really? I havent seen that before. I wonder what causes it. Hey, if you get a chance, play with iPython. Its loving wonderful. If you run it on windows, be sure to set up Readline libs, but if you do its amazing, and if there was a way of making it work inside of idle, it'd make idle into gods own python environ. (Well, if I could get idle running as the shell in eclipse python, I'd probably consider that it).
|
# ¿ Feb 19, 2008 00:23 |
|
fletcher posted:I'm very curious about Python. I've never used it, but can't help but see everybody praising it, while everybody puts down PHP. I figured I might as well give it a whirl, but I was wondering if anybody had a good comparison of how something is written in PHP vs what the equivalent would look like in Python, specifically geared towards web development. PHP isn't really as bad as its made out, at least not v5 onwards. The latest Object model is actually pretty close , but not quite (in a few key ways) to python. PHP is however a pretty focused little web language, but not really that good for much else, in comparison with other languages. I think the more interesting comparison is Perl v Python. I had it described like this. Perl is a chainsaw, Python is the surgeons scalpel. A Chainsaw will amputate a leg much faster than a scalpel, but the scalpel will do a cleaner job of it. Now contrast and compare with cutting down a tree. Python is elegant, and conservative. Its simple minded as well, and thats a good thing. You'll quickly come to apreciate how python achieves so much, in so small an amount a code with such a small but highly powerful number of primatives. But its a bit more of a bitch if you want to write 'line noise' regex heavy stuff.
|
# ¿ Feb 26, 2008 02:43 |
|
fletcher posted:What makes it not as good as python for a command line application? I've only done very basic things on the command line with php, but Python looks like it would be a lot more useful since it has GTK support. Its just better focused on the task. Pythons got a very clean model, and its designed all sharp like for that sort of thing. Truth is, its a generally better language. Not to say PHP can't do it. But there stuff php simply can't do as well, like threading , or pythons funky itterators and generators, and so on. But PHP is a fine web language as far as I'm concerned.
|
# ¿ Feb 26, 2008 16:48 |
|
I just made thiscode:
code:
Also the order it puts elements is MAGICAL just like harry potter or a unicorn.
|
# ¿ Feb 28, 2008 04:56 |
|
Oh I'm aware that the expectation of ordering is not a good one, but its annoying, since a handy little guide to ordering is provided by the structure provided.
|
# ¿ Feb 29, 2008 03:41 |
|
PnP Bios posted:I'm using python with pySerial and wxWidgets to do some pretty sweet stuff with GPS devices. I just have to say that wx for python is amazingly simple to use. I love it to pieces. track down boa constructor. its a bit rusty, which is a shame because it would be loving fantastic otherwise. However its a really competent gui designer and generates nice and clean code. But due to its buggyness I'd recomend once designing the gui, using something else to finish it off. Crashing and losing code sucks. If the guy working on it wasnt so drat insular and let it open up a bit, it could be a 'killer app' in the python world as a full delphi-like system.
|
# ¿ Mar 2, 2008 14:18 |
|
I can't help thinking that if you need 150 worksheets, you havent really put enough thought into how the data is being represented. Could this be easier done with a disposable database, maybe in an MS Access container so the client can open it up and noodle around with some macroed up forms and poo poo? Anyway, if its the way its gotta be, wheres the leak? Pythons reference counted, so if you get circular references or whatever, you can lose memory with stuff if your not careful. Manually delete objects when your finished and see how that works out. If its at the Excel side, you might be poo poo out of luck, but if its at the database side, I'd suggest getting all funky with cursors and break the processing up a bit. duck monster fucked around with this message at 20:24 on Mar 11, 2008 |
# ¿ Mar 11, 2008 20:22 |
|
Mighty Germ posted:does python not have a do ... while looping structure? code:
code:
|
# ¿ Apr 11, 2008 09:58 |
|
Mighty Germ posted:In the interactive interpreter, you can do this or use the helper function help(<thing>) where thing can be a module, object, function , class, or whatever. combine with dir(<thing>) to peek into somethings internal organs, and you've got all your documentation right there. That said, I personally find the documentation on the python website excelent.
|
# ¿ Apr 18, 2008 01:09 |
|
outlier posted:A database security / access question, for which I want a Python solution: I tend to use decorators. Like just make a decorator that encapsulates an @acl type function. However, yes, views are another way of tilting at the issue. I just suspect it could get a bit sticky if you get too complicated with them.
|
# ¿ Apr 24, 2008 05:49 |
|
Lancer383 posted:Not sure why you're having that issue with the print command -- have you tried using sys.stdout.write(string)? In your example it would be: What would you gain from that? Anyway. Try this;- code:
|
# ¿ May 1, 2008 15:39 |
|
Can someone fix that fugging faq. Python was not designed as a teaching language. It was designed as a scripting language for Andrew Tannenbaum's Amoeba Operating system, which is where I first heard of it many many moons ago.
|
# ¿ May 1, 2008 16:53 |
|
bosko posted:Has anyone gotten PayPal IPN working with Python? For the life of me I can't figure out what I am doing wrong when I have simply taken the idea from another (working) script and used it in my own. Paypal are the devil. Do not trust your business to those cunts. Seriously, I blame their worthless system for my current unemployment.
|
# ¿ Jul 8, 2008 18:51 |
|
Flea110 posted:I've spent the last week or so writing a battle simulator for the board game Axis & Allies. I'm fairly new to programming, and it's my first program that uses classes. Its not bad, but I get the feeling your still sort of writing structured code just wrapped in objects. Its still a valid way of coding, but its not the best way. Heres how to look at objects and do it right;- Disclaimer: I'm an OO Design zealot, so take this with moderation if you don't want to grow an absurd neckbeard and start developing erections at the mere mention of smalltalk. An object is a little black box, that you can make lots of copies of, and it has properties and methods. Methods being best thought of as "code that happens when an object is sent a message" (You send the message by calling the method). All understood right? One needn't care whats *in* the black box, as long as the properties and methods behave as expected. A black box is a model of a thing, an object , so to speak. Your program is an object. The Countries are objects, the board pieces are objects. The players are objects And so on. So you might for instance write a country object that has a property like "who is occupying me?" and "How many troops are here". And then perhaps add methos like "add_troops([list of troop objects],player,where_troops_came_from)" or "send_troops([list of troop objects],player,where_troops_go_to)", then maybe methods like "calculate_sovereignty" and "make_dudes_fight" or whatever and so on until you have a model of how a country in the game follows the rules and gains/loses sovereignty and so on. Then you do the same for troops/units And add a player object (maybe you make this first) and finally add a game object that controls and contains all the other guys. With all that finished you might then create some objects that interact with the user. It does sound like more work, but once you get the hang of it, its really intuitive, and it becomes second nature, and it fits neatly with the sort of methodologies you might work with in the 'serious programming world' like unit testing and UML and poo poo like that.
|
# ¿ Jul 8, 2008 19:02 |
|
ATLbeer posted:Has anyone had a good experience with a messaging package? The XML-RPC library is astonishingly effective and simple to use. poo poo. Its a shame you didn't ask this 6-7 months ago, I wrote an awesome system that did precisely this. Central logging system with a web interface, switchable logging levels, all sorts of statistics, and a big bag of interfaces to talk to it in various languages. (PHP, Python, Perl, C). The boss let me LGPL it all, but when I quit the job I never took a copy of the code, and I did my usual and burnt the bridge with a flamethrower, so I probably can't get it for you. But heres how it basically worked;- Make a simple daemon (just descend from Simple xml server class) that takes messages, and poo poo them into a database. Get out Django, or poo poo even PHP if you wish, an punk out a little web interface to it. An then just make a little includable library to catch errors and fwd them across to the daemon.
|
# ¿ Jul 31, 2008 12:43 |
|
Centipeed posted:For this exercise, can't I just store the list in a text file with simple markup? A database seems like overkill, even it is is only SQLite. Yes, and your idea is fine. Make a base class that has a __str__ function that shits out a pickle of the data. Put the classes in a hash indexed by , I dunno, whatever you think a good scheme to key it all is, and then to save and load it, just do something like open file () for each record in the hash : print the record to the file <--- __str__() will handle the fun end for close file () (excuse the pseudocode, I'm trying to avoid shifting grammar in my head from my work atm) and then just reverse that to load it in. If you want you can even just pickle the hash , and it ought traverse into the objects and poo poo them into a file. But thats probably bad form. On a side note, you used to be able to do this really well with pascal (write an array of records directly to a file) , which made me kind of amused at the 'pascal is hard for file handling!' people (sure it was, in the 1960s!) as at least with the turbo variants, nothing came close to it.
|
# ¿ Aug 19, 2008 07:44 |
|
Man. I should one of these days, sit down and write a tutorial for absolute programming newbies.
|
# ¿ Aug 30, 2008 07:01 |
|
Kire posted:I read "A byte of python" and "thinking like a computer scientist," two of the intro-to-python docs recommended on the main website. Does anybody have further reading recommendations for someone still getting into programming and Python? Some simple projects I should try to do? Grab a copy of Django and gently caress around with that.
|
# ¿ Sep 28, 2008 04:30 |
|
Getting psycopg2 postgresql library working on OS/X is an utter slut of a task. Apple really needs to provide canonical packages for fundamental stuff like this.
|
# ¿ Sep 28, 2008 23:08 |
|
Because I have a mac in front of me , and not a linux or windows box. vv But yes, the state of python on the mac is shameful at the moment. The internet is full of people saying "Use MacPython its the unofficial standard". No, theres an official standard that apple supplies, and you break your computers head if you dont Now I have Apple python, MacPython, ports python and Fink python all due to a 3 day long quest to get loving psycopg2 installed. End solution;- Reverted to the apple python (so xcode isnt broken) modify the poo poo out of the compile script and rebuild psycopg2 from a tarball. Also the postgresql install shat itself so I had to manually install that too duck monster fucked around with this message at 03:52 on Sep 29, 2008 |
# ¿ Sep 29, 2008 03:48 |
|
tbradshaw posted:Well, part of being on OSX is that you have a full UNIX workstation at your finger tips. You should install MacPython, but do so in your home directory. I'd recommend creating a "local" directory in your home directory, and using that as the root for all of your personal software installations. Except that literally every unix on the market except for the mac has a coherent policy on package management. I love the mac, but its package management has more in common with loving slackware than anything modern. Download tarball, compile and pray the gods will be benevolant. And no, easy_install will usually light on fire the minute its got to compile something and it becomes apparent that Apple puts things in different places to bsd's or SysV's. Reminder there are about 5 distros of python out there for the mac, none of which are compatible.
|
# ¿ Sep 29, 2008 15:32 |
|
outlier posted:Point taken. I'd prefer to use a single build of Python myself, except for Zope's lunk-headed attitude of versions (i.e. only runs on Python 2.4 for obscure reasons, internal modules are incredibly picky about the versions of other modules they will work with). And granted, no package installer with help you with versioning in Python. Oh god.... One of the angriest emails I ever wrote was something to the effect of "Why the gently caress are you compiling free software with an unfree compiler? USE GCC!!!!!!!!" because I was blocked from using so many libraries due to the need for Visual studio.
|
# ¿ Sep 30, 2008 14:28 |
|
|
# ¿ Apr 28, 2024 03:58 |
|
ahem http://www.andlinux.org/ Basically installs linux as a windows process. Note: Not a VM, its a linux kernel that runs on windows, and it all works rather well. Similar sort of experience to parallells on the mac I guess. edit: Or just run parallells on a mac
|
# ¿ Oct 1, 2008 06:59 |