|
Scaevolus posted:I ran into this bug yesterday. don't ya hate it when your dict leaks?
|
# ? Mar 6, 2010 00:43 |
|
|
# ? May 12, 2024 08:02 |
|
I... how the hell do you run into that.
|
# ? Mar 6, 2010 02:59 |
|
king_kilr posted:I... how the hell do you run into that. for me it was from my last visit to juarez
|
# ? Mar 6, 2010 03:38 |
|
Does anyone have any ideas for how to get the file sizes for a large number of files (all recursive files under a root directory)? Right now I'm using os.walk and os.path.getsize - but it becomes pretty slow after a couple thousand files. My next thought was to parse the output of ls (or dir) - but I was hoping I could avoid that but have the same performance.
|
# ? Mar 6, 2010 05:12 |
|
supster posted:Does anyone have any ideas for how to get the file sizes for a large number of files (all recursive files under a root directory)? du /*
|
# ? Mar 6, 2010 05:22 |
|
king_kilr posted:I... how the hell do you run into that. I wanted a dict where I could access keys as attributes (because it looks nicer), and that "solution" is shorter than the proper one where you overload __gettattr__ and __setattr__
|
# ? Mar 6, 2010 05:23 |
|
Didn't your mother ever tell you that sugar rots your teeth?
|
# ? Mar 6, 2010 05:27 |
|
tripwire posted:du /* again, i'm trying to avoid a shell command (but thanks, du is much more appropriate than ls)
|
# ? Mar 6, 2010 05:33 |
|
stat every file recursively, maybe? I doubt you'll see a huge performance improvement though
|
# ? Mar 6, 2010 05:40 |
|
Scaevolus posted:I ran into this bug yesterday. There's plenty of bugs which slip through. Finite resources. Feel free to log into the tracker and comment on it/wake it up.
|
# ? Mar 6, 2010 14:38 |
|
supster posted:Does anyone have any ideas for how to get the file sizes for a large number of files (all recursive files under a root directory)? Interestingly, I'm actually writing a multithreaded tree walker (essentially, a find clone) right now. It would be trivial to make it compile sizes/stat information. If I get approval, I'll share it with you.
|
# ? Mar 6, 2010 14:40 |
|
Are there any good web development/database frameworks that work with Python 3.0? SQLAlchemy claims to, but I can't seem to find any others. I'm trying to write a browser game in Python 3, but should I just bite the bullet and switch to Rails?
|
# ? Mar 6, 2010 22:38 |
|
HoldYourFire posted:Are there any good web development/database frameworks that work with Python 3.0? SQLAlchemy claims to, but I can't seem to find any others. Why does it have to be Python 3? There's stuff available for Python 2.
|
# ? Mar 6, 2010 22:53 |
|
HoldYourFire posted:Are there any good web development/database frameworks that work with Python 3.0? SQLAlchemy claims to, but I can't seem to find any others. How about switching down to Python 2.6?
|
# ? Mar 6, 2010 22:54 |
|
Bottle sorta does but yeah why python 3.x?
|
# ? Mar 7, 2010 09:20 |
|
No Safe Word posted:Bottle sorta does but yeah why python 3.x? Because it's new! And therefore better. OK, I'll look at 2.6 then. Thanks!
|
# ? Mar 7, 2010 12:15 |
|
HoldYourFire posted:Because it's new! And therefore better. It's really not wise to use Python 3 at this point if you want to, you know, use libraries.
|
# ? Mar 7, 2010 15:14 |
|
HoldYourFire posted:Because it's new! And therefore better. From what I understand, the official recommendation is that users looking to do practical work use 2.6. The 3.x releases essentially amount to a really drawn out beta, which the Python Foundation is slowly easing the community towards. As for web frameworks, the usual options are Django (see the book about it, here), Pylons (which also has a book, here), Turbogears, and webpy.
|
# ? Mar 7, 2010 17:26 |
|
A small pro tip regarding django. For as much as it encapsulated SQL calls, you will need to know just a few smidgens of SQL if you want to change your schema around. It isn't good at resetting schemas with liberal use of foreign keys. I always had to reset my db tables manually, and then have django re-init them. It's not bad, but it's just slightly more difficult than some of the django advocacy stuff would have you believe. It's still the only web framework I've ever liked, though. It's so drat convenient. I'll probably use it to prototype in the future even if I don't end up launching anything that uses it. ErIog fucked around with this message at 18:53 on Mar 7, 2010 |
# ? Mar 7, 2010 17:58 |
|
My favorite part is that the admin interface is the coolest thing for making a real quick CRUD application. The icing on the cake is that you can easily extend it to fit whatever other requirements you have.
|
# ? Mar 7, 2010 18:08 |
|
I'm creating a range of dates for a stock market script, I need a tuple with a date, then another date 10 days back from the original excluding weekends (and ideally any time when the market is closed), another 10 days back from the last date in the tuple, etc. I've been looking at the docs and the only way I can think of to do it is to extract the name of the days between the date ranges and adjusting how many days I go back depending on whether a saturday or sunday turns up, but in my coding so far it doesn't seem very elegant nor would it take into account public holidays (which would probably require a preloaded list of excluded dates to be checked against which make my little method even more cluttered). Is there an easy way to do this or am I doing this the hard way?
|
# ? Mar 7, 2010 18:12 |
|
LuckySevens posted:Is there an easy way to do this or am I doing this the hard way?
|
# ? Mar 7, 2010 20:35 |
|
LuckySevens posted:Is there an easy way to do this or am I doing this the hard way? If the datetime module that ChiralCondensate mentioned isn't enough for you, you may want to try mxDateTime.
|
# ? Mar 7, 2010 21:24 |
|
Jonnty posted:It's really not wise to use Python 3 at this point if you want to, you know, use libraries. If the NumPy folks would get off their butts and release a Python 3 compatible version (even just an alpha), people might start caring more about it. I really want to release a Python 3 version of my package, but I can't because it needs NumPy.
|
# ? Mar 8, 2010 03:48 |
|
Haystack posted:From what I understand, the official recommendation is that users looking to do practical work use 2.6. The 3.x releases essentially amount to a really drawn out beta, which the Python Foundation is slowly easing the community towards. No. 3.x is not a drawn out beta; and the PSF is not slowly easing the community towards it. 3.x is out there; can be used in production; but lacks third party library support.
|
# ? Mar 8, 2010 04:12 |
|
Avenging Dentist posted:If the NumPy folks would get off their butts and release a Python 3 compatible version (even just an alpha), people might start caring more about it. I really want to release a Python 3 version of my package, but I can't because it needs NumPy. Last I heard; the NumPy folks had recently announcing the py3 port would spin up soon - this was at pycon, and I don't know who the official source was, so ymmv.
|
# ? Mar 8, 2010 04:13 |
|
ChiralCondensate posted:The datetime module has some helpful stuff for counting back and forth on the calendar, if you haven't found it already. You could make a date object out of the starting date, and decrement it by a timedelta(days=1) instance, counting off those days that aren't weekends (date.weekday() not in (5,6)) and aren't in a list_of_public_holidays. Nice, what I was looking for, thank you
|
# ? Mar 8, 2010 04:45 |
|
m0nk3yz posted:Last I heard; the NumPy folks had recently announcing the py3 port would spin up soon - this was at pycon, and I don't know who the official source was, so ymmv. Christ, finally. I looked into the changes required to get stuff working on Python 3, and they're honestly pretty minimal. All I really want is an alpha-quality version so I can test stuff out.
|
# ? Mar 8, 2010 05:10 |
|
m0nk3yz posted:No. 3.x is not a drawn out beta; and the PSF is not slowly easing the community towards it. 3.x is out there; can be used in production; but lacks third party library support. These two statements are mutually exclusive to me and I imagine a large part of the python community. Preemptively calling myself a big baby who can't write web applications without a framework.
|
# ? Mar 8, 2010 05:28 |
|
MEAT TREAT posted:These two statements are mutually exclusive to me and I imagine a large part of the python community. I'm right there with you; I can't move to py3k until Django and a few other things I need move over. Until then, only small pet projects for py3k. Which sucks.
|
# ? Mar 9, 2010 15:01 |
|
m0nk3yz posted:I'm right there with you; I can't move to py3k until Django and a few other things I need move over. Until then, only small pet projects for py3k. Which sucks. yeah, add me to the list of babbys who can't write apps without a framework. another thing that should be mentioned, it's not so much people are lazy and just haven't gotten around to porting their stuff over, theres also the issue of python3 not being installed on as many systems as python2. For instance, Ubuntu 8.04, which is very commonly used only has 2.4 and 2.5. A lot of people use 8.04, and it'll be around for at least another year. And thats just Ubuntu, which is usually as bleeding edge as they come. Other distros are even worse. There are still quite a lot of crappy web hosts out there with 2.1 installed.
|
# ? Mar 9, 2010 19:17 |
|
nbv4 posted:yeah, add me to the list of babbys who can't write apps without a framework. Which makes it a self-reinforcing problem. I know this is big talk for someone who's only written relatively tiny programs in python2.6 and not ported any of them over to 3.0, BUT, I don't think "not enough people use python3" is a valid excuse not to port over your old code- if everyone thought that way, we'd never advance in versions at all.
|
# ? Mar 10, 2010 03:44 |
|
tripwire posted:Which makes it a self-reinforcing problem. I know this is big talk for someone who's only written relatively tiny programs in python2.6 and not ported any of them over to 3.0, BUT, I don't think "not enough people use python3" is a valid excuse not to port over your old code- if everyone thought that way, we'd never advance in versions at all. It will all come - it just takes time. Once some big dominoes fall - such as numpy - we will begin to see things shift. Until then, we're all consigned to the darkness which is the old print statement.
|
# ? Mar 10, 2010 04:18 |
|
m0nk3yz posted:It will all come - it just takes time. Once some big dominoes fall - such as numpy - we will begin to see things shift. Until then, we're all consigned to the darkness which is the old print statement. quote:The trunk of NumPy has preliminary Python 3K support. There is no official roadmap, but the end of the summer looks promising.
|
# ? Mar 10, 2010 16:32 |
|
I'm playing with numpy to do some flocking algorithm graphics stuff, and I think I might be missing something. I'm using 1 dimensional numpy.array() objects for my vectors, and I guess the best way to get the magnitude (AKA vector length, i.e. |v| = v.x2 + v.y2) is to call numpy.linalg.norm() on it, right? Is this how people play with vectors in python? I figured there would be a dedicated vector class rippling with OO functions. Also, what is the preferred package to do simple pixel-addressed 2D graphics? Basically all I want is a fast virtual framebuffer in a window that I can diddle with RGB values on.
|
# ? Mar 11, 2010 01:51 |
Stabby McDamage posted:Also, what is the preferred package to do simple pixel-addressed 2D graphics? Basically all I want is a fast virtual framebuffer in a window that I can diddle with RGB values on. I've been using Python Image Library. If there's something better, I'd like to know about it, too.
|
|
# ? Mar 11, 2010 02:08 |
|
Stabby McDamage posted:I'm playing with numpy to do some flocking algorithm graphics stuff, and I think I might be missing something. Depending on if you just want to read from the image or write to it, you can either use the "asarray"/"fromarray" methods of PIL images, or you can actually convert the whole array to a string and use the fromstring method of either numpy or PIL. Heres an example I found on the PIL homepage: code:
If you are developing just on win32, I've seen (but haven't used) a module in PIL for drawing on windows device contexts: http://www.pythonware.com/library/pil/handbook/imagewin.htm tripwire fucked around with this message at 02:48 on Mar 11, 2010 |
# ? Mar 11, 2010 02:08 |
On a related note, what is the preferred Python way to handle video?
|
|
# ? Mar 11, 2010 02:30 |
|
Beats me!
|
# ? Mar 11, 2010 02:48 |
|
|
# ? May 12, 2024 08:02 |
|
Jo posted:On a related note, what is the preferred Python way to handle video? I've played with pyglet... It works but, isn't nice
|
# ? Mar 11, 2010 03:07 |