|
I got started with Python a few months a go, I've been using it for exclusively web stuff so far, using Django. I really like it so far, I would say the best part is code is so readable.
|
# ¿ Nov 5, 2007 03:08 |
|
|
# ¿ Apr 27, 2024 04:30 |
|
I have a python application that is just about finished up, you can check out the code here: http://github.com/alex/pyelection/tree/master any thoughts on it would be great, there are some areas where the code is a little messy and any thoughts would be great.
|
# ¿ Feb 24, 2008 21:55 |
|
sum - takes the sum of an iterable int(x) for x in str(1234567890) - a generator expression, it iterates over '1234567890'(strings are iterable and yield each charecter), and yields the integer
|
# ¿ May 15, 2008 01:10 |
|
Milde posted:sum("hello") gives an error - it iterates over the string fine, but internally it tries to call "h" + "e", which is invalid. 'h' + 'e' is perfectly valid, the problem is sum appears to do code:
|
# ¿ May 15, 2008 05:54 |
|
If/when the PyCon talks are released(they were all recorded), the PyPy one was really excellent.
|
# ¿ May 22, 2008 20:48 |
|
EDIT: I hate my life.
|
# ¿ May 22, 2008 20:48 |
|
No Safe Word posted:There's a whole Django thread actually, and I answered a similar question in it, which basically boils down to having django generate a sql dump script with your data in it, recreating the model (drop/recreate), and then re-inserting the data after you've modified the dump appropriately. Or you can use a 3rd party project such as django-evolution(which works pretty drat well IMO).
|
# ¿ May 24, 2008 05:45 |
|
Tuples are immutable, use them as such.
|
# ¿ May 30, 2008 05:49 |
|
ashgromnies posted:Yeah, I know I want templating but this is just a one-off for now to test my algorithm and will go away so I don't want to put too much effort into it - just enough to be readable. This is eventually going to be called from a Django application. If this is for use in a Django app, you should probably take a look at the Django templating language.
|
# ¿ May 30, 2008 20:35 |
|
http://docs.python.org/lib/node528.html Are you using Popen and giving them a file object, or something else to write to?
|
# ¿ Jun 24, 2008 18:00 |
|
I just set up mod_wsgi and I like it a lot, it's super easy to get going and I imagine it would be pretty easy to invoke scripts using subpress.Popen and pipe their stdout back to the user.
|
# ¿ Jul 1, 2008 21:23 |
|
I used pyprocessing(aka multiprocessing) this weekend and it was really great to work with, I managed to offload all the simulations(aka computationally expensive work) to another process in hardly any work, just set up a pipe to communicate and set the process off, you can see the what change I made to made for this to happen here: http://github.com/alex/election-sim/commit/cc93df649d1295deab96f1f1ab1ff709e8b0f391
|
# ¿ Oct 27, 2008 15:37 |
|
No Safe Word posted:Something like the table on these pages: http://wiki.python.org/moin/TimeComplexity Tada
|
# ¿ Oct 29, 2008 18:30 |
|
Mr. Noller(forgot your SA name), your proposals for pycon sound very cool, I'd attend both of them.(As long as they don't interfere with mine of coure :P )
|
# ¿ Oct 31, 2008 18:10 |
|
m0nk3yz posted:I proposed one on MultiProcessing, and one on Concurrency/Distributed systems. Dunno if they'll get approved. Hehe, I can see votes on other people's proposals(but not mine own), not sure if I'm allowed/supposed to say anything. But I wouldn't worry about he MultiProcessing one :P
|
# ¿ Oct 31, 2008 18:38 |
|
m0nk3yz posted:Oh no guys, I've picked up "Programming Erlang" - I'm going to the dark side Guido said that he though Actors were one of the "right ways" to do concurency. It's somewhere in http://moderator.appspot.com/#e%253Dagltb2RlcmF0b3JyDQsSBlNlcmllcxjJAQw%252Bt%253Dagltb2RlcmF0b3JyDAsSBVRvcGljGP8BDA%252Bv%253D15
|
# ¿ Nov 2, 2008 22:07 |
|
m0nk3yz posted:Need some help: I want to pick out a few "easy to grok" app examples to implement with single-threads, multi threads and then multiprocessing. I want the examples to be as approachable as possible. Ergo, no map-reduces or hadooping The app I just did uses one process for the GUI stuff, and a second for the heavy processing, something like that's a pretty good example IMO.
|
# ¿ Nov 7, 2008 23:10 |
|
Guys, this: http://github.com/alex/pyelection/tree/master/models.py#L57 is why you shouldn't be using except: pass, because i don't have a loving clue what my own code does, or what the logic is.
|
# ¿ Nov 15, 2008 08:40 |
|
tef posted:If you're using beautiful soup still, try using lxml instead. You can use it to parse html and xml quickly, and run xpath over it. I'm not talking about the BeautifulSoup stuff, I'm saying I have no idea what exceptions I'm trying to catch, or what circumstances lead to those things.
|
# ¿ Nov 15, 2008 21:17 |
|
kaschei posted:I've been googling for a little less than an hour for a Python module that can parse functions and evaluate them. I haven't found anything like that, and I'm looking for something that can handle multiple (at least two) variables. if you consider it safe to do a raw eval() you could use SymPy
|
# ¿ Dec 1, 2008 08:56 |
|
I'm looking for a canvas library. Basically I'd like to emulate the HTML canvas element, specifically I need to be able to add polygons, whose color has an alpha channel/transparency, I need to be able to edit polygons on the canvas, and I need to be able to get the actual color for a given pixel. Basically I'm trying to implement http://alteredqualia.com/visualization/evolve/ in python
|
# ¿ Dec 12, 2008 02:23 |
|
I'm super excited to say that my PyCon talk was accepted! It's a panel on ORM philosophies and design decisions with Jacob Kaplan-Moss, Ian Bicking, Mike Bayer, Guido van Rossum, and Massimo Di Pierro. I know we had a few other goons who submitted talk proposals, what were your results?
|
# ¿ Dec 16, 2008 02:09 |
|
m0nk3yz posted:Both of mine - an intro to multiprocessing, and the "state of concurrency and distributed systems w/ python" were accepted. awesome, both of those sound super interesting, can't wait!
|
# ¿ Dec 16, 2008 06:39 |
|
IntoTheNihil posted:I literally just (an hour ago) jumped into programming with Python. Right now i'm using this and am up to the 5th part. I'm understanding it so far but I'm not holding much in my memory. Is there a better online tutorial or even book I should use or is this just normal confusion that goes away after using Python for a few weeks. If you have some programming background dive into python is pretty good, otherwise I like the regular python tutorial.
|
# ¿ Dec 18, 2008 04:55 |
|
tripwire posted:Can someone help me get this stupid mona lisa approximator thing working? I've given up on trying anything remotely fancy and just mutate a list of floats which are the values used to draw triangles on a cairo canvas. I too tried to implement it(using Pyglet+OpenGL) and I had the same problem, here's my code: http://github.com/alex/evolves/tree/master Perhaps we both have the same error in our code?
|
# ¿ Jan 7, 2009 10:03 |
|
m0nk3yz posted:thou shalt not prematurely optimize: http://bugs.python.org/issue5000 Heh, I just had some fun optimizing something myself: http://lazypython.blogspot.com/2009/01/optimizing-view.html
|
# ¿ Jan 19, 2009 22:43 |
|
bitprophet posted:2.6. 3.0 is extremely new and almost nothing has been ported to it yet. 2.6 will include some of the newer libraries/ideas present in 3.0, so you'll be better off for learning 3.0 than someone who's used to older verisons of Python. 3.0 will not be mainstream for at least a year or two (someone like m0nk3yz or king_kilr will have a better estimate, probably). I can't really speak intelligently for other libraries but Django's current trajectory is to start having a 3.0 branch in about 1.5-2 years. That being said Martin Loewis has a patch available that combined with 2to3 brings Django to a usable state on 3.0, so if you had a pressing need(and it doesn't sound like you do) you could probably make it work.
|
# ¿ Jan 29, 2009 04:19 |
|
m0nk3yz posted:If you want cleanliness and purity; go with 3.0 (note that IO speeds suck) - if you want third party code, libraries and frameworks, go with 2.6. To add to this, the hope is to have 3.1 or a beta out around PyCon, this continues a lot of the cleanup that defined 3.0(plus io speedups and another 20% speed increase).
|
# ¿ Jan 29, 2009 04:59 |
|
deimos posted:I am gonna ask the boss for PyCon, and I am pretty sure I am going to go regardless of job paying for it, at the very least for the conference. I attended last year and I really enjoyed it. This year I have the privilege of speaking and am once again really looking forward to it. One of the big things Bruce mentions, sponsored keynotes, I don't think we're having this year.
|
# ¿ Jan 30, 2009 01:52 |
|
tripwire posted:I guess they aren't too far apart, codepy just looks nice because you can build your code and compile + link it on the fly (i.e. have dynamically generated code), you don't have to dick around with makefiles and all that basically. Cython can do that with the pyimportx module that it includes from .11 on, it can even try to compile ordinary python code and fall back to the raw interpretter if it can't handle that.
|
# ¿ Feb 11, 2009 17:22 |
|
m0nk3yz posted:Reminds me of another weird urge I had the other day; given stackless tasklets are picklable (as well as the channel), you could serialize them and put them into a database, and in theory, a SQL query of the objects in the database could actually dictate the "program structure". You just need an ORM that auto-depickles the objects and adds them to the scheduler. Store your channels in another table, and select those with the query too. Isn't that part of the seaside framework, it pickles poo poo, stores it in the session or something like that, maybe I need to stop reading reddit while tired.
|
# ¿ Feb 23, 2009 21:40 |
|
http://code.google.com/p/django-timezones/ may be just what you're looking for.
|
# ¿ Feb 24, 2009 18:07 |
|
For those doing concurrency stuff I implemented futures in Python earlier today for those who may be interested: http://dpaste.com/11007/
|
# ¿ Mar 9, 2009 21:18 |
|
Pooball posted:ATLbeer, Thread.run() returns a Future object (see line 44). This is an object that proxies the real value. To expand on this(because this was my revelation into how to do this), in Python everything about an object is in it's attributes. What does it mean for an object to be an integer? It means it acts like a number, we can display it, we can add it to other numbers, etc. Well in Python all it means to display something is for it to have an __str__ method, or to add an __add__ method. All being an integer means is that it walks, talks, and quacks like one.
|
# ¿ Mar 10, 2009 19:53 |
|
tef posted:I used pyodbc last time instead of pymssql, with a little more success. I think that's more likely to work, I know the django-pyodbc guys prefer it to -mssql and django uses unicode everywhere so I'm sure it does as well.
|
# ¿ Mar 13, 2009 16:03 |
|
fnordcircle posted:I'm working out of a python book that I burned about 75% of the way through, but I'm still feeling really, really hazy on some of the concepts and as many times as I've reread the big about classes my eyes still cross. I think I'd learn better from doing than reading, but powering through and moving on, trying to decipher the source code in this book it isn't getting any easier. checkout dive into python, it's a free online python book
|
# ¿ Mar 22, 2009 08:07 |
|
For those who are interested in VM work or just want their Python faster this seems to be an intersting project: http://code.google.com/p/unladen-swallow/
|
# ¿ Mar 25, 2009 20:20 |
|
m0nk3yz posted:Interesting? It's pure awesome and win. I spoked to a few people about it today, and it's very very real. I could see this supplanting CPython-trunk quickly should they hit the goals for this year. So jealous of people already at PyCon, one more day of class then I come home and join you guys no Friday. Looking forward to your talks, perhaps I'll see you there.
|
# ¿ Mar 26, 2009 04:41 |
|
Scaevolus posted:It would be awesome if they met all these goals (JIT & no GIL?!), but the pessimist in me says they'll lose steam before they reach any real results. I too am a forever skeptic, however it appears that all of the group members are Google employees, and one of their members in a Cpython core contributer, so there's hope!
|
# ¿ Mar 26, 2009 16:13 |
|
|
# ¿ Apr 27, 2024 04:30 |
|
For those curious as to why PyCon is the best conference ever, or wanting to see just what Mr. Monkeyz is up to: http://pycon.blip.tv/#1940650
|
# ¿ Mar 29, 2009 05:59 |