Q_Id
int64
337
49.3M
CreationDate
stringlengths
23
23
Users Score
int64
-42
1.15k
Other
int64
0
1
Python Basics and Environment
int64
0
1
System Administration and DevOps
int64
0
1
Tags
stringlengths
6
105
A_Id
int64
518
72.5M
AnswerCount
int64
1
64
is_accepted
bool
2 classes
Web Development
int64
0
1
GUI and Desktop Applications
int64
0
1
Answer
stringlengths
6
11.6k
Available Count
int64
1
31
Q_Score
int64
0
6.79k
Data Science and Machine Learning
int64
0
1
Question
stringlengths
15
29k
Title
stringlengths
11
150
Score
float64
-1
1.2
Database and SQL
int64
0
1
Networking and APIs
int64
0
1
ViewCount
int64
8
6.81M
1,736,451
2009-11-15T03:19:00.000
0
0
1
1
python,macos,ide,editor,python-idle
2,854,788
12
false
0
0
I would recommend you to look at Aptana(it's more attractive then Eclipse for me)+PyDev or PyCarm. I use TextMate too, but those are easy for debug.
6
2
0
I'm currently using IDLE, its decent, but I'd like to know if there're better lightweight IDEs built especially for Mac — free or commercial.
Native Python Editor for Mac?
0
0
0
9,940
1,736,451
2009-11-15T03:19:00.000
0
0
1
1
python,macos,ide,editor,python-idle
3,432,322
12
false
0
0
I use FRAISE (free) it is simple and useful, auto indentation, colorize, auto completion, shell.
6
2
0
I'm currently using IDLE, its decent, but I'd like to know if there're better lightweight IDEs built especially for Mac — free or commercial.
Native Python Editor for Mac?
0
0
0
9,940
1,736,451
2009-11-15T03:19:00.000
1
0
1
1
python,macos,ide,editor,python-idle
1,736,465
12
false
0
0
There is a commercial one - Textmate. Most of the good free editors are cross-platform (if you are ok with it, I'd recommend EditRa - but it doesn't work properly under 10.6 yet, because of some bugs in wxPython).
6
2
0
I'm currently using IDLE, its decent, but I'd like to know if there're better lightweight IDEs built especially for Mac — free or commercial.
Native Python Editor for Mac?
0.016665
0
0
9,940
1,736,451
2009-11-15T03:19:00.000
0
0
1
1
python,macos,ide,editor,python-idle
7,764,682
12
false
0
0
check out Sublime Text 2 Alpha. seriously awesome.
6
2
0
I'm currently using IDLE, its decent, but I'd like to know if there're better lightweight IDEs built especially for Mac — free or commercial.
Native Python Editor for Mac?
0
0
0
9,940
1,737,624
2009-11-15T14:17:00.000
1
0
0
0
python,qt,pyqt
4,600,372
2
false
0
1
Try doing setCenterOn(0,0) on the QGraphicsView?
1
2
0
How to put QGraphicsScene's (0,0) to top-left corner of QGraphicsView?
QGraphicsScene and positioning
0.099668
0
0
1,081
1,738,845
2009-11-15T21:12:00.000
4
0
1
0
iphone,python,macos
1,738,867
4
false
0
0
Any of those platforms are going to be more than adequate for iPhone development, but since Apple is not allowing anything that requires a VM or an interpreted environment, there is no way to do iPhone development using Python at this time. EDIT: Looks like I misread that as doing Python development on an iPhone, so just ignore the second part of my answer. Any of those platforms are going to be fine for either iPhone or Python development.
4
0
0
What is the minimum configuration to do some Python and iPhone development on Mac ? Platform wise: Mac Mini, Mac Pro, Mac Book, Mac Book Pro ? Memory requirement CPU speed Thanks for your advice. Laurent
Python and iPhone development on Mac - minimum/recommended hardware?
0.197375
0
0
898
1,738,845
2009-11-15T21:12:00.000
4
0
1
0
iphone,python,macos
1,738,881
4
true
0
0
The minimum requirement is an intel mac. Any intel mac will work. iPhone development is unsupported on PPC. Python can be done on any mac that runs os x. The minimum requirement, and what's pleasant are different things. Everything you've listed will work pretty great. You might want to bump up the ram a little on what they ship with, but other than that you're good to go.
4
0
0
What is the minimum configuration to do some Python and iPhone development on Mac ? Platform wise: Mac Mini, Mac Pro, Mac Book, Mac Book Pro ? Memory requirement CPU speed Thanks for your advice. Laurent
Python and iPhone development on Mac - minimum/recommended hardware?
1.2
0
0
898
1,738,845
2009-11-15T21:12:00.000
1
0
1
0
iphone,python,macos
1,738,884
4
false
0
0
Rather ephemeral in our requirements, aren't we. 'Some' python/iPhone.... You will be well served by a mini, starting @ $600, they're a steal. Upgrade the processor (2.53ghz), add RAM to 4GB (after purchase, if you're comfortable) throw a generic keyboard, mouse and Monitor on it and you've got a heck of a machine. Don't bother with a HD upgrade, just get an external USB disk and put all your VM's and extra necessities on it.
4
0
0
What is the minimum configuration to do some Python and iPhone development on Mac ? Platform wise: Mac Mini, Mac Pro, Mac Book, Mac Book Pro ? Memory requirement CPU speed Thanks for your advice. Laurent
Python and iPhone development on Mac - minimum/recommended hardware?
0.049958
0
0
898
1,738,845
2009-11-15T21:12:00.000
1
0
1
0
iphone,python,macos
1,738,885
4
false
0
0
Any system that Apple sells is sufficient to do Python and iPhone development on the Mac. I generally consider 2 GB to be the minimum amount of RAM that I would want to use, and 4 GB if I'm going to be doing any significant amount of work in a VM (for instance, VMware Fusion or Parallels for running Windows within Mac OS X). But I think all configurations currently come with at least 2 GB of RAM, so you should be set there, too. Of course faster machines are always better, so you should get a machine that's fast enough for you, but I have a couple year old Mac Book Pro and find that's fast enough for me. The biggest help for development is multiple monitors. Having two monitors helps a lot (and three is good, too). I believe that all of Apple's current systems support two monitors.
4
0
0
What is the minimum configuration to do some Python and iPhone development on Mac ? Platform wise: Mac Mini, Mac Pro, Mac Book, Mac Book Pro ? Memory requirement CPU speed Thanks for your advice. Laurent
Python and iPhone development on Mac - minimum/recommended hardware?
0.049958
0
0
898
1,739,543
2009-11-16T00:55:00.000
0
0
0
1
python,google-app-engine,compression,gzip,zlib
2,125,539
5
false
1
0
You can store up to 10Mb with a list of Blobs. Search for google file service. It's much more versatile than BlobStore in my opinion, since I just started using BlobStore Api yesterday and I'm still figuring out if it is possible to access the data bytewise.. as in changing doc to pdf, jpeg to gif.. You can storage Blobs of 1Mb * 10 = 10 Mb (max entity size I think), or you can use BlobStore API and get the same 10Mb or get 50Mb if you enable billing (you can enable it but if you don't pass the free quota you don't pay).
2
1
0
I im trying to store 30 second user mp3 recordings as Blobs in my app engine data store. However, in order to enable this feature (App Engine has a 1MB limit per upload) and to keep the costs down I would like to compress the file before upload and decompress the file every time it is requested. How would you suggest I accomplish this (It can happen in the background by the way via a task queue but an efficient solution is always good) Based on my own tests and research - I see two possible approaches to accomplish this Zlib For this I need to compress a certain number of blocks at a time using a While loop. However, App Engine doesnt allow you to write to the file system. I thought about using a Temporary File to accomplish this but I havent had luck with this approach when trying to decompress the content from a Temporary File Gzip From reading around the web, it appears that the app engine url fetch function requests content gzipped already and then decompresses it. Is there a way to stop the function from decompressing the content so that I can just put it in the datastore in gzipped format and then decompress it when I need to play it back to a user on demand? Let me know how you would suggest using zlib or gzip or some other solution to accmoplish this. Thanks
Compress data before storage on Google App Engine
0
0
0
2,545
1,739,543
2009-11-16T00:55:00.000
2
0
0
1
python,google-app-engine,compression,gzip,zlib
1,739,598
5
true
1
0
"Compressing before upload" implies doing it in the user's browser -- but no text in your question addresses that! It seems to be about compression in your GAE app, where of course the data will only be after the upload. You could do it with a Firefox extension (or other browsers' equivalents), if you can develop those and convince your users to install them, but that has nothing much to do with GAE!-) Not to mention that, as @RageZ's comment mentions, MP3 is, essentially, already compressed, so there's little or nothing to gain (though maybe you could, again with a browser extension for the user, reduce the MP3's bit rate and thus the file's dimension, that could impact the audio quality, depending on your intended use for those audio files). So, overall, I have to second @jldupont's suggestion (also in a comment) -- use a different server for storage of large files (S3, Amazon's offering, is surely a possibility though not the only one).
2
1
0
I im trying to store 30 second user mp3 recordings as Blobs in my app engine data store. However, in order to enable this feature (App Engine has a 1MB limit per upload) and to keep the costs down I would like to compress the file before upload and decompress the file every time it is requested. How would you suggest I accomplish this (It can happen in the background by the way via a task queue but an efficient solution is always good) Based on my own tests and research - I see two possible approaches to accomplish this Zlib For this I need to compress a certain number of blocks at a time using a While loop. However, App Engine doesnt allow you to write to the file system. I thought about using a Temporary File to accomplish this but I havent had luck with this approach when trying to decompress the content from a Temporary File Gzip From reading around the web, it appears that the app engine url fetch function requests content gzipped already and then decompresses it. Is there a way to stop the function from decompressing the content so that I can just put it in the datastore in gzipped format and then decompress it when I need to play it back to a user on demand? Let me know how you would suggest using zlib or gzip or some other solution to accmoplish this. Thanks
Compress data before storage on Google App Engine
1.2
0
0
2,545
1,739,913
2009-11-16T03:37:00.000
116
0
1
0
python,string
1,739,928
3
true
0
0
With a 64-bit Python installation, and (say) 64 GB of memory, a Python 2 string of around 63 GB should be quite feasible (if not maximally fast). If you can upgrade your memory much beyond that (which will cost you an arm and a leg, of course), your maximum feasible strings should get proportionally longer. (I don't recommend relying on virtual memory to extend that by much, or your runtimes will get simply ridiculous;-). With a typical 32-bit Python installation, of course, the total memory you can use in your application is limited to something like 2 or 3 GB (depending on OS and configuration), so the longest strings you can use will be much smaller than in 64-bit installations with ridiculously high amounts of RAM.
1
93
0
If it is environment-independent, what is the theoretical maximum number of characters in a Python string?
What is the max length of a Python string?
1.2
0
0
117,047
1,739,924
2009-11-16T03:41:00.000
1
0
1
0
python,python-import
1,740,326
9
false
0
0
reload() module X, reload() module importing Y from X. Note that reloading won't change already created objects bound in other namespaces (even if you follow style guide from Alex).
2
120
0
In Python, once I have imported a module X in an interpreter session using import X, and the module changes on the outside, I can reload the module with reload(X). The changes then become available in my interpreter session. I am wondering if this also possible when I import a component Y from module X using from X import Y. The statement reload Y does not work, since Y is not a module itself, but only a component (in this case a class) inside of a module. Is it possible at all to reload individual components of a module without leaving the interpreter session (or importing the entire module)? EDIT: For clarification, the question is about importing a class or function Y from a module X and reloading on a change, not a module Y from a package X.
Python: reload component Y imported with 'from X import Y'?
0.022219
0
0
53,981
1,739,924
2009-11-16T03:41:00.000
54
0
1
0
python,python-import
1,739,931
9
true
0
0
If Y is a module (and X a package) reload(Y) will be fine -- otherwise, you'll see why good Python style guides (such as my employer's) say to never import anything except a module (this is one out of many great reasons -- yet people still keep importing functions and classes directly, no matter how much I explain that it's not a good idea;-).
2
120
0
In Python, once I have imported a module X in an interpreter session using import X, and the module changes on the outside, I can reload the module with reload(X). The changes then become available in my interpreter session. I am wondering if this also possible when I import a component Y from module X using from X import Y. The statement reload Y does not work, since Y is not a module itself, but only a component (in this case a class) inside of a module. Is it possible at all to reload individual components of a module without leaving the interpreter session (or importing the entire module)? EDIT: For clarification, the question is about importing a class or function Y from a module X and reloading on a change, not a module Y from a package X.
Python: reload component Y imported with 'from X import Y'?
1.2
0
0
53,981
1,740,116
2009-11-16T04:50:00.000
3
0
1
0
python,naming-conventions,camelcasing,pep8
7,610,318
10
false
0
0
It is just a convention, but a useful one if you work with a lot of abbreviations. How did you write EmailConfig (or was it EMailConfig)? HTTPRequest? email_config and http_request are then much clearer convention.
8
23
0
Depending on your interpretation this may or may not be a rhetorical question, but it really baffles me. What sense does this convention make? I understand naming conventions don't necessarily have to have a rhyme or reason behind them, but why deviate from the already popular camelCase? Is there a rhyme and reason behind lower_case_with_underscores that I'm somehow missing? (and yes, I have read PEP 8 in its entirety, and yes, I do understand that it's merely a proposal, a guide, etc.) I suppose my real question would be this: I'm writing a Python library. In fact, with any luck, it may be a rather large library, relative to my other projects. I already try to adhere to PEP 8 as much as possible, and so far I've even maintained lower_case_with_underscores as PEP 8 instructs for function and method names. But it bugs me that I have to remember to use camelCase for Twisted, camelCase for logging, and just about everything else. What naming convention should I use, and why? It would probably amaze people that I care this much about naming, enough to write a lengthy question about it, and it amazes me, too. Perhaps I have a little OCD when it comes to these things. I don't have much of a "personal opinion" about it as much as I have a tendency to just go for whatever is used the most, which in this case, would be camelCase - but it annoys me even further to find out that I'm probably breaking some eternal laws about explicit vs implicit and the zen of python written in stone or something.
For what reason do we have the lower_case_with_underscores naming convention?
0.059928
0
0
6,910
1,740,116
2009-11-16T04:50:00.000
0
0
1
0
python,naming-conventions,camelcasing,pep8
1,740,175
10
false
0
0
Feel free to do whatever suits you best, but consider using one of the popular conventions. It makes it easier for other developers to get up to speed with your code. Remember that over the life of the project, more time is spent reading the code than it takes to write it.
8
23
0
Depending on your interpretation this may or may not be a rhetorical question, but it really baffles me. What sense does this convention make? I understand naming conventions don't necessarily have to have a rhyme or reason behind them, but why deviate from the already popular camelCase? Is there a rhyme and reason behind lower_case_with_underscores that I'm somehow missing? (and yes, I have read PEP 8 in its entirety, and yes, I do understand that it's merely a proposal, a guide, etc.) I suppose my real question would be this: I'm writing a Python library. In fact, with any luck, it may be a rather large library, relative to my other projects. I already try to adhere to PEP 8 as much as possible, and so far I've even maintained lower_case_with_underscores as PEP 8 instructs for function and method names. But it bugs me that I have to remember to use camelCase for Twisted, camelCase for logging, and just about everything else. What naming convention should I use, and why? It would probably amaze people that I care this much about naming, enough to write a lengthy question about it, and it amazes me, too. Perhaps I have a little OCD when it comes to these things. I don't have much of a "personal opinion" about it as much as I have a tendency to just go for whatever is used the most, which in this case, would be camelCase - but it annoys me even further to find out that I'm probably breaking some eternal laws about explicit vs implicit and the zen of python written in stone or something.
For what reason do we have the lower_case_with_underscores naming convention?
0
0
0
6,910
1,740,116
2009-11-16T04:50:00.000
5
0
1
0
python,naming-conventions,camelcasing,pep8
1,740,132
10
false
0
0
The lower case with underscores convention goes all the way back to unix apis. Their entire syscall are in this convention.
8
23
0
Depending on your interpretation this may or may not be a rhetorical question, but it really baffles me. What sense does this convention make? I understand naming conventions don't necessarily have to have a rhyme or reason behind them, but why deviate from the already popular camelCase? Is there a rhyme and reason behind lower_case_with_underscores that I'm somehow missing? (and yes, I have read PEP 8 in its entirety, and yes, I do understand that it's merely a proposal, a guide, etc.) I suppose my real question would be this: I'm writing a Python library. In fact, with any luck, it may be a rather large library, relative to my other projects. I already try to adhere to PEP 8 as much as possible, and so far I've even maintained lower_case_with_underscores as PEP 8 instructs for function and method names. But it bugs me that I have to remember to use camelCase for Twisted, camelCase for logging, and just about everything else. What naming convention should I use, and why? It would probably amaze people that I care this much about naming, enough to write a lengthy question about it, and it amazes me, too. Perhaps I have a little OCD when it comes to these things. I don't have much of a "personal opinion" about it as much as I have a tendency to just go for whatever is used the most, which in this case, would be camelCase - but it annoys me even further to find out that I'm probably breaking some eternal laws about explicit vs implicit and the zen of python written in stone or something.
For what reason do we have the lower_case_with_underscores naming convention?
0.099668
0
0
6,910
1,740,116
2009-11-16T04:50:00.000
2
0
1
0
python,naming-conventions,camelcasing,pep8
1,740,129
10
false
0
0
Use the naming convention that your shop uses. If they agree that the existing convention is dorky (or they don't have a standard), and don't mind a little work cleaning up all of the code to a new and improved (more standard) convention, then you can do that.
8
23
0
Depending on your interpretation this may or may not be a rhetorical question, but it really baffles me. What sense does this convention make? I understand naming conventions don't necessarily have to have a rhyme or reason behind them, but why deviate from the already popular camelCase? Is there a rhyme and reason behind lower_case_with_underscores that I'm somehow missing? (and yes, I have read PEP 8 in its entirety, and yes, I do understand that it's merely a proposal, a guide, etc.) I suppose my real question would be this: I'm writing a Python library. In fact, with any luck, it may be a rather large library, relative to my other projects. I already try to adhere to PEP 8 as much as possible, and so far I've even maintained lower_case_with_underscores as PEP 8 instructs for function and method names. But it bugs me that I have to remember to use camelCase for Twisted, camelCase for logging, and just about everything else. What naming convention should I use, and why? It would probably amaze people that I care this much about naming, enough to write a lengthy question about it, and it amazes me, too. Perhaps I have a little OCD when it comes to these things. I don't have much of a "personal opinion" about it as much as I have a tendency to just go for whatever is used the most, which in this case, would be camelCase - but it annoys me even further to find out that I'm probably breaking some eternal laws about explicit vs implicit and the zen of python written in stone or something.
For what reason do we have the lower_case_with_underscores naming convention?
0.039979
0
0
6,910
1,740,116
2009-11-16T04:50:00.000
16
0
1
0
python,naming-conventions,camelcasing,pep8
1,740,131
10
false
0
0
I've heard it stated in other contexts that words_with_underscores are easier to separate for non-native English readers than are wordByCamelCase. Visually it requires less effort to parse the separate, foreign words.
8
23
0
Depending on your interpretation this may or may not be a rhetorical question, but it really baffles me. What sense does this convention make? I understand naming conventions don't necessarily have to have a rhyme or reason behind them, but why deviate from the already popular camelCase? Is there a rhyme and reason behind lower_case_with_underscores that I'm somehow missing? (and yes, I have read PEP 8 in its entirety, and yes, I do understand that it's merely a proposal, a guide, etc.) I suppose my real question would be this: I'm writing a Python library. In fact, with any luck, it may be a rather large library, relative to my other projects. I already try to adhere to PEP 8 as much as possible, and so far I've even maintained lower_case_with_underscores as PEP 8 instructs for function and method names. But it bugs me that I have to remember to use camelCase for Twisted, camelCase for logging, and just about everything else. What naming convention should I use, and why? It would probably amaze people that I care this much about naming, enough to write a lengthy question about it, and it amazes me, too. Perhaps I have a little OCD when it comes to these things. I don't have much of a "personal opinion" about it as much as I have a tendency to just go for whatever is used the most, which in this case, would be camelCase - but it annoys me even further to find out that I'm probably breaking some eternal laws about explicit vs implicit and the zen of python written in stone or something.
For what reason do we have the lower_case_with_underscores naming convention?
1
0
0
6,910
1,740,116
2009-11-16T04:50:00.000
19
0
1
0
python,naming-conventions,camelcasing,pep8
1,744,749
10
false
0
0
LowerCaseWithUnderScoresAreSuperiorBecauseTheTextYouNormallyReadInABookOrNewsPaperForExampleIsNotWrittenLikeThis. .
8
23
0
Depending on your interpretation this may or may not be a rhetorical question, but it really baffles me. What sense does this convention make? I understand naming conventions don't necessarily have to have a rhyme or reason behind them, but why deviate from the already popular camelCase? Is there a rhyme and reason behind lower_case_with_underscores that I'm somehow missing? (and yes, I have read PEP 8 in its entirety, and yes, I do understand that it's merely a proposal, a guide, etc.) I suppose my real question would be this: I'm writing a Python library. In fact, with any luck, it may be a rather large library, relative to my other projects. I already try to adhere to PEP 8 as much as possible, and so far I've even maintained lower_case_with_underscores as PEP 8 instructs for function and method names. But it bugs me that I have to remember to use camelCase for Twisted, camelCase for logging, and just about everything else. What naming convention should I use, and why? It would probably amaze people that I care this much about naming, enough to write a lengthy question about it, and it amazes me, too. Perhaps I have a little OCD when it comes to these things. I don't have much of a "personal opinion" about it as much as I have a tendency to just go for whatever is used the most, which in this case, would be camelCase - but it annoys me even further to find out that I'm probably breaking some eternal laws about explicit vs implicit and the zen of python written in stone or something.
For what reason do we have the lower_case_with_underscores naming convention?
1
0
0
6,910
1,740,116
2009-11-16T04:50:00.000
53
0
1
0
python,naming-conventions,camelcasing,pep8
1,740,152
10
true
0
0
camelCase and/or CamelCase (and that's a debate in its own right;-) may be overwhelmingly most popular for the kind of environments you are most familiar with, but that hardly makes them universal -- or have you never heard of the obscure language called C++, with its std::find_first_of and std::replace_copy_if algorithms and so on?! So there's no "deviation", as you state, in PEP 8 -- simply a choice towards the C++-standard conventions against the ones more popular in, say, Java or C#. As for what you should do for your own code, just pick a convention and stick with it -- consistency's more important than other considerations. My employer uses a CamelCase convention across all languages for all internal sources (though not necessarily when it comes to exposing public APIs, which is a separate issue), I personally detest it (I wish I could destroy every reliance on case sensitivity across the programming universe!-), but I stick to it, and actually help enforce it (in code reviews), because uniformity is important. I guess you'll understand why relying on case sensitivity is a horrible idea only if and when you have to rely on a screen reader to read code out to you -- most screen readers do a horrible job at pinpointing case issues, and there's no really good way, no strong or easy convention to convert case differences to easy auditory clues (while translating underscores to "clicks", in a good configurable screen reader, makes it a breeze). For people without any visual impairments whatsoever, which is no doubt 90% or more, you don't need to care (unless you want to be inclusive and help people who don't share your gift of perfect vision... naah, who cares about those guys, right?!). But, consistency is still important, and helps _every_body.
8
23
0
Depending on your interpretation this may or may not be a rhetorical question, but it really baffles me. What sense does this convention make? I understand naming conventions don't necessarily have to have a rhyme or reason behind them, but why deviate from the already popular camelCase? Is there a rhyme and reason behind lower_case_with_underscores that I'm somehow missing? (and yes, I have read PEP 8 in its entirety, and yes, I do understand that it's merely a proposal, a guide, etc.) I suppose my real question would be this: I'm writing a Python library. In fact, with any luck, it may be a rather large library, relative to my other projects. I already try to adhere to PEP 8 as much as possible, and so far I've even maintained lower_case_with_underscores as PEP 8 instructs for function and method names. But it bugs me that I have to remember to use camelCase for Twisted, camelCase for logging, and just about everything else. What naming convention should I use, and why? It would probably amaze people that I care this much about naming, enough to write a lengthy question about it, and it amazes me, too. Perhaps I have a little OCD when it comes to these things. I don't have much of a "personal opinion" about it as much as I have a tendency to just go for whatever is used the most, which in this case, would be camelCase - but it annoys me even further to find out that I'm probably breaking some eternal laws about explicit vs implicit and the zen of python written in stone or something.
For what reason do we have the lower_case_with_underscores naming convention?
1.2
0
0
6,910
1,740,116
2009-11-16T04:50:00.000
7
0
1
0
python,naming-conventions,camelcasing,pep8
1,740,207
10
false
0
0
One reason could be historically, many computers did not have mixed case capabilities. In the days of COBOL, programs were all upper case. In the early 80's many 'personal computers' only came with upper case fonts. For example, you could get a lower case extender card for the Apple II+. When programs began allowing for mixed case, camel case was not popular. Many programs took what used to be in all caps, and just converted to lower case. Through the 80's various languages attributed meaning to case, and in the 90's Java popularized the camelCase syntax. Languages which have an older history, or are tied more closely to unix system programming tend to avoid making semantic use of mixed case.
8
23
0
Depending on your interpretation this may or may not be a rhetorical question, but it really baffles me. What sense does this convention make? I understand naming conventions don't necessarily have to have a rhyme or reason behind them, but why deviate from the already popular camelCase? Is there a rhyme and reason behind lower_case_with_underscores that I'm somehow missing? (and yes, I have read PEP 8 in its entirety, and yes, I do understand that it's merely a proposal, a guide, etc.) I suppose my real question would be this: I'm writing a Python library. In fact, with any luck, it may be a rather large library, relative to my other projects. I already try to adhere to PEP 8 as much as possible, and so far I've even maintained lower_case_with_underscores as PEP 8 instructs for function and method names. But it bugs me that I have to remember to use camelCase for Twisted, camelCase for logging, and just about everything else. What naming convention should I use, and why? It would probably amaze people that I care this much about naming, enough to write a lengthy question about it, and it amazes me, too. Perhaps I have a little OCD when it comes to these things. I don't have much of a "personal opinion" about it as much as I have a tendency to just go for whatever is used the most, which in this case, would be camelCase - but it annoys me even further to find out that I'm probably breaking some eternal laws about explicit vs implicit and the zen of python written in stone or something.
For what reason do we have the lower_case_with_underscores naming convention?
1
0
0
6,910
1,740,299
2009-11-16T05:48:00.000
0
0
0
0
python,blender
1,740,306
1
true
0
1
If you mean Phantom Omni, the haptic feedback device, and you mean Blender, the rendering program, then I don't see any reason why you can't use the API for both of them in a program, together to make a game. In short, if your questions means what I think it does, of course.
1
0
0
I have some project about game programming, which have to use blender with phanthom ,Don't know possible to do it
Can i integrate Blender with Phanthom Omni
1.2
0
0
305
1,741,023
2009-11-16T09:23:00.000
2
0
0
0
python,testing,powerbuilder
1,741,142
4
false
0
1
I'm experimenting with code for a tool for automating PowerBuilder-based GUIs as well. From what I can see, your best bet would be to use the PowerBuilder Native Interface (PBNI), and call PowerScript code from within your NVO. If you like, feel free to send me an email (see my profile for my email address), I'd be interested in exchanging ideas about how to do this.
2
6
0
I'm not familiar with PowerBuilder but I have a task to create Automatic UI Test Application for PB. We've decided to do it in Python with pywinauto and iaccesible libraries. The problem is that some UI elements like newly added lists record can not be accesed from it (even inspect32 can't get it). Any ideas how to reach this elements and make them testable?
How to make PowerBuilder UI testing application?
0.099668
0
1
3,825
1,741,023
2009-11-16T09:23:00.000
1
0
0
0
python,testing,powerbuilder
2,328,021
4
false
0
1
I've seen in AutomatedQa support that they a recipe recommending using msaa and setting some properties on the controls. I do not know if it works.
2
6
0
I'm not familiar with PowerBuilder but I have a task to create Automatic UI Test Application for PB. We've decided to do it in Python with pywinauto and iaccesible libraries. The problem is that some UI elements like newly added lists record can not be accesed from it (even inspect32 can't get it). Any ideas how to reach this elements and make them testable?
How to make PowerBuilder UI testing application?
0.049958
0
1
3,825
1,742,382
2009-11-16T14:06:00.000
1
1
0
0
python,python-3.x,midi
2,089,977
1
false
0
0
Why Python 3? It generally doesn't have many libraries yet. Generally you want to look into high-level C-libraries with Python wrappers. I doubt many of these work under Python 3 at the moment.
1
4
0
Can anyone suggest a good Python 3 Library for sending / receiving reatime MIDI?
Python 3 Library for Realtime Midi Communication
0.197375
0
0
618
1,746,818
2009-11-17T05:37:00.000
0
0
1
0
python
1,746,859
2
false
0
0
You should be able to get away with installing the Python binaries in the same tree as the specific application I believe (Totally untested hunch though).
2
0
0
Various software installations on my laptop each require their own particular version of Python. ViewVC requires Python 2.5 and Blender requires Python 2.6. Mercurial (thankfully) comes with its Python interpreter packaged in a DLL in the Mercurial installation itself. How do I get by without having to install the entire Python environment each time? Is there some minimal installer which will install the bare minimum without affecting other programs? Can I modify the Blender and ViewVC installations so that they too use their own Python-in-a-DLL?
Minimal Python Installation
0
0
0
1,050
1,746,818
2009-11-17T05:37:00.000
2
0
1
0
python
1,746,927
2
true
0
0
It's hard to know which "bare minimum" the Blender scripts you'll want to use in the future may be counting on (short of the full Python standard library, which isn't all that large in term of disk space after all). Why not install both Python 2.5 and 2.6? They can coexist nicely (if your scriptable apps use hashbangs like #!/usr/bin/env python instead of specifically mentioning python2.5 or python2.6, you may need to trick out their PATHs just a little bit).
2
0
0
Various software installations on my laptop each require their own particular version of Python. ViewVC requires Python 2.5 and Blender requires Python 2.6. Mercurial (thankfully) comes with its Python interpreter packaged in a DLL in the Mercurial installation itself. How do I get by without having to install the entire Python environment each time? Is there some minimal installer which will install the bare minimum without affecting other programs? Can I modify the Blender and ViewVC installations so that they too use their own Python-in-a-DLL?
Minimal Python Installation
1.2
0
0
1,050
1,747,266
2009-11-17T07:59:00.000
27
1
0
0
python,wsgi,fastcgi
1,747,336
2
false
1
1
They are two different things. WSGI is a Python specific interface for writing web applications. There are wrappers for about any web server protocol to provide the WSGI interface. FastCGI (FCGI) is one of such web server protocols. So, WSGI is an abstraction layer, while CGI / FastCGI / mod_python are how the actual web servers talk to the application. Some code has to translate the native interface to WSGI (there is a CGI module in wsgiref, there is flup for FastCGI, etc.). There is also mod_wsgi for Apache, which does the translation directly in an Apache module, so you don't need any Python wrapper.
2
39
0
From the web I've gleaned that WSGI is a CGI for python web development/frameworks. FCGI seems to be a more generalised gateway for a variety of languages. Don't know the performance difference between the two in reference to the languages python and C/++.
Is there a speed difference between WSGI and FCGI?
1
0
0
25,057
1,747,266
2009-11-17T07:59:00.000
80
1
0
0
python,wsgi,fastcgi
1,748,161
2
true
1
1
Correct, WSGI is a Python programmatic API definition and FASTCGI is a language agnostic socket wire protocol definition. Effectively they are at different layers with WSGI being a higher layer. In other words, one can implement WSGI on top of something that so happened to use FASTCGI to communicate with a web server, but not the other way around. In general, FASTCGI being a socket wire protocol means that you always need some type of programmatic interface on top to use it. For Python one such option is WSGI. As FASTCGI is just a means to an end, one can't really compare its performance to WSGI in that case because WSGI isn't a comparable socket wire protocol, but a user of FASTCGI itself. One could try and compare performance of different language interfaces on top of FASTCGI, but in general that is quite meaningless in itself as the lower network layer and server request handling aren't the bottleneck. Instead your application code and database will be.
2
39
0
From the web I've gleaned that WSGI is a CGI for python web development/frameworks. FCGI seems to be a more generalised gateway for a variety of languages. Don't know the performance difference between the two in reference to the languages python and C/++.
Is there a speed difference between WSGI and FCGI?
1.2
0
0
25,057
1,747,501
2009-11-17T09:07:00.000
-1
0
0
0
python,django,excel,postgresql
11,293,612
9
false
1
0
Just started using XLRD and it looks very easy and simple to use. Beware that it does not support Excel 2007 yet, so keep in mind to save your excel at 2003 format.
1
3
0
How do I load data from an Excel sheet into my Django application? I'm using database PosgreSQL as the database. I want to do this programmatically. A client wants to load two different lists onto the website weekly and they don't want to do it in the admin section, they just want the lists loaded from an Excel sheet. Please help because I'm kind of new here.
Getting data from an Excel sheet
-0.022219
1
0
7,027
1,747,772
2009-11-17T09:59:00.000
1
1
0
0
python,ruby,perl,automated-tests,integration-testing
1,747,828
9
false
1
0
I would also recommend Selenium. It got a really nice Firefox Plugin, that you can use to create your integration tests.
1
10
0
I want to do full integration testing for a web application. I want to test many things like AJAX, positioning and presence of certain phrases and HTML elements using several browsers. I'm seeking a tool to do such automated testing. On the other hand; this is my first time using integration testing. Are there any specific recommendations when doing such testing? Any tutorial as well? (As a note: My backend code is done using Perl, Python and Django.) Thanks!
Integration Testing for a Web App
0.022219
0
0
5,279
1,748,482
2009-11-17T12:19:00.000
0
0
0
0
python,blender
2,397,249
1
false
0
0
You must write the plug-in for blender and used the wintracker driver. It is ready for c Lagrange. but you have "wintracker2"? I wanted to buy it but the company said "it's not ready to seal".
1
0
0
I am trying to develop a project that uses a control model in Blender by using WinTracker machine, but I don't know how to connect it with Blender Game Engine. How can I connect it with Blender Game Engine?
Python: Connect blender with WinTracker 2
0
0
0
178
1,748,923
2009-11-17T13:36:00.000
-2
0
1
0
python,file,md5,compare
1,748,934
8
false
0
0
yes, it is enough
5
9
0
Is making system call to "md5sum file1" and "md5sum file2" and compare two return values enough in this case?
How to detect whether two files are identical in Python
-0.049958
0
0
13,119
1,748,923
2009-11-17T13:36:00.000
3
0
1
0
python,file,md5,compare
1,748,938
8
false
0
0
If you're on a system with md5sum, that's probably good enough. You can do it with Python standard libraries -- checkout out hashlib.
5
9
0
Is making system call to "md5sum file1" and "md5sum file2" and compare two return values enough in this case?
How to detect whether two files are identical in Python
0.07486
0
0
13,119
1,748,923
2009-11-17T13:36:00.000
0
0
1
0
python,file,md5,compare
1,748,941
8
false
0
0
Depends if you feel comfortable with the probability of collision on the MD5 algorithm. Just note it is highly unlikely: so yes, go ahead.
5
9
0
Is making system call to "md5sum file1" and "md5sum file2" and compare two return values enough in this case?
How to detect whether two files are identical in Python
0
0
0
13,119
1,748,923
2009-11-17T13:36:00.000
7
0
1
0
python,file,md5,compare
1,749,019
8
false
0
0
Of course there is a simple test that you should do before comparing the file content at all - if the files are different sizes, then they can not possibly be the same. Wouldn't it be more efficient to simply read each file and do a byte-by-byte comparison, avoiding the hashing algorithm altogether. This avoids the the (very unlikely) chance that two different files produce the same MD5 hash. Furthermore, you can bail out of the comparison when the first difference is detected, which for very different files will be very early in the comparison (possible on the first byte!)
5
9
0
Is making system call to "md5sum file1" and "md5sum file2" and compare two return values enough in this case?
How to detect whether two files are identical in Python
1
0
0
13,119
1,748,923
2009-11-17T13:36:00.000
13
0
1
0
python,file,md5,compare
1,748,935
8
true
0
0
Well, that will tell you whether they're definitely different or probably the same. It's possible for two files to have the same hash but not actually have the same data... just very unlikely. In your situation, what is the impact if you get a false positive (i.e. if you think they're the same, but they're not)? MD5 is probably good enough not to worry about collisions if they would only occur accidentally... but if you've got security (or money) at stake and someone could plant a "bad" file with the same hash as a "good" file, you shouldn't rely on it. Personally, I'd probably just read both files, comparing each byte - for a one off comparison, both the hashing and this approach will require reading the whole file when they're equal; as Daniel points out in the comments, doing a byte-by-byte comparison lets you exit early as soon as you see a difference. Comparing the file sizes first is another quick optimization :) The general advantage of hashing occurs when you store the hash of the existing file somewhere, so that next time you can just read the new file.
5
9
0
Is making system call to "md5sum file1" and "md5sum file2" and compare two return values enough in this case?
How to detect whether two files are identical in Python
1.2
0
0
13,119
1,748,958
2009-11-17T13:40:00.000
5
0
1
1
python,windows,macos,pickle
1,748,972
2
true
0
0
Pickle with the newest protocol version and open the files in binary mode in all cases. That should solve the problem.
2
3
0
I've got a simple class that I am pickling(dumping) to a file. On OS X this works fine, and on Windows this works fine. However, while on windows I can load/unpickle the object fine - when windows then pickles this file and saves it back to disk, it becomes unreadable on OS X (although in Windows it still behaves as normal). The error I get back from OS X is that it is unable to import the require class. I'm confused as this all works fine as long as I don't pickle anything in windows! (Even then it still works fine in Windows) I've heard it could be line endings, my other thoughts are possibly something to do with the encoding type used being different across operating systems? But I really have no idea what to try to fully diagnose and/or solve this problem, so any help would be appreciated!
Unable to unpickle a file on Mac that was pickled on Windows
1.2
0
0
1,555
1,748,958
2009-11-17T13:40:00.000
3
0
1
1
python,windows,macos,pickle
1,748,998
2
false
0
0
It will be line endings - if you are using ASCII pickle open file in ascii mode 'r' or 'w' - if you are using a binary pickle open in binary mode 'rb' 'wb'. From the docstring: The default protocol is 0, to be backwards compatible. (Protocol 0 is the only protocol that can be written to a file opened in text mode and read back successfully. When using a protocol higher than 0, make sure the file is opened in binary mode, both when pickling and unpickling.)
2
3
0
I've got a simple class that I am pickling(dumping) to a file. On OS X this works fine, and on Windows this works fine. However, while on windows I can load/unpickle the object fine - when windows then pickles this file and saves it back to disk, it becomes unreadable on OS X (although in Windows it still behaves as normal). The error I get back from OS X is that it is unable to import the require class. I'm confused as this all works fine as long as I don't pickle anything in windows! (Even then it still works fine in Windows) I've heard it could be line endings, my other thoughts are possibly something to do with the encoding type used being different across operating systems? But I really have no idea what to try to fully diagnose and/or solve this problem, so any help would be appreciated!
Unable to unpickle a file on Mac that was pickled on Windows
0.291313
0
0
1,555
1,749,818
2009-11-17T15:52:00.000
0
0
0
0
python,pyqt,pyqt4,stackless,python-stackless
2,047,183
2
true
0
1
I tried to go down this path several months ago and decided it was not worth the effort. I was able to run a binary install of PyQt (on Windows) against a stackless version of Python, but I found that I had to manually go in and change some of the files. I was getting an error message (sorry, I forget what it was), and google search led to a solution from several years ago. Newer code did not include the old fix, so the change was not too difficult and (if I remember correctly) it was in python, so no recompile was necessary. But that was a deal breaker for me. Qt updates come out regularly, as do updates to PyQt, and I didn't want to be continually fixing the code. Stackless and PyQt are simply not used enough together to be checked out thoroughly. I found the risk of difficult to debug issues pretty high. This is especially true given the author of stackless has moved on to PyPy. Let me apologize in advance - I wish I had the references I found for the author stopping development on stackless python and more detail on the errors I had to fix - I wasn't expecting to regurgitate the details on Stack Overflow. So I chose to run PyQt on a vanilla Python instead of stackless. BTW, I also thought that mixing signals/slots with stackless code would be confusing, as they are completely different methods of solving multi-threading problems. Good luck!
1
4
0
What experiences do you have with Stackless Python and PyQt? Issues i would be happy if people address: Compilation of PyQt for Stackless: does PyQt need to be compiled especially for Stackless? is the compilation smooth? problems with bindings etc. Stability: any unexpected crashes, freezes, pauses and other weirdities? Memory Management: any hints of memory leaks. comparison of RAM needed for a Stackless/Plain Vanilla PyQt applications Software Engineering Empowerment: very short outline of flow-of-control models for Stackless-powered PyQt applications Lessons learned: any painful lesson learned, traps to be avoided, problems to tackle you might have experienced Be Happy
Stackless Python and PyQt
1.2
0
0
1,679
1,750,676
2009-11-17T18:01:00.000
18
0
0
0
python,django,cpu
1,756,874
4
true
1
0
FWIW, you should do the profiling, but when you do I'll bet you find that the answer is "polling for changes to your files so it can auto-reload." You might do a quick test with "python manage.py runserver --noreload" and see how that affects the CPU usage.
2
7
0
I'm noticing that my django development server (version 1.1.1) on my local windows7 machine is using a lot of CPU (~30%, according to task manager's python.exe entry), even in idle state, i.e. no request coming in/going out. Is there an established way of analysing what might be responsible for this? Thanks! Martin
Django development server CPU intensive - how to analyse?
1.2
0
0
3,645
1,750,676
2009-11-17T18:01:00.000
4
0
0
0
python,django,cpu
1,750,793
4
false
1
0
Hit Control-C and crash the process. It will probably crash somewhere that it's spending a lot of time. Or you could use a profiler.
2
7
0
I'm noticing that my django development server (version 1.1.1) on my local windows7 machine is using a lot of CPU (~30%, according to task manager's python.exe entry), even in idle state, i.e. no request coming in/going out. Is there an established way of analysing what might be responsible for this? Thanks! Martin
Django development server CPU intensive - how to analyse?
0.197375
0
0
3,645
1,750,757
2009-11-17T18:16:00.000
2
0
1
1
python,auto-update
1,750,798
8
false
0
0
The cleanest solution is a separate update script! Run your program inside it, report back (when exiting) that a new version is available. This allows your program to save all of its data, the updater to apply the update, and run the new version, which then loads the saved data and continues. To the user this can be completely transparent, as they just run the updater-shell which runs the real program.
1
47
0
I have written a script that will keep itself up to date by downloading the latest version from a website and overwriting the running script. I am not sure what the best way to restart the script after it has been updated. Any ideas? I don't really want to have a separate update script. oh and it has to work on both linux/windows too.
Restarting a self-updating python script
0.049958
0
0
41,683
1,756,096
2009-11-18T13:46:00.000
11
0
1
0
python,generator
1,932,598
13
false
0
0
I like to describe generators, to those with a decent background in programming languages and computing, in terms of stack frames. In many languages, there is a stack on top of which is the current stack "frame". The stack frame includes space allocated for variables local to the function including the arguments passed in to that function. When you call a function, the current point of execution (the "program counter" or equivalent) is pushed onto the stack, and a new stack frame is created. Execution then transfers to the beginning of the function being called. With regular functions, at some point the function returns a value, and the stack is "popped". The function's stack frame is discarded and execution resumes at the previous location. When a function is a generator, it can return a value without the stack frame being discarded, using the yield statement. The values of local variables and the program counter within the function are preserved. This allows the generator to be resumed at a later time, with execution continuing from the yield statement, and it can execute more code and return another value. Before Python 2.5 this was all generators did. Python 2.5 added the ability to pass values back in to the generator as well. In doing so, the passed-in value is available as an expression resulting from the yield statement which had temporarily returned control (and a value) from the generator. The key advantage to generators is that the "state" of the function is preserved, unlike with regular functions where each time the stack frame is discarded, you lose all that "state". A secondary advantage is that some of the function call overhead (creating and deleting stack frames) is avoided, though this is a usually a minor advantage.
1
239
0
I am reading the Python cookbook at the moment and am currently looking at generators. I'm finding it hard to get my head round. As I come from a Java background, is there a Java equivalent? The book was speaking about 'Producer / Consumer', however when I hear that I think of threading. What is a generator and why would you use it? Without quoting any books, obviously (unless you can find a decent, simplistic answer direct from a book). Perhaps with examples, if you're feeling generous!
Understanding generators in Python
1
0
0
151,393
1,757,276
2009-11-18T16:32:00.000
4
0
0
1
python,ftp,client,twisted
1,757,848
1
true
0
0
There are a couple unit tests for behavior in this area. twisted.test.test_ftp.FTPClientTestCase.test_failedRETR is the most directly relevant one. It covers the case where the control and data connections are lost while a file transfer is in progress. It seems to me that test coverage in this area could be significantly improved. There are no tests covering the case where just the data connection is lost while a transfer is in progress, for example. One thing that makes this tricky, though, is that FTP is not a very robust protocol. The end of a file transfer is signaled by the data connection closing. To be safe, you have to check to see if you received as many bytes as you expected to receive. The only way to perform this check is to know the file size in advance or ask the server for it using LIST (FTPClient.list). Given all this, I'd suggest that when a file transfer completes, you always ask the server how many bytes you should have gotten and make sure it agrees with the number of bytes delivered to your protocol. You may sometimes get an errback on the Deferred returned from retrieveFile, but this will keep you safe even in the cases where you don't.
1
3
0
I'm writing a custom ftp client to act as a gatekeeper for incoming multimedia content from subcontractors hired by one of our partners. I chose twisted because it allows me to parse the file contents before writing the files to disk locally, and I've been looking for occasion to explore twisted anyway. I'm using 'twisted.protocols.ftp.FTPClient.retrieveFile' to get the file, passing the escaped path to the file, and a protocol to the 'retrieveFile' method. I want to be absolutely sure that the entire file has been retrieved because the event handler in the call back is going to write the file to disk locally, then delete the remote file from the ftp server alla '-E' switch behavior in the lftp client. My question is, do I really need to worry about this, or can I assume that an err back will happen if the file is not fully retrieved?
Checking files retrieved by Twisted's FTPClient.retrieveFile method for completeness
1.2
0
0
1,008
1,758,276
2009-11-18T19:02:00.000
5
0
0
0
python,telnet
1,758,310
4
false
0
0
Make the Python script into the shell for that user. (Or if that doesn't work, wrap it up in bash script or even a executable). (You might have to put it in /etc/shells (or equiv.))
2
3
0
How can I run a Python program so it outputs its STDOUT and inputs its STDIN to/from a remote telnet client? All the program does is print out text then wait for raw_input(), repeatedly. I want a remote user to use it without needing shell access. It can be single threaded/single user.
How can I run a Python program over telnet?
0.244919
0
1
953
1,758,276
2009-11-18T19:02:00.000
0
0
0
0
python,telnet
1,760,716
4
false
0
0
You can just create a new linux user and set their shell to your script. Then when they telnet in and enter the username/password, the program runs instead of bash or whatever the default shell is.
2
3
0
How can I run a Python program so it outputs its STDOUT and inputs its STDIN to/from a remote telnet client? All the program does is print out text then wait for raw_input(), repeatedly. I want a remote user to use it without needing shell access. It can be single threaded/single user.
How can I run a Python program over telnet?
0
0
1
953
1,758,819
2009-11-18T20:27:00.000
6
0
1
1
python
1,758,845
4
false
0
0
If you compile python with readline support, the REPL environment should do this for you.
1
2
0
I am using the python prompt to practice some regular expressions. I was wondering if there was a way to use the up/down arrows (like bash) to cycle through the old commands typed. I know its possible since it works on python on cygwin/windows. thanks
python prompt with a bash like interface
1
0
0
1,113
1,759,619
2009-11-18T22:29:00.000
0
0
1
0
python,popen,newline
1,761,077
6
false
0
0
You can do s = s.replace('\r', '') too.
1
3
0
When you run something through popen in Python, the results come in from the buffer with the CR-LF decimal value of a carriage return (13) at the end of each line. How do you remove this from a Python string?
Remove from python string
0
0
0
19,650
1,760,025
2009-11-19T00:05:00.000
12
0
1
0
python,memory,jvm
1,760,046
3
true
1
0
On *nix you can play around with the ulimit command, specifically the -m (max memory size) and -v (virtual memory).
1
20
0
I'm trying to find a way to limit the memory available for the Python VM, as the option "-Xmx" in the Java VM does. (The idea is to be able to play with the MemoryError exception) I'm not sure this option exist but there may be a solution using a command of the OS to "isolate" a process and its memory. Thank you.
Limit Python VM memory
1.2
0
0
13,726
1,760,963
2009-11-19T04:53:00.000
5
0
1
0
python,django
1,760,987
3
true
1
0
from myproject.folder import file (horrible name, btw, trampling over the builtin type file, but that's another rant;-), then use file.function -- if file (gotta hate that module name;-) is still too long for you, add e.g. as fi to the from statement, and use fi.function. If you want to rename myproject to myhorror, you only need to touch the from statements addressing it (you could use relative imports, but those would break 2.5 compatibility and therefore ban you from App Engine for now -- too high a price to pay for minor convenience, for me at least;-). Edit: if just about every file needs some given supporting module, that's a powerful reason for making sure that supporting module lives in a directory (or zipfile) that's on sys.path (it's probably worth doing even if, say, only 30% of the files need that supporting module!-).
1
4
0
I'm working on a Django project. Let's call it myproject. Now my code is littered with myproject.folder.file.function. Is there anyway I can remove the need to prefix all my imports and such with myproject.? What if I want to rename my project later? It kind of annoys me that I need to prefix stuff like that when the very file I'm importing it from is inside that same project. Shouldn't be necessary.
Shorten Python imports?
1.2
0
0
3,580
1,761,473
2009-11-19T07:20:00.000
-1
0
0
0
python,cookies,webkit
1,762,266
2
true
0
1
webkit is a html renderer, not a complete browser. I guess you must deal with persisting the cookies yourself.
1
2
0
The documentation for pyWebKitGTK is pretty scarce. I've looked through their python .def files but they don't seem to contain the words cookie, session, (lib)soup or (lib)curl.. so maybe it isn't possible, huh. I've also looked through the WebKitGTK docs (for the C-based library) and aside from a brief mention of libsoup there doesn't appear to be anything there either. But on the other hand cookie support seems like pretty fundamental stuff. Could anyone confirm / deny PyWebKitGTK's support of cookies? Note: am currently using the GTK version, but I don't mind switching to the Qt one if the feature is there.
How to enable cookie support with pyWebKit?
1.2
0
0
2,065
1,761,663
2009-11-19T08:05:00.000
0
1
0
0
python,image,testing,opencv
1,762,591
2
false
0
0
What's wrong with the "gold file" technique? It's part of your test fixture. Every test has a data fixture that's the equivalent to the "gold file" in a media-intensive application. When doing ordinary TDD of ordinary business applications, one often has a golden database fixture that must be used. Even when testing simple functions and core classes of an application, the setUp method creates a kind of "gold file" fixture for that class or function. What's wrong with that technique? Please update your question with the specific problems you're having.
1
2
0
What's are some ways of testing complex data types such as video, images, music, etc. I'm using TDD and wonder are there alternatives to "gold file" testing for rendering algorithms. I understand that there's ways to test other parts of the program that don't render and using those results you can infer. However, I'm particularly interested in rendering algorithms specifically image/video testing. The question came up while I was using OpenCV/Python to do some basic facial recognition and want to verify its correctness. Even if there's nothing definitive any suggestion will help.
Testing complex datatypes?
0
0
0
229
1,764,548
2009-11-19T16:21:00.000
1
0
1
0
python,64-bit,long-integer
1,764,630
4
false
0
0
Have a look at the ctypes module, it is used to call foreign DLLs/libraries from python. There a some data types that correspond to C types, for example class c_longlong
1
13
0
I would like to represent a value as a 64bit signed long, such that values larger than (2**63)-1 are represented as negative, however Python long has infinite precision. Is there a 'quick' way for me to achieve this?
Python type long vs C 'long long'
0.049958
0
0
38,686
1,765,560
2009-11-19T18:36:00.000
4
0
1
0
python,scheme
1,765,688
4
true
0
0
In Python variable scope can be either global or function. In Scheme, the scope can be any block. For example, in Scheme you could define a variable inside a loop, and it wouldn't be accessible from outside the loop. In Python, the scope being the whole function, this variable would 'leak' out of the loop into the rest of the function. About your specific question: note that anonymous (lambda) functions in Python are horribly limited (just a single expression, no if/then statements, loops, etc.), so you usually define complete (named) inner functions. In this case the scope rules are similar to Scheme: the inner function can access the outer function's variables (creating a closure), and the outer function can't access variables defined inside the inner function. In short: lexical scoping and closures work as expected; just remember that the scoping granularity is per function, not per block.
2
1
0
Refering to Variable Scoping. I'm trying to figure out what are the differences between those 2. For example, Anonymous functions in a scheme function has access to the variables local to that function. Does python have this? Thanks!
What are the differences in variable scoping between Python and Scheme?
1.2
0
0
384
1,765,560
2009-11-19T18:36:00.000
0
0
1
0
python,scheme
1,765,610
4
false
0
0
Yes, Python has the ability to access variables that are local to an anonymous function (in Python, this is called a lambda function) within that function. I'm not entirely sure if that answered you question, so if it didn't, please post some more detail
2
1
0
Refering to Variable Scoping. I'm trying to figure out what are the differences between those 2. For example, Anonymous functions in a scheme function has access to the variables local to that function. Does python have this? Thanks!
What are the differences in variable scoping between Python and Scheme?
0
0
0
384
1,766,510
2009-11-19T21:02:00.000
3
0
1
0
python,escaping,backslash
1,766,537
3
true
0
0
If you are asking for the user for input, then a \ will go into a string as a \ correctly. Only if you then eval the user's string in some way will the backslash count as an escape char. You really only need to worry about escaping when you are writing strings within the code.
2
1
0
I'm making a program that asks for a path, and Windows' paths contain backslashes, which can be interpreted as an escape sequence by python if the letter right next is the wrong one. I tried string.replace() but it doesn't work as these backslashes get transformed into escape sequences before having the replace function executed. Is there a way to remove them and maybe make them / instead of \?
Python, removing the \'s before getting them processed
1.2
0
0
2,514
1,766,510
2009-11-19T21:02:00.000
6
0
1
0
python,escaping,backslash
1,766,531
3
false
0
0
No, the backslash is not interpreted as an escape sequence except in Python source code. Unless you're eval()ing the path, which would be Wrong, I'm not sure why you'd have a problem.
2
1
0
I'm making a program that asks for a path, and Windows' paths contain backslashes, which can be interpreted as an escape sequence by python if the letter right next is the wrong one. I tried string.replace() but it doesn't work as these backslashes get transformed into escape sequences before having the replace function executed. Is there a way to remove them and maybe make them / instead of \?
Python, removing the \'s before getting them processed
1
0
0
2,514
1,767,575
2009-11-20T00:24:00.000
0
0
0
0
python,windows,keyboard
1,773,644
3
false
0
1
I've used AutoIt (via it's COM interface) a lot of times
1
2
0
The problem I have is that I have this Python script to launch a application. After the application is launched (the GUI is shown on screen), I want to make it de-activated. It can be done manually by activating another window, or minimizing this app, or pressing the Show Desktop key for WindowsXP. So is there any way that I can do this by Python? Core or 3rd party library would be all ok. Thanks!
Are there any libraries for Python to simulate keyboard action?
0
0
0
1,789
1,768,179
2009-11-20T03:34:00.000
2
0
0
0
jquery,python,django
1,768,324
1
true
1
0
i think you have few options Just change thumbnail at runtime based on $(window).width(); using jquery Pass on screen resolution to django first time from client side, and later store it in session and render templates accordingly Sometime you may get screen resolution in request headers, i am not sure though Best would be to design a general solution which doesn't depend on screen resolution, and scaling 150x150 to 100x100 shouldn't be a problem on client side.
1
0
0
In a thumbnail website, if I want to display 100x100 thumbs on screnn resolutions lower than 1280x1024 while display 150x150 thumbs for screens higher than 1280x1024, is the following procedure correct? Render a page frame with no thumbs by view1() On page frame loaded, it detects client's screen resolution and pass it to another Django view call fetchthumb() View fetchthumb() create html code containing the thumb images and return to page frame. jQuery on page frame render thumb html on browser. Are there any better methods?
Different response by screen solutions using Django and jQuery
1.2
0
0
2,312
1,769,403
2009-11-20T09:40:00.000
4
0
1
0
python,keyword-argument
1,769,644
13
false
0
0
kwargs are a syntactic sugar to pass name arguments as dictionaries(for func), or dictionaries as named arguments(to func)
1
821
0
What are the uses for **kwargs in Python? I know you can do an objects.filter on a table and pass in a **kwargs argument.   Can I also do this for specifying time deltas i.e. timedelta(hours = time1)? How exactly does it work? Is it classes as 'unpacking'? Like a,b=1,2?
What is the purpose and use of **kwargs?
0.061461
0
0
650,544
1,770,312
2009-11-20T13:04:00.000
0
0
0
1
python,macos,sendkeys
1,770,681
5
false
0
0
Maybe you could run an OSA script (man osascript) from Python, for instance, and drive the application?
1
19
0
In Mac 10.6, I want to cause an active application to become de-active, or minimized by Python I know I could use sendKey in Windows with Python, then what about in Mac?
Is there a sendKey for Mac in Python?
0
0
0
19,837
1,770,754
2009-11-20T14:25:00.000
1
0
1
1
python,twisted,py2exe
1,770,870
1
true
0
0
The typical use of the reactor is not to call reactor.iterate. It's hard to say why exactly you're getting the behavior you are without seeing your program, but for a wild guess, I'd say switching to reactor.run might help.
1
1
0
I'm currently using an application in python which works quite well but when I'm converting it with py2exe, the application seems to be suspended at the first "reactor.iterate" Each time I press Ctrl+C to stop the application, the error is always the same and the application seems to be bloqued on a "reactor.iterate(4)" This problem never occur with normal python interpreter. Have you got an idea ?
reactor.iterate seems to block a program with Py2exe
1.2
0
0
116
1,772,133
2009-11-20T17:41:00.000
2
1
0
0
python,svn,ssh,pysvn
1,773,231
1
true
0
0
Check out ssh configuration option PasswordAuthentication. I'm not sure how pysvn interacts with ssh, but if you set this to no in your ~/.ssh/config (or maybe global config?) then it shouldn't prompt for a password.
1
5
0
I'm working with pysvn, and I'm trying to find a decent way to handle repositories that are only accessible via svn+ssh. Obviously SSH keys make this all incredibly easy, but I can't guarantee the end user will be using an SSH key. This also has to be able to run without user interaction, because it's going to be doing some svn log parsing. The big issue is that, with svn+ssh an interactive prompt is popped up for authentication. Obviously I'd like to be able to have pysvn automatically login with a set of given credentials, but set_default_username and set_default_password aren't doing me any good in that respect. If I can't have that, I'd at least like to able to just fail out, and log a message to tell the user to setup an SSH key. However, set_interactive seems to have no bearing on this either, and I'm still prompted for a password with client.log('svn+ssh://path'). Any thoughts on how to tackle this issue? Is it even really possible to handle this without SSH keys, since it's SSH that's throwing the prompts?
pysvn with svn+ssh
1.2
0
0
1,664
1,772,599
2009-11-20T19:02:00.000
2
0
1
0
python,video,thumbnails
1,844,330
9
false
0
0
You could use the Youtube API for storage and transcoding and grab the feed thumbnails for free. Honestly, that's the easiest way to handle online video and I'm not just shilling a 3rd party service, I'm a very happy user of that API and the internal video paths I was able to delete thanks to it.
1
31
0
I need to create thumbnails for a video file once I've uploaded to a webapp running python. How would I go about this... I need a library that can basically either do this for me, or that can read the image frames out of video files (of several formats) automatically.
Creating thumbnails from video files with Python
0.044415
0
0
35,280
1,773,063
2009-11-20T20:30:00.000
0
1
1
0
c#,python,programming-languages
1,773,322
13
false
0
0
Don't get me wrong, I am and will always be a devoted fan of C#. But sometimes there are things I can't do in C#. lthough C# keeps reducing those gaps, Python is still the language I go to to fill them. It's dynamic, flexible, powerful, and clean. Lovely language. Whenever I need to script or build dynamic or functional (as in functional programming) software, I go Python.
10
20
0
For someone who’s been happily programming in C# for quite some time now and planning to learn a new language I find the Python community more closely knit than many others. Personally dynamic typing puts me off, but I am fascinated by the way the Python community rallies around it. There are a lot of other things I expect I would miss in Python (LINQ, expression trees, etc.) What are the good things about Python that developers love? Stuff that’ll excite me more than C#.
What Python features will excite the interest of a C# developer?
0
0
0
3,108
1,773,063
2009-11-20T20:30:00.000
1
1
1
0
c#,python,programming-languages
1,773,317
13
false
0
0
Like any programming language, it is just a tool in the box or a brush by which you may paint your creation. Any creative endeavour requires that the artist loves the tools he uses; otherwise, the outcome suffers. Some people like Python for the same reason others love Perl. Incidentally, I have found that most Python lovers loathe Perl's flexible and expressive syntax. As a Perl lover, I don't hate Python, but consider it to be overly structured and restrictive. If you ask me, all of these throngs of people who seem to love Python were silently suffering under the tool choices before Python came into being. Some suffered under Perl, others under something else. In other words, I believe that when Python came along, it found a large group of silent sufferers longing for a tool like Python. I can't program in Python because I can't "think" in Python. I can "think" in Perl, therefore, it is the tool I prefer. The silently suffering mass of, now, Python users seem to have found some long lost salvation. Now if they could only keep their evangelism to themselves :).
10
20
0
For someone who’s been happily programming in C# for quite some time now and planning to learn a new language I find the Python community more closely knit than many others. Personally dynamic typing puts me off, but I am fascinated by the way the Python community rallies around it. There are a lot of other things I expect I would miss in Python (LINQ, expression trees, etc.) What are the good things about Python that developers love? Stuff that’ll excite me more than C#.
What Python features will excite the interest of a C# developer?
0.015383
0
0
3,108
1,773,063
2009-11-20T20:30:00.000
11
1
1
0
c#,python,programming-languages
1,773,987
13
false
0
0
I'm a very heavy user of both C# and Python; I've built very complicated applications in both languages, and I've also embedded Python scripting in my major C# application. I'm not using either to do much in the way of web work right now, but other than that I feel like I'm pretty qualified to answer the question. The things about Python that excite me, in particular: The deep integration of generators into the language. This was the first thing that made me realize that I needed to take a long, serious look at Python. My appreciation for this has deepened considerably since I've become conversant with the itertools module, which looks like a nifty set of tools but is in fact a new way of life. The coupling of dynamic typing and the fact that everything's an object makes pretty sophisticated techniques extremely simple to implement. It's so easy to replace logic with tables in Python (e.g. o = class_map[k]() instead of if k='foo': o = Foo()) that it becomes a basic technique. It's so normal in Python to write methods that take methods as parameters that you don't raise an eyebrow when you see d = defaultdict(list). zip, and the methods that are designed with it in mind. It takes a while before you can intuitively grasp what dict(zip(k, v)) and d.update(zip(k, v)) are doing, but it's a paradigm-shifting moment when you get there. An entire universe of uninteresting and potentially error-laden code eliminated, just by using one function. Then you start designing functions and classes with the expectation that they'll be used in conjunction with zip, and suddenly your code gets simpler and easier. (Protip: Or itertools.izip. Or itertools.izip_longest.) Speaking of dictionaries, the way that they're deeply integrated into the language. Understanding what a line of code like self.__dict__.update(**kwargs) does is another one of those paradigm-shifting moments. List comprehensions and generator expressions, of course. Inexpensive exceptions. An interactive intepreter. Function decorators. IronPython, which is so much simpler to use than we have any right to expect. And that's without even getting into the remarkable array of functionality in the standard modules, or the ridiculous bounty of third-party tools like BeautifulSoup or SQL Alchemy or Pylons. One of the most direct benefits that I've gotten from getting deeply into Python is that it has greatly improved my C# code. I could generally understand code that had a variable of type Dictionary<string, Action<Foo>> in it, but it didn't seem natural to write it. (I use static dictionaries to replace hard-coded logic far more frequently today than I did a year ago.) I have no difficulty understanding what LINQ is doing now, or how IEnumerable<T> and return yield work. So what don't I like about Python? Dynamic typing really limits what you can do with static code analysis. Not only isn't there a tool like Resharper for Python, in a language where it's possible to write getattr(x, y)() there really can't be. It has a bunch of inelegant conventions. How I would love to be able to go back in time and try to talk GVR out of the idea that lambda expressions should be introduced with the word lambda - it's pretty damning that something as fundamental as lambda expressions should be more concise in C# than they are in Python. The leading and trailing double-underscore convention is horrible, and the fact that people mutely acquiesce to it is testimony to Dostoevsky's observation that man is the animal who can get used to anything. And don't get me started on the fact that a module with the name of StringIO was allowed to get out the door. Some of the features that make Python work on multiple platforms also make it kind of baffling. It's easy to use import, but it's really not easy to understand what the hell it's actually doing. (Where is it looking? What does __init__.py do? Etc.) The amazingly rich library of standard modules is so amazingly rich that it's hard to know what's in it. It's often easier to write a function than it is to find out whether or not there's something in the standard library that does the same thing - I'm looking at you, itertools.chain.
10
20
0
For someone who’s been happily programming in C# for quite some time now and planning to learn a new language I find the Python community more closely knit than many others. Personally dynamic typing puts me off, but I am fascinated by the way the Python community rallies around it. There are a lot of other things I expect I would miss in Python (LINQ, expression trees, etc.) What are the good things about Python that developers love? Stuff that’ll excite me more than C#.
What Python features will excite the interest of a C# developer?
1
0
0
3,108
1,773,063
2009-11-20T20:30:00.000
10
1
1
0
c#,python,programming-languages
1,773,278
13
false
0
0
Your question is kind of like a plumber asking why carpenters are always going on and on about hammers. After all the plumber doesn't have a hammer and has never missed it. Python (even IronPython) and C# target different types of developers and different types of programs. I am very comfortable in Python and enjoy the freedom to focus on the business rules without being distracted by the syntax requirements of the language. On the other hand I have written some fairly substantial code in C# and would be very concerned about the lack of type safety had I taken on the same task in Python. This is not to say that Python is a "toy" language. You can (and people have) write a complete medium or large application in Python. You have the freedom of dynamic typing, but you also have the responsibility to keep it all straight (frameworks help here). Similarly you can write a small application in C#, but you will bring along some overhead you do not likely need. So if the problem is a nail use a hammer, if the problem is a screw use a screw driver. In other words spend some time to learn Python, get to know it's streangths (text processing, quick coding cycles, simple clean code, etc) and then when you are looking at tackling a new problem ask whether you would be better off in Python or C#. One thing is certain. So long as C# is the only programming language you know, it is the only one you will ever use. Pat O
10
20
0
For someone who’s been happily programming in C# for quite some time now and planning to learn a new language I find the Python community more closely knit than many others. Personally dynamic typing puts me off, but I am fascinated by the way the Python community rallies around it. There are a lot of other things I expect I would miss in Python (LINQ, expression trees, etc.) What are the good things about Python that developers love? Stuff that’ll excite me more than C#.
What Python features will excite the interest of a C# developer?
1
0
0
3,108
1,773,063
2009-11-20T20:30:00.000
2
1
1
0
c#,python,programming-languages
1,773,315
13
false
0
0
I'm an asymmetrical user of both languages, in a sense that I use C# mostly professionally and Python for all my "fun" projects (not that work is never fun, but... you know...) This difference of context may skew my perspective, including my opinion that they are two distinct types (pun intended) of languages for, generally, distinct purposes. This said, it may not be a coincidence that Python is, at this point in time, [one of?] the languages of choice for all kinds of cutting edge, somewhat scholarly, technology/science oriented projects. (And BTW, this "scholarly" keyword here doesNOT imply, that Python is a university toy, plenty of "serious" applications in plenty of domains/industry are proof to the contrary). This may be due to several factors: (I don't develop most points, readily well expressed in other responses) the openness and quasi universal availability of Python (unlike C# !) the lightweight / ease of use / low learning curve the extensive, high quality, "standard" library and the extensiver (and occasionally bum quality, but on the whole available, open-sourced, etc.) additional library. the wide array of open source projects in Python language the relative ease to bind with C/C++ for reusing legacy code, but also for placing performance-critical portions of a project the generally higher level of abstraction of may constructs of the language the multi-paradigms (imperative, object oriented and functional) the availability of practitioners in so many domain of science and technology and, yes, the "herd mentality effect" mentioned in a remark, possibly in a [self?] deriding way. The fact that a language attracts a broad, "closely knit" community, makes it attractive too, beyond the superficial ("look cool" and such) traits of herd mentality. Put in broader context, sometimes the best technology/language to use is not measured on the its intrinsic merits but on the overall "picture", including the user community.
10
20
0
For someone who’s been happily programming in C# for quite some time now and planning to learn a new language I find the Python community more closely knit than many others. Personally dynamic typing puts me off, but I am fascinated by the way the Python community rallies around it. There are a lot of other things I expect I would miss in Python (LINQ, expression trees, etc.) What are the good things about Python that developers love? Stuff that’ll excite me more than C#.
What Python features will excite the interest of a C# developer?
0.03076
0
0
3,108
1,773,063
2009-11-20T20:30:00.000
18
1
1
0
c#,python,programming-languages
1,773,087
13
false
0
0
For me its the flexibility and elegance, but there are a handful of things I wish could be pulled in from other languages though (better threading, more robust expressions). In typical I can write a little bit of code in python and do a lot more than the same amount of lines in many other languages. Also, in python code form is of utmost importance and the syntax lends its self to highly readable, clean looking code. That of course helps out with maintenance. I love having a command line interpreter that I can quickly prototype an algorithm in rather than having to start up a new project, code, compile, test, repeat. Not to mention the fact I can use it to help me automate my server maintenance as well (I double as a SA for my company). The last thing that comes to mind immediately is the vast amounts of libraries. There are a lot of things already solved out there, the built-in library has a lot to offer, and the third party ones are many times very good (not always though).
10
20
0
For someone who’s been happily programming in C# for quite some time now and planning to learn a new language I find the Python community more closely knit than many others. Personally dynamic typing puts me off, but I am fascinated by the way the Python community rallies around it. There are a lot of other things I expect I would miss in Python (LINQ, expression trees, etc.) What are the good things about Python that developers love? Stuff that’ll excite me more than C#.
What Python features will excite the interest of a C# developer?
1
0
0
3,108
1,773,063
2009-11-20T20:30:00.000
15
1
1
0
c#,python,programming-languages
1,773,082
13
false
0
0
Being able to type in some code and get the result back immediately. (Disclaimer: I use both C# and Python regularly, and I think both have their good and bad points.)
10
20
0
For someone who’s been happily programming in C# for quite some time now and planning to learn a new language I find the Python community more closely knit than many others. Personally dynamic typing puts me off, but I am fascinated by the way the Python community rallies around it. There are a lot of other things I expect I would miss in Python (LINQ, expression trees, etc.) What are the good things about Python that developers love? Stuff that’ll excite me more than C#.
What Python features will excite the interest of a C# developer?
1
0
0
3,108
1,773,063
2009-11-20T20:30:00.000
11
1
1
0
c#,python,programming-languages
1,773,224
13
true
0
0
I'm primarily .NET developer and using Python for me personal projects. What are the good things about python that developers love? I can say for myself - Python is like a breath of fresh air. 1) It's simple to learn, took about a week for me in the evenings. I'm saying about Python + Django. Python syntax is quite simple. 2) It's simple to use. No troubles installing Python + Django on Windows at all. 3) It can be run on Windows and UNIX. 4) I need it for web, so I get cheaper hosting than ASP.NET. 5) All the advantages of Python language over C#. Like tuples - so useful! The only thing I don't like is that my favorite IDE Visual Studio doesn't support it (I know about IronPython, don't you worry).
10
20
0
For someone who’s been happily programming in C# for quite some time now and planning to learn a new language I find the Python community more closely knit than many others. Personally dynamic typing puts me off, but I am fascinated by the way the Python community rallies around it. There are a lot of other things I expect I would miss in Python (LINQ, expression trees, etc.) What are the good things about Python that developers love? Stuff that’ll excite me more than C#.
What Python features will excite the interest of a C# developer?
1.2
0
0
3,108
1,773,063
2009-11-20T20:30:00.000
1
1
1
0
c#,python,programming-languages
1,773,215
13
false
0
0
I like all stuff with [] and {}. Selectors like this [-1:1]. Possibility to write less code, but more something meaningfull, that gives to write Models and other declarative things very DRY.
10
20
0
For someone who’s been happily programming in C# for quite some time now and planning to learn a new language I find the Python community more closely knit than many others. Personally dynamic typing puts me off, but I am fascinated by the way the Python community rallies around it. There are a lot of other things I expect I would miss in Python (LINQ, expression trees, etc.) What are the good things about Python that developers love? Stuff that’ll excite me more than C#.
What Python features will excite the interest of a C# developer?
0.015383
0
0
3,108
1,773,063
2009-11-20T20:30:00.000
0
1
1
0
c#,python,programming-languages
1,773,312
13
false
0
0
The main thing I like about Python is its very concise, readable syntax. Though using indentation as a block delimiter can seem strange at first, once you begin to code a lot in the language I find it begins to make sense. Though the core language is quite simple, its more advanced features, e.g. list comprehension, decorators and generators, are rather useful too. In addition, the Python standard library is just fantastic; its documentation is very well written, and it contains a lot of very useful packages. I also find that there are plenty of good bindings for C libraries, such as PyGTK, Webkit and Qt, to name but a few. One caveat is that Python, like most dynamic languages, is quite slow in comparison with compiled, statically-typed languages. However, you can easily extend it with C, allowing you to write code requiring better performance in C and the rest in Python. It's a great language overall, and (for me at least) makes coding more productive and enjoyable.
10
20
0
For someone who’s been happily programming in C# for quite some time now and planning to learn a new language I find the Python community more closely knit than many others. Personally dynamic typing puts me off, but I am fascinated by the way the Python community rallies around it. There are a lot of other things I expect I would miss in Python (LINQ, expression trees, etc.) What are the good things about Python that developers love? Stuff that’ll excite me more than C#.
What Python features will excite the interest of a C# developer?
0
0
0
3,108
1,773,222
2009-11-20T21:02:00.000
3
1
1
0
python,tcl,tkinter,tk
1,773,435
1
false
0
1
The files you found are for linking directly to tcl/tk. Python depends on another library as well: _tkinter.so. It should be in /usr/lib/python2.5/lib-dynload/_tkinter.so. How did you install python2.5? If you are using Debian or Ubuntu you need to install the python-tk package to get Tkinter support. If the _tkinter.so file is there, your environment could be causing problems. If python -E -c "import Tkinter;Tkinter._test()" suceeds, but python -c "import Tkinter;Tkinter._test()" fails, then the problem is with how your environment is set up. Check the value of PYTHONPATH is set correctly.
1
0
0
I have an existing Python 2.4 and it is working properly with tkinter as I tested it using python import _tkinter import Tkinter Tkinter._test() Now, I have installed python 2.5.2 but when I try the same tests (with the newer version), it returns (but the same tests are working for the previous version) ImportError: No module named _tkinter I know that tcl8.5 and tk8.5 are installed on my machine as the following commands return there locations whereis tcl tcl: /usr/lib/tcl8.4 /usr/local/lib/tcl8.5 /usr/local/lib/tcl8.4 /usr/share/tcl8.4 whereis tk tk: /usr/lib/tk8.4 /usr/local/lib/tk8.5 /usr/share/tk8.4 Any ideas how do I make my newer python version work with tkinter?
Linking Tcl/Tk to Python 2.5
0.53705
0
0
1,073
1,774,915
2009-11-21T08:12:00.000
1
1
0
0
python,django
11,819,696
3
false
1
0
Amir Hussain, Yahoo mail using captcha, so it will not works for any scripts or service unless they have managed service with the help of a third party for captcha decoder. So u have to contact a service provider who provide managed service. As far as I know, Improsys is the first Address Grabber marketer and they have managed service. They have this tool available for Classic ASP, ASP.Net, .Net, Ruby on Rails, PHP, Cold Fusion, JAVA, JSP and Perl. Microsoft Outlook and Outlook Express. Actually I am using their service. Their service is satisfactory but the cost is too high.
1
5
0
How can I import contacts of given email id/pwd from gmail yahoo hotmail etc using python/django application. Please suggest?
how to import contacts from various services like gmail or yahoo using python/django
0.066568
0
0
2,955
1,775,637
2009-11-21T14:38:00.000
1
0
1
0
python,tags
1,778,174
5
false
0
0
Train Bayes or Fischer filter with already tagged data (e.g. with Stackoverflow data dump suggested by sth) and use it to classify new posts. I'd recommend reading excellent Programming Collective Intelligence book by Toby Segaran for more information and python examples on this topic.
2
4
0
How can I pick tags from an article or a user's post using Python? Is the following method ok? Build a list of word frequency from the text and sort them. Remove some common words and pick the top 10 words remained in the list as the tags. If the above method is ok, what library can detect if which words are common, like "the, if, you, etc" and which are descriptive words?
Automatically pick tags from context using Python
0.039979
0
0
481
1,775,637
2009-11-21T14:38:00.000
0
0
1
0
python,tags
1,775,731
5
false
0
0
Instead of blacklisting words that shouldn't be tags, why don't you instead build a whitelist of words that would make for good tags? Start with an handful of tags that you would like to have, like Python, off-topic, football, rickroll or whatnot (depends on the kind of site you are building!) and have the system only suggest between those, then let users handpick appropriate tags and also let them type in their own tags. When enough users suggest a tag, it gets into the pool of "known good" tags for auto suggestion -- maybe after some sort of moderation, so that you can still blacklist stupid tags like the, lolol, or typoed tags like objectoriented when you have object-oriented. Only show few suggestions. Offer autocompletion. Limit the number of tags per item. If this will be about coding, maybe some sort of language detection system (the file linux command is not too shabby on this) will help your suggestion system.
2
4
0
How can I pick tags from an article or a user's post using Python? Is the following method ok? Build a list of word frequency from the text and sort them. Remove some common words and pick the top 10 words remained in the list as the tags. If the above method is ok, what library can detect if which words are common, like "the, if, you, etc" and which are descriptive words?
Automatically pick tags from context using Python
0
0
0
481
1,775,954
2009-11-21T16:34:00.000
4
1
1
0
python,macos,python-3.x,textmate
7,792,338
4
false
0
0
the shebang is the best solution, to see where python 3 is installed type in terminal: which python3 you will get something like this: /usr/local/bin/python3 if nothing shows up first install python3 and at the top of your script insert: #!/usr/local/bin/python3
1
28
0
TextMate seems to use the built-in Python version I assume (sys.path doesn't work). How do you configure it to use 3.1 instead? I've already installed the 3.1 package and I can use IDLE for interactive sessions, but I need to use TextMate now. Thanks
Using Python 3.1 with TextMate
0.197375
0
0
17,177
1,776,066
2009-11-21T17:11:00.000
7
0
1
0
python,html,unicode,python-3.x,newline
1,776,100
6
false
1
0
normally I do like this s=s.replace("\n","<br />\n") because <br /> is needed in web page display and \n is needed in source display. just my 2 cents
1
7
0
I have upgraded to Python 3 and can't figure out how to convert backslash escaped newlines to HTML. The browser renders the backslashes literally, so "\n" has no effect on the HTML source. As a result, my source page is all in one long line and impossible to diagnose.
Python 3: Write newlines to HTML
1
0
0
25,316
1,776,290
2009-11-21T18:24:00.000
13
0
0
0
python,matlab
1,777,708
8
false
0
0
I've been programming with Matlab for about 15 years, and with Python for about 10. It usually breaks down this way: If you can satisfy the following conditions: 1. You primarily use matrices and matrix operations 2. You have the money for a Matlab license 3. You work on a platform that mathworks supports Then, by all means, use Matlab. Otherwise, if you have data structures other than matrices, want an open-source option that allows you to deliver solutions without worrying about licenses, and need to build on platforms that mathworks does not support; then, go with Python. The matlab language is clunky, but the user interface is slick. The Python language is very nice -- with iterators, generators, and functional programming tools that matlab lacks; however, you will have to pick and choose to put together a nice slick interface if you don't like (or can't use) SAGE. I hope that helps.
1
18
1
i am a engineering student and i have to do a lot of numerical processing, plots, simulations etc. The tool that i use currently is Matlab. I use it in my university computers for most of my assignments. However, i want to know what are the free options available. i have done some research and many have said that python is a worthy replacement for matlab in various scenarios. i want to know how to do all this with python. i am using a mac so how do i install the different python packages. what are those packages? is it really a viable alternative? what are the things i can and cannot do using this python setup?
replacing Matlab with python
1
0
0
15,393
1,777,011
2009-11-21T22:32:00.000
1
0
1
0
python,c,bash,vhdl
1,777,112
6
false
0
0
Pascal has only 2-3 pages of BNF notations
2
12
0
What programming language has short and beautiful grammars (in EBNF)? Some languages are easer to be parsed. Some time ago I have created a simple VHDL parser, but it was very slow. Not because it is implemented completely in Python, but because VHDL grammar (in EBNF) is huge. The EBNF of Python is beautiful but it is not very short. I suggest that many functional programming languages like LISP have short simple grammars, but I am interested in a more popular simple imperative language like C or Bash.
Which programming language has very short context-free Grammar in its formal specification?
0.033321
0
0
5,182
1,777,011
2009-11-21T22:32:00.000
4
0
1
0
python,c,bash,vhdl
1,777,087
6
false
0
0
Assembly languages! ...in general, and particularly for CPUs which have a simple architecture (few instructions, few addressing modes, few registers) have a relatively short grammar. In fact, specialized processors, such as these found in programmable logic controllers can have a language with even simpler grammars. But then again the most simple of the PLCs are little more than Boolean equation calculators.
2
12
0
What programming language has short and beautiful grammars (in EBNF)? Some languages are easer to be parsed. Some time ago I have created a simple VHDL parser, but it was very slow. Not because it is implemented completely in Python, but because VHDL grammar (in EBNF) is huge. The EBNF of Python is beautiful but it is not very short. I suggest that many functional programming languages like LISP have short simple grammars, but I am interested in a more popular simple imperative language like C or Bash.
Which programming language has very short context-free Grammar in its formal specification?
0.132549
0
0
5,182
1,777,264
2009-11-22T00:13:00.000
19
1
1
0
python,email,imap
1,777,290
3
false
0
0
Deleting an email over IMAP is performed in two phases: mark one or more items for deletion: imap.store(msg_no, '+FLAGS', '\\Deleted') expunge the mailbox: imap.expunge() (imap is your IMAP4 object)
1
14
0
Can you delete emails with imaplib? If so how?
Using python imaplib to "delete" an email from Gmail?
1
0
0
23,123
1,777,671
2009-11-22T02:51:00.000
2
1
1
0
python,interactive,egg,non-interactive
1,777,968
4
true
0
0
I don't understand what do you mean by running script in interactive mode, so I can't say exactly. But the first place to look for modules (sys.path[0]) in interactive mode is current directory (even calling os.chdir() will affect imports), while for script it's directory where the script is located (derived from sys.argv[0]). Note that they are effectively the same when script is run from directory where it's located, but could be different in other cases. Hope this helps.
3
5
0
One of my Python scripts runs in interactive mode but fails when run from the command line. The difference is that when run from the command line, it imports modules from a bad .egg file, and when run interactively it uses my fixed (unzipped) version in the current directory. My question is two-fold: a) why does Python load modules differently when run from these locations, and b) what are my options to work around it?
Python importing modules differently when run interactively/non-interactively
1.2
0
0
2,052
1,777,671
2009-11-22T02:51:00.000
2
1
1
0
python,interactive,egg,non-interactive
1,777,700
4
false
0
0
On UNIX systems and Mac OS-X: Do you have a ~/.python-eggs directory? OS independent: Are you sure that you use the same Python instance in both cases? Can you print sys.path in each cases and see which package directory comes first on your module search path?
3
5
0
One of my Python scripts runs in interactive mode but fails when run from the command line. The difference is that when run from the command line, it imports modules from a bad .egg file, and when run interactively it uses my fixed (unzipped) version in the current directory. My question is two-fold: a) why does Python load modules differently when run from these locations, and b) what are my options to work around it?
Python importing modules differently when run interactively/non-interactively
0.099668
0
0
2,052
1,777,671
2009-11-22T02:51:00.000
1
1
1
0
python,interactive,egg,non-interactive
1,778,097
4
false
0
0
a) why does Python load modules differently when run from these locations b) what are my options to work around it? Check your environment variable PYTHONPATH. When python imports module, it searches those directories. One way to get around your problem is to add your local folder "the (unzipped) version in the current directory" to the beginning of PYTHONPATH so that python will find it first.
3
5
0
One of my Python scripts runs in interactive mode but fails when run from the command line. The difference is that when run from the command line, it imports modules from a bad .egg file, and when run interactively it uses my fixed (unzipped) version in the current directory. My question is two-fold: a) why does Python load modules differently when run from these locations, and b) what are my options to work around it?
Python importing modules differently when run interactively/non-interactively
0.049958
0
0
2,052
1,778,278
2009-11-22T09:39:00.000
0
1
1
0
python,c++
1,778,322
5
false
0
0
It should be fast and lightweight (not like the .NET Framework), but you should still be able to create fully functional and flexible GUI apps.
1
0
0
Just curious. If you had the time and inclination to create a programming language, what characteristics would it have? One language I would like to see would borrow as much from the syntax of Python as possible but compile to machine code that runs as fast as C or C++.
If you had the time and inclination to create a programming language, what characteristics would it have?
0
0
0
340
1,778,670
2009-11-22T13:17:00.000
7
0
1
0
python
1,778,686
6
true
0
0
I'd say it depends on your target audience. For enterprise stuff I think RedHat (certainly CentOS 5) are still on 2.4 - so if you want typical RedHat/CentOS using people to able to install without resorting to third party python installations then I think you need to keep 2.4 for a while. If most of your users are more 'desktop' based running Fedora/Ubuntu then they probably have 2.5/2.6 already so it wouldn't be an issue for them.
5
8
0
I maintain an open source python project. Right now it supports python 2.4, 2.5, 2.6. I am looking for to add support for python 3. I guess it will be easier if I drop 2.4 support. I know it is possible to support all but it is very annoying if I have to install 4 or 5 python versions on my machine and run the tests on all of them. Although it is easy to avoid new features introduced in the language I would like to make use of them! And what is the point of supporting something that possible nobody uses? I do want to drop it, but also dont want to loose users (existing and new). When should I drop support for python 2.4? Is there any recommendation on this?
When should I drop support for python2.4 on my public python library?
1.2
0
0
225
1,778,670
2009-11-22T13:17:00.000
1
0
1
0
python
1,779,015
6
false
0
0
Track downloads of each version of your project. Graph the daily traffic (or weekly if there is too much variation day to day) for each version separately. Keep an eye on the trends and at some point you will see a distinctly downward trend for 2.4 compared to the rest. When that downward trend is well established, discontinue upgrades to the 2.4 version, but keep it available for download. You should include some kind of note in the README for the last 2.4 version, and maybe display a message when it is installed. At this point, your work is done, unless you find some really glaring error that you want to fix. You don't ever have to actually discontinue the 2.4 version, just cease upgrading it. And the graphs that you now produce every week will tell you when it is time to do the same for 2.5, and eventually 2.6.
5
8
0
I maintain an open source python project. Right now it supports python 2.4, 2.5, 2.6. I am looking for to add support for python 3. I guess it will be easier if I drop 2.4 support. I know it is possible to support all but it is very annoying if I have to install 4 or 5 python versions on my machine and run the tests on all of them. Although it is easy to avoid new features introduced in the language I would like to make use of them! And what is the point of supporting something that possible nobody uses? I do want to drop it, but also dont want to loose users (existing and new). When should I drop support for python 2.4? Is there any recommendation on this?
When should I drop support for python2.4 on my public python library?
0.033321
0
0
225
1,778,670
2009-11-22T13:17:00.000
2
0
1
0
python
1,778,682
6
false
0
0
It's a matter of weighing pros and cons. I suppose the real answer to this question is how many features there are in 2.5/2.6 that would really improve your library. It seems as though 2.4 becomes less and less worth supporting as time goes by. On the other hand, there are still some people on Python 2.4. You have to decide if it's worth it to drop support for them to take advantage of newer features of Python 2.5.
5
8
0
I maintain an open source python project. Right now it supports python 2.4, 2.5, 2.6. I am looking for to add support for python 3. I guess it will be easier if I drop 2.4 support. I know it is possible to support all but it is very annoying if I have to install 4 or 5 python versions on my machine and run the tests on all of them. Although it is easy to avoid new features introduced in the language I would like to make use of them! And what is the point of supporting something that possible nobody uses? I do want to drop it, but also dont want to loose users (existing and new). When should I drop support for python 2.4? Is there any recommendation on this?
When should I drop support for python2.4 on my public python library?
0.066568
0
0
225
1,778,670
2009-11-22T13:17:00.000
0
0
1
0
python
1,778,773
6
false
0
0
Any answer here is going to be subjective. I suggest you make a feature and user list. There are 2 things to consider here. 1: How will your program benefit - what features are better nicer/faster/less buggy in newer versions of Python ? What extra dependent libraries can your program utilize by sticking to an older version ? Not everything is ported to 3.x or even 2.5 yet. 2: How will your user benefit - What benefits do users gain from older versions. How much bigger / smaller does your user base get by dropping 2.4 and adding 3.x ? What does your user base look like currently. The third is not really a point since direct benefit from Open Source to developers is kinda iffy - but what do you gain ? i.e. less time needed to maintain, faster development etc. Hope making a summary will help you put things in perspective.
5
8
0
I maintain an open source python project. Right now it supports python 2.4, 2.5, 2.6. I am looking for to add support for python 3. I guess it will be easier if I drop 2.4 support. I know it is possible to support all but it is very annoying if I have to install 4 or 5 python versions on my machine and run the tests on all of them. Although it is easy to avoid new features introduced in the language I would like to make use of them! And what is the point of supporting something that possible nobody uses? I do want to drop it, but also dont want to loose users (existing and new). When should I drop support for python 2.4? Is there any recommendation on this?
When should I drop support for python2.4 on my public python library?
0
0
0
225
1,778,670
2009-11-22T13:17:00.000
1
0
1
0
python
1,778,792
6
false
0
0
You don't have to drop anything, what works on 2.4, works on 2.5 and 2.6. You can easily avoid incompatibilities skipping "with", the ternary operation, et "import future". Now, once you have a very stable and full featured version of your code and need to make a big achitectural change, start writting for Python 3.0. No rush, it won't be massively used before one year or two. A good indicator is to focus on project that have the same audience as yours. When do they switch on the roadmap ? GNOME ? Django ? Inkscape ?
5
8
0
I maintain an open source python project. Right now it supports python 2.4, 2.5, 2.6. I am looking for to add support for python 3. I guess it will be easier if I drop 2.4 support. I know it is possible to support all but it is very annoying if I have to install 4 or 5 python versions on my machine and run the tests on all of them. Although it is easy to avoid new features introduced in the language I would like to make use of them! And what is the point of supporting something that possible nobody uses? I do want to drop it, but also dont want to loose users (existing and new). When should I drop support for python 2.4? Is there any recommendation on this?
When should I drop support for python2.4 on my public python library?
0.033321
0
0
225
1,779,004
2009-11-22T15:21:00.000
13
0
0
0
python,ubuntu,pyqt,pygtk
1,818,306
4
true
0
1
I've written reasonably large apps in both PyGTK and PyQt. On balance, my personal opinion is that PyQt is superior, but not by so much that it's worth worrying about. If you're only worried about supporting Ubuntu, then use PyGTK; it'll give a better look and feel. If you think you may want to port this app to other platforms, then use PyQt; PyQt is far and away the superior crossplatform solution.
4
9
0
I'm a web developer looking to get my feet wet with coding up a little desktop app for Ubuntu in Python. I've scoured the web looking for the pros and cons of PyGTK vs. PyQT and can't really find any good comparisons. What do you guys think? Do they both produce native-looking widgets on a GNOME system? Is one easier to use than the other? Any opinions would be nice. Sorry for the subjective question.
Is PyGTK or PyQT preferred for making GTK-native Python apps?
1.2
0
0
3,384
1,779,004
2009-11-22T15:21:00.000
1
0
0
0
python,ubuntu,pyqt,pygtk
1,901,957
4
false
0
1
In my experience, having made both PyGTK and PyQT apps, there is little difference on the underlying programming side of things. PyQT seems more consistent across different flavors of Linux, where GTK is constantly changing and breaking on older distributions. PyQT has QTCreator, which is a great GUI designer. PyGTK has Glade3, which is getting better, but not as good. Until recently Glade was a bad joke. If you need to draw GUIs in an editor, PyQT is probably the better choice. Otherwise, I'd go with PyGTK for coding because the online PyGTK documentation is excellent. One bizarre thing I've found is PyQT has poor support for dynamic menu item callbacks. Maybe I just didnt use it right, but PyGTK is a bit more flexible in comparison. It's a tough choice, really. But if you design your application right, the interface should be irrelevant; you could design your app with multiple interfaces...
4
9
0
I'm a web developer looking to get my feet wet with coding up a little desktop app for Ubuntu in Python. I've scoured the web looking for the pros and cons of PyGTK vs. PyQT and can't really find any good comparisons. What do you guys think? Do they both produce native-looking widgets on a GNOME system? Is one easier to use than the other? Any opinions would be nice. Sorry for the subjective question.
Is PyGTK or PyQT preferred for making GTK-native Python apps?
0.049958
0
0
3,384
1,779,004
2009-11-22T15:21:00.000
1
0
0
0
python,ubuntu,pyqt,pygtk
13,670,093
4
false
0
1
In my opinion use PYQT as its definately superior for a few reasons. There is no worries with pixmaps ever, there is only one library coded in the same style and conventions. In pygtk you need to learn up to 4 libraries coded in a different style. You have to learn GLIB constants at least if not GLIB variable names as well even though they are a complete 1 to 1 swap with the stdlib C type itself, but why use standard types everyone else uses when as the master of your toolkit you can use pretty useless special purpose types which then can be forced onto everyone else. Gnome developers need a serious wake up. Go with PYQT its sane easy to use and wont make you constantly look up documentation to find out why you cant use standard code.
4
9
0
I'm a web developer looking to get my feet wet with coding up a little desktop app for Ubuntu in Python. I've scoured the web looking for the pros and cons of PyGTK vs. PyQT and can't really find any good comparisons. What do you guys think? Do they both produce native-looking widgets on a GNOME system? Is one easier to use than the other? Any opinions would be nice. Sorry for the subjective question.
Is PyGTK or PyQT preferred for making GTK-native Python apps?
0.049958
0
0
3,384
1,779,004
2009-11-22T15:21:00.000
5
0
0
0
python,ubuntu,pyqt,pygtk
1,779,036
4
false
0
1
PyGTK application will look more native on a Gnome system. PyQt application will look more native on a KDE system. As I found PyGTK have better documentation then PyQt. It will take the same time to write a program on PyQt and PyGTK.
4
9
0
I'm a web developer looking to get my feet wet with coding up a little desktop app for Ubuntu in Python. I've scoured the web looking for the pros and cons of PyGTK vs. PyQT and can't really find any good comparisons. What do you guys think? Do they both produce native-looking widgets on a GNOME system? Is one easier to use than the other? Any opinions would be nice. Sorry for the subjective question.
Is PyGTK or PyQT preferred for making GTK-native Python apps?
0.244919
0
0
3,384
1,779,372
2009-11-22T17:39:00.000
47
1
1
0
python,decorator,metaclass
1,779,404
2
true
0
0
Decorators are much, much simpler and more limited -- and therefore should be preferred whenever the desired effect can be achieved with either a metaclass or a class decorator. Anything you can do with a class decorator, you can of course do with a custom metaclass (just apply the functionality of the "decorator function", i.e., the one that takes a class object and modifies it, in the course of the metaclass's __new__ or __init__ that make the class object!-). There are many things you can do in a custom metaclass but not in a decorator (unless the decorator internally generates and applies a custom metaclass, of course -- but that's cheating;-)... and even then, in Python 3, there are things you can only do with a custom metaclass, not after the fact... but that's a pretty advanced sub-niche of your question, so let me give simpler examples). For example, suppose you want to make a class object X such that print X (or in Python 3 print(X) of course;-) displays peekaboo!. You cannot possibly do that without a custom metaclass, because the metaclass's override of __str__ is the crucial actor here, i.e., you need a def __str__(cls): return "peekaboo!" in the custom metaclass of class X. The same applies to all magic methods, i.e., to all kinds of operations as applied to the class object itself (as opposed to, ones applied to its instances, which use magic methods as defined in the class -- operations on the class object itself use magic methods as defined in the metaclass).
1
43
0
What are the main differences between Python metaclasses and class decorators? Is there something I can do with one but not with the other?
Python metaclasses vs class decorators
1.2
0
0
8,667