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
590,007
2009-02-26T10:41:00.000
2
0
1
0
python,ironpython,cpython
590,052
8
false
0
0
Python is Python, the only difference is that IronPython was designed to run on the CLR (.NET Framework), and as such, can inter-operate and consume .NET assemblies written in other .NET languages. So if your platform is Windows and you also use .NET or your company does then should consider IronPython.
4
33
0
How does IronPython stack up to the default Windows implementation of Python from python.org? If I am learning Python, will I be learning a subtley different language with IronPython, and what libraries would I be doing without? Are there, alternatively, any pros to IronPython (not including .NET IL compiled classes) that would make it more attractive an option?
Python or IronPython
0.049958
0
0
14,578
590,007
2009-02-26T10:41:00.000
2
0
1
0
python,ironpython,cpython
590,216
8
false
0
0
One of the pros of IronPython is that, unlike CPython, IronPython doesn't use the Global Interpreter Lock, thus making threading more effective. In the standard Python implementation, threads grab the GIL on each object access. This limits parallel execution, which matters especially if you expect to fully utilize multiple CPUs.
4
33
0
How does IronPython stack up to the default Windows implementation of Python from python.org? If I am learning Python, will I be learning a subtley different language with IronPython, and what libraries would I be doing without? Are there, alternatively, any pros to IronPython (not including .NET IL compiled classes) that would make it more attractive an option?
Python or IronPython
0.049958
0
0
14,578
590,007
2009-02-26T10:41:00.000
13
0
1
0
python,ironpython,cpython
590,026
8
false
0
0
There are some subtle differences in how you write your code, but the biggest difference is in the libraries you have available. With IronPython, you have all the .Net libraries available, but at the expense of some of the "normal" python libraries that haven't been ported to the .Net VM I think. Basically, you should expect the syntax and the idioms to be the same, but a script written for IronPython wont run if you try giving it to the "regular" Python interpreter. The other way around is probably more likely, but there too you will find differences I think.
4
33
0
How does IronPython stack up to the default Windows implementation of Python from python.org? If I am learning Python, will I be learning a subtley different language with IronPython, and what libraries would I be doing without? Are there, alternatively, any pros to IronPython (not including .NET IL compiled classes) that would make it more attractive an option?
Python or IronPython
1
0
0
14,578
590,053
2009-02-26T10:56:00.000
0
1
0
0
python,audio,chat,voice
6,936,316
2
false
0
0
Basically a farsight lib which has xmpp-jingle that can accomodate video and voice chat is commonly used,for python itz farsight.py: try it.....!
1
3
0
I'm trying to find resources on video and voice chat operability in Python... Does anybody know of some good resources or sample projects? Any help would really be appreciated!
Video and Voice chat operability in Python
0
0
0
3,199
590,250
2009-02-26T12:01:00.000
0
0
1
0
python,module
20,102,459
8
false
0
0
I had an issue like this with bsddb. I was forced to install the bsddb3 module but hundreds of scripts imported bsddb. Instead of changing the import in all of them, I extracted the bsddb3 egg, and created a soft link in the site-packages directory so that both "bsddb" and "bsddb3" were one in the same to python.
4
10
0
Is it only possible if I rename the file? Or is there a __module__ variable to the file to define what's its name?
How to change a Python module name?
0
0
0
31,963
590,250
2009-02-26T12:01:00.000
0
0
1
0
python,module
590,279
8
false
0
0
Where would you like to have this __module__ variable, so your original script knows what to import? Modules are recognized by file names and looked in paths defined in sys.path variable. So, you have to rename the file, then remove the oldname.pyc, just to make sure everything works right.
4
10
0
Is it only possible if I rename the file? Or is there a __module__ variable to the file to define what's its name?
How to change a Python module name?
0
0
0
31,963
590,250
2009-02-26T12:01:00.000
0
0
1
0
python,module
590,271
8
false
0
0
Every class has an __module__ property, although I believe changing this will not change the namespace of the Class. If it is possible, it would probably involve using setattr to insert the methods or class into the desired module, although you run the risk of making your code very confusing to your future peers. Your best bet is to rename the file.
4
10
0
Is it only possible if I rename the file? Or is there a __module__ variable to the file to define what's its name?
How to change a Python module name?
0
0
0
31,963
590,250
2009-02-26T12:01:00.000
10
0
1
0
python,module
590,262
8
true
0
0
Yes, you should rename the file. Best would be after you have done that to remove the oldname.pyc and oldname.pyo compiled files (if present) from your system, otherwise the module will be importable under the old name too.
4
10
0
Is it only possible if I rename the file? Or is there a __module__ variable to the file to define what's its name?
How to change a Python module name?
1.2
0
0
31,963
591,300
2009-02-26T16:24:00.000
0
0
0
0
python,windows,passwords
600,635
3
false
0
0
You might need admin priviliges to do that, so look into elevating the current process or launch a new process with more priviliges. (I.e. something like vista's UAC but on XP.) Can't help with details though. :-/
1
4
0
How can I modify the password expiration to "never" on Windows XP for a local user with Python? I have the PyWIN and WMI modules on board but have no solution. I managed to query the current settings via WMI(based on Win32_UserAccount class), but how can modify it?
How can I modify password expiration in Windows using Python?
0
0
0
2,261
592,332
2009-02-26T20:37:00.000
9
0
0
0
python,orm,sqlalchemy,sqlobject
592,348
3
false
0
0
I think SQLObject is more pythonic/simpler, so if it works for you, then stick with it. SQLAlchemy takes a little more to learn, but can do more advanced things if you need that.
1
14
0
I don't expect to need much more than basic CRUD type functionality. I know that SQLAlchemy is more flexible, but the syntax etc of sqlobject just seem to be a bit easier to get up and going with.
Any reasons not to use SQLObject over SQLAlchemy?
1
1
0
3,351
594,266
2009-02-27T10:42:00.000
3
0
1
0
python,parsing,equation
594,457
7
false
0
0
To emphasize J.F. Sebastian's advice, 'eval' and even the 'compiler' solutions can be open to subtle security holes. How trustworthy is the input? With 'compiler' you can at least filter out things like getattr lookups from the AST, but I've found it's easier to use PLY or pyparsing for this sort of thing than it is to secure the result of letting Python help out. Also, 'compiler' is clumsy and hard to use. It's deprecated and removed in 3.0. You should use the 'ast' module (added in 2.6, available in 2.5 as '_ast').
1
41
0
How can I (easily) take a string such as "sin(x)*x^2" which might be entered by a user at runtime and produce a Python function that could be evaluated for any value of x?
Equation parsing in Python
0.085505
0
0
60,682
594,273
2009-02-27T10:45:00.000
10
0
1
0
python,random,word-list
594,285
8
false
0
0
You can't. There is no algorithm to generate meaningful words. You can only generate words that sound like English, but they won't have any meaning.
2
14
0
What would be the best way to go about getting a function that returns a random English word (preferably a noun), without keeping a list of all possible words in a file before hand?
How to pick a random english word from a list
1
0
0
36,092
594,273
2009-02-27T10:45:00.000
0
0
1
0
python,random,word-list
594,283
8
false
0
0
Well, you have three options: Hard-code the list of words and initialize an array with it. Fetch the list from an internet location instead of a file. Keep a list of possible words in a file. The only way to avoid the above is if you're not concerned whether the word is real: you can just generate random-length strings of characters. (There's no way to programmatically generate words without a dictionary list to go from.)
2
14
0
What would be the best way to go about getting a function that returns a random English word (preferably a noun), without keeping a list of all possible words in a file before hand?
How to pick a random english word from a list
0
0
0
36,092
595,290
2009-02-27T15:46:00.000
3
0
1
0
python,symbian,nokia,s60,pys60
595,300
2
false
0
0
PyS60 as of version 1.9.0 uses Python 2.5.1 core and has no problems with garbage collection.
2
3
0
I have heard it many times that garbage collection in PyS60 is not up to to the mark. This imposes a lot of limits on writing cleaner code. Can I at least rely that the non cyclic references are cleaned up after a function exists.
Does PyS60 has a reliable garbage collection?
0.291313
0
0
308
595,290
2009-02-27T15:46:00.000
0
0
1
0
python,symbian,nokia,s60,pys60
915,114
2
true
0
0
Mostly you can, but occasionally PyS60 needs a little "help". Unbind keys, always cancel timers, might have to manually delete some classes etc. Nothing too bad. Btw current 1.9.x branch uses python core 2.5.4. In my opinion 1.9.5 is the first version, which might be better that 1.4.5. Worth taking a look, especially if you want to play with 5800 XpressMusic :)
2
3
0
I have heard it many times that garbage collection in PyS60 is not up to to the mark. This imposes a lot of limits on writing cleaner code. Can I at least rely that the non cyclic references are cleaned up after a function exists.
Does PyS60 has a reliable garbage collection?
1.2
0
0
308
595,296
2009-02-27T15:48:00.000
3
0
0
0
python,symbian,nokia,pys60
595,330
4
false
1
1
Yes, PyS60 is based on CPython, thus uses the C stack.
4
3
0
Symbian has a stack limit of 8kB. Does this also apply to the function calling in PyS60 apps?
Does the stack limit of Symbian also apply to PyS60?
0.148885
0
0
417
595,296
2009-02-27T15:48:00.000
1
0
0
0
python,symbian,nokia,pys60
606,180
4
false
1
1
Increasing the Symbian stack size is done through a parameter in the mmp file. This is valid when you create a native application that the toolchain will turn into an exe file. If you were to upgrade the Python runtime on your phone, with a version you built yourself, you could increase the stack size of the runtime process itself.
4
3
0
Symbian has a stack limit of 8kB. Does this also apply to the function calling in PyS60 apps?
Does the stack limit of Symbian also apply to PyS60?
0.049958
0
0
417
595,296
2009-02-27T15:48:00.000
0
0
0
0
python,symbian,nokia,pys60
685,145
4
false
1
1
I would assume that PyS60 should be doing the memory management for you, as your program will probably be constrained by the resources of PyS60.
4
3
0
Symbian has a stack limit of 8kB. Does this also apply to the function calling in PyS60 apps?
Does the stack limit of Symbian also apply to PyS60?
0
0
0
417
595,296
2009-02-27T15:48:00.000
1
0
0
0
python,symbian,nokia,pys60
915,134
4
true
1
1
There is a difference between python runtime and python apps. Also from PyS60 app developer point of view, it's the heapsize that's more interesting... Version 1.9.5 comes by default with heapsize 100k min and 4M max. Of course you can define those by yourself when creating the SIS package to release and distribute your application. Sorry if I answered right question with wrong answer (stack vs heap). Stack is usually "enough", but with deep enough recursion you can run out of it. Have done it - and fixed some endless loops :) Never had any real stack problems. Usually it's the heap that runs out, esp with graphics manipulation.
4
3
0
Symbian has a stack limit of 8kB. Does this also apply to the function calling in PyS60 apps?
Does the stack limit of Symbian also apply to PyS60?
1.2
0
0
417
597,348
2009-02-28T01:56:00.000
0
0
0
0
c#,.net,python,html-to-pdf
597,840
5
false
1
0
You can also try different approach like using virtual printers.
1
0
0
I have google as much as I possible, checked stackoverflow several times, and yet I can not find a good html to pdf converter that can handle css. Is there a free and open source solution (even for commercial usage)? There are many solutions, with huge variety of price ranges, but I was looking for something open source and free. I have tried PISA for Python and it works fairly well, but is not free for commercial usage. Is there anything for .Net? I have not had success with iTextSharp.
FOSS HTML to PDF in Python, .Net or command line?
0
0
0
1,517
598,299
2009-02-28T16:59:00.000
3
0
1
1
python,dependencies,distribution,packaging
609,861
8
false
0
0
An important point seems to have been forgotten in the Cons of bundling libraries/frameworks/etc with the application: security updates. Most Web frameworks are full of security holes and require frequent patching. Any library, anyway, may have to be upgraded one day or the other for a security bug. If you do not bundle, sysadmins will just upgrade one copy of the library and restart depending applications. If you bundle, sysadmins will probably not even know they have to upgrade something. So, the issue with bundling is not the disk space, it's the risk of letting old and dangerous copies around.
7
14
0
Summary I recently had a conversation with the creator of a framework that one of my applications depends on. During that conversation he mentioned as a sort of aside that it would make my life simpler if I just bundled his framework with my application and delivered to the end user a version that I knew was consistent with my code. Intuitively I have always tried to avoid doing this and, in fact, I have taken pains to segment my own code so that portions of it could be redistributed without taking the entire project (even when there was precious little chance anyone would ever reuse any of it). However, after mulling it over for some time I have not been able to come up with a particularly good reason why I do this. In fact, now that I have thought about it, I'm seeing a pretty compelling case to bundle all my smaller dependencies. I have come up with a list of pros and cons and I'm hoping someone can point out anything that I'm missing. Pros Consistency of versions means easier testing and troubleshooting. Application may reach a wider audience since there appear to be fewer components to install. Small tweaks to the dependency can more easily be made downstream and delivered with the application, rather than waiting for them to percolate into the upstream code base. Cons More complex packaging process to include dependencies. User may end up with multiple copies of a dependency on their machine. Per bortzmeyer's response, there are potential security concerns with not being able to upgrade individual components. Notes For reference, my application is written in Python and the dependencies I'm referencing are "light", by which I mean small and not in very common use. (So they do not exist on all machines or even in all repositories.) And when I say "package with" my application, I mean distribute under my own source tree, not install with a script that resides inside my package, so there would be no chance of conflicting versions. I am also developing solely on Linux so there are no Windows installation issues to worry about. All that being said, I am interested in hearing any thoughts on the broader (language-independent) issue of packaging dependencies as well. Is there something I am missing or is this an easy decision that I am just over-thinking? Addendum 1 It is worth mentioning that I am also quite sensitive to the needs of downstream packagers. I would like it to be as straightforward as possible to wrap the application up in a distribution-specific Deb or RPM.
When is it (not) appropriate to bundle dependencies with an application?
0.07486
0
0
1,453
598,299
2009-02-28T16:59:00.000
10
0
1
1
python,dependencies,distribution,packaging
598,397
8
true
0
0
I favor bundling dependencies, if it's not feasible to use a system for automatic dependency resolution (i.e. setuptools), and if you can do it without introducing version conflicts. You still have to consider your application and your audience; serious developers or enthusiasts are more likely to want to work with a specific (latest) version of the dependency. Bundling stuff in may be annoying for them, since it's not what they expect. But, especially for end-users of an application, I seriously doubt most people enjoy having to search for dependencies. As far as having duplicate copies goes, I would much rather spend an extra 10 milliseconds downloading some additional kilobytes, or spend whatever fraction of a cent on the extra meg of disk space, than spend 10+ minutes searching through websites (which may be down), downloading, installing (which may fail if versions are incompatible), etc. I don't care how many copies of a library I have on my disk, as long as they don't get in each others' way. Disk space is really, really cheap.
7
14
0
Summary I recently had a conversation with the creator of a framework that one of my applications depends on. During that conversation he mentioned as a sort of aside that it would make my life simpler if I just bundled his framework with my application and delivered to the end user a version that I knew was consistent with my code. Intuitively I have always tried to avoid doing this and, in fact, I have taken pains to segment my own code so that portions of it could be redistributed without taking the entire project (even when there was precious little chance anyone would ever reuse any of it). However, after mulling it over for some time I have not been able to come up with a particularly good reason why I do this. In fact, now that I have thought about it, I'm seeing a pretty compelling case to bundle all my smaller dependencies. I have come up with a list of pros and cons and I'm hoping someone can point out anything that I'm missing. Pros Consistency of versions means easier testing and troubleshooting. Application may reach a wider audience since there appear to be fewer components to install. Small tweaks to the dependency can more easily be made downstream and delivered with the application, rather than waiting for them to percolate into the upstream code base. Cons More complex packaging process to include dependencies. User may end up with multiple copies of a dependency on their machine. Per bortzmeyer's response, there are potential security concerns with not being able to upgrade individual components. Notes For reference, my application is written in Python and the dependencies I'm referencing are "light", by which I mean small and not in very common use. (So they do not exist on all machines or even in all repositories.) And when I say "package with" my application, I mean distribute under my own source tree, not install with a script that resides inside my package, so there would be no chance of conflicting versions. I am also developing solely on Linux so there are no Windows installation issues to worry about. All that being said, I am interested in hearing any thoughts on the broader (language-independent) issue of packaging dependencies as well. Is there something I am missing or is this an easy decision that I am just over-thinking? Addendum 1 It is worth mentioning that I am also quite sensitive to the needs of downstream packagers. I would like it to be as straightforward as possible to wrap the application up in a distribution-specific Deb or RPM.
When is it (not) appropriate to bundle dependencies with an application?
1.2
0
0
1,453
598,299
2009-02-28T16:59:00.000
1
0
1
1
python,dependencies,distribution,packaging
598,333
8
false
0
0
Just my experience, take it with a grain of salt. My preference for a couple of open-source libraries that I author is for independence from additional libs as much as possible. Reason being, not only am I on the hook for distribution of additional libraries along with mine, I'm also obliged to update my application for compatibility as those other libraries are updated as well. From the libraries I've used from others that carry dependencies of "common" libraries, invariably I end up with requiring multiple versions of the common library on my system. The relative update speed of the niche libraries I'm using just isn't that fast, while the common libraries are updated much more often. Versioning hell. But that's speaking generically. If I can aid my project and users NOW by incorporating a dependency, I'm always looking at the downstream and later-date effects of that decision. If I can manage it, I can confidently include the dependency. As always, your mileage may vary.
7
14
0
Summary I recently had a conversation with the creator of a framework that one of my applications depends on. During that conversation he mentioned as a sort of aside that it would make my life simpler if I just bundled his framework with my application and delivered to the end user a version that I knew was consistent with my code. Intuitively I have always tried to avoid doing this and, in fact, I have taken pains to segment my own code so that portions of it could be redistributed without taking the entire project (even when there was precious little chance anyone would ever reuse any of it). However, after mulling it over for some time I have not been able to come up with a particularly good reason why I do this. In fact, now that I have thought about it, I'm seeing a pretty compelling case to bundle all my smaller dependencies. I have come up with a list of pros and cons and I'm hoping someone can point out anything that I'm missing. Pros Consistency of versions means easier testing and troubleshooting. Application may reach a wider audience since there appear to be fewer components to install. Small tweaks to the dependency can more easily be made downstream and delivered with the application, rather than waiting for them to percolate into the upstream code base. Cons More complex packaging process to include dependencies. User may end up with multiple copies of a dependency on their machine. Per bortzmeyer's response, there are potential security concerns with not being able to upgrade individual components. Notes For reference, my application is written in Python and the dependencies I'm referencing are "light", by which I mean small and not in very common use. (So they do not exist on all machines or even in all repositories.) And when I say "package with" my application, I mean distribute under my own source tree, not install with a script that resides inside my package, so there would be no chance of conflicting versions. I am also developing solely on Linux so there are no Windows installation issues to worry about. All that being said, I am interested in hearing any thoughts on the broader (language-independent) issue of packaging dependencies as well. Is there something I am missing or is this an easy decision that I am just over-thinking? Addendum 1 It is worth mentioning that I am also quite sensitive to the needs of downstream packagers. I would like it to be as straightforward as possible to wrap the application up in a distribution-specific Deb or RPM.
When is it (not) appropriate to bundle dependencies with an application?
0.024995
0
0
1,453
598,299
2009-02-28T16:59:00.000
3
0
1
1
python,dependencies,distribution,packaging
603,843
8
false
0
0
If you're producing software for an end-user, the goal is to let the customer use your software. Anything that stands in the way is counter-productive. If they have to download dependencies themselves, there's a possibility that they'll decide to avoid your software instead. You can't control whether libraries will be backwards compatible, and you don't want your software to stop working because the user updated their system. Similarly, you don't want a customer to install an old version of your software with old libraries and have the rest of the system break. This means bundling is generally the way to go. If you can ensure that your software will install smoothly without bundling dependencies, and that's less work, then that may be a better option. It's about what satisfies your customers.
7
14
0
Summary I recently had a conversation with the creator of a framework that one of my applications depends on. During that conversation he mentioned as a sort of aside that it would make my life simpler if I just bundled his framework with my application and delivered to the end user a version that I knew was consistent with my code. Intuitively I have always tried to avoid doing this and, in fact, I have taken pains to segment my own code so that portions of it could be redistributed without taking the entire project (even when there was precious little chance anyone would ever reuse any of it). However, after mulling it over for some time I have not been able to come up with a particularly good reason why I do this. In fact, now that I have thought about it, I'm seeing a pretty compelling case to bundle all my smaller dependencies. I have come up with a list of pros and cons and I'm hoping someone can point out anything that I'm missing. Pros Consistency of versions means easier testing and troubleshooting. Application may reach a wider audience since there appear to be fewer components to install. Small tweaks to the dependency can more easily be made downstream and delivered with the application, rather than waiting for them to percolate into the upstream code base. Cons More complex packaging process to include dependencies. User may end up with multiple copies of a dependency on their machine. Per bortzmeyer's response, there are potential security concerns with not being able to upgrade individual components. Notes For reference, my application is written in Python and the dependencies I'm referencing are "light", by which I mean small and not in very common use. (So they do not exist on all machines or even in all repositories.) And when I say "package with" my application, I mean distribute under my own source tree, not install with a script that resides inside my package, so there would be no chance of conflicting versions. I am also developing solely on Linux so there are no Windows installation issues to worry about. All that being said, I am interested in hearing any thoughts on the broader (language-independent) issue of packaging dependencies as well. Is there something I am missing or is this an easy decision that I am just over-thinking? Addendum 1 It is worth mentioning that I am also quite sensitive to the needs of downstream packagers. I would like it to be as straightforward as possible to wrap the application up in a distribution-specific Deb or RPM.
When is it (not) appropriate to bundle dependencies with an application?
0.07486
0
0
1,453
598,299
2009-02-28T16:59:00.000
2
0
1
1
python,dependencies,distribution,packaging
603,778
8
false
0
0
For Linux, don't even think about bundling. You aren't smarter than the package manager or the packagers, and each distribution takes approach their own way - they won't be happy if you attempt to go your way. At best, they won't bother with packaging your app, which isn't great. Keep in mind that in Linux, dependencies are automatically pulled in for you. It's not a matter of making the user get them. It's already done for you. For windows, feel free to bundle, you're on your own there.
7
14
0
Summary I recently had a conversation with the creator of a framework that one of my applications depends on. During that conversation he mentioned as a sort of aside that it would make my life simpler if I just bundled his framework with my application and delivered to the end user a version that I knew was consistent with my code. Intuitively I have always tried to avoid doing this and, in fact, I have taken pains to segment my own code so that portions of it could be redistributed without taking the entire project (even when there was precious little chance anyone would ever reuse any of it). However, after mulling it over for some time I have not been able to come up with a particularly good reason why I do this. In fact, now that I have thought about it, I'm seeing a pretty compelling case to bundle all my smaller dependencies. I have come up with a list of pros and cons and I'm hoping someone can point out anything that I'm missing. Pros Consistency of versions means easier testing and troubleshooting. Application may reach a wider audience since there appear to be fewer components to install. Small tweaks to the dependency can more easily be made downstream and delivered with the application, rather than waiting for them to percolate into the upstream code base. Cons More complex packaging process to include dependencies. User may end up with multiple copies of a dependency on their machine. Per bortzmeyer's response, there are potential security concerns with not being able to upgrade individual components. Notes For reference, my application is written in Python and the dependencies I'm referencing are "light", by which I mean small and not in very common use. (So they do not exist on all machines or even in all repositories.) And when I say "package with" my application, I mean distribute under my own source tree, not install with a script that resides inside my package, so there would be no chance of conflicting versions. I am also developing solely on Linux so there are no Windows installation issues to worry about. All that being said, I am interested in hearing any thoughts on the broader (language-independent) issue of packaging dependencies as well. Is there something I am missing or is this an easy decision that I am just over-thinking? Addendum 1 It is worth mentioning that I am also quite sensitive to the needs of downstream packagers. I would like it to be as straightforward as possible to wrap the application up in a distribution-specific Deb or RPM.
When is it (not) appropriate to bundle dependencies with an application?
0.049958
0
0
1,453
598,299
2009-02-28T16:59:00.000
1
0
1
1
python,dependencies,distribution,packaging
598,614
8
false
0
0
Beware reproducing the classic Windows DLL hell. By all means minimize the number of dependencies: ideally, just depend on your language and its framework, nothing else, if you can. After all, preserving hard disk space is hardly the objective any more, so users need not care about having multiple copies. Also, unless you have a minuscule number of users, be sure to take the onus of packaging on yourself rather than requiring them to obtain all dependencies!
7
14
0
Summary I recently had a conversation with the creator of a framework that one of my applications depends on. During that conversation he mentioned as a sort of aside that it would make my life simpler if I just bundled his framework with my application and delivered to the end user a version that I knew was consistent with my code. Intuitively I have always tried to avoid doing this and, in fact, I have taken pains to segment my own code so that portions of it could be redistributed without taking the entire project (even when there was precious little chance anyone would ever reuse any of it). However, after mulling it over for some time I have not been able to come up with a particularly good reason why I do this. In fact, now that I have thought about it, I'm seeing a pretty compelling case to bundle all my smaller dependencies. I have come up with a list of pros and cons and I'm hoping someone can point out anything that I'm missing. Pros Consistency of versions means easier testing and troubleshooting. Application may reach a wider audience since there appear to be fewer components to install. Small tweaks to the dependency can more easily be made downstream and delivered with the application, rather than waiting for them to percolate into the upstream code base. Cons More complex packaging process to include dependencies. User may end up with multiple copies of a dependency on their machine. Per bortzmeyer's response, there are potential security concerns with not being able to upgrade individual components. Notes For reference, my application is written in Python and the dependencies I'm referencing are "light", by which I mean small and not in very common use. (So they do not exist on all machines or even in all repositories.) And when I say "package with" my application, I mean distribute under my own source tree, not install with a script that resides inside my package, so there would be no chance of conflicting versions. I am also developing solely on Linux so there are no Windows installation issues to worry about. All that being said, I am interested in hearing any thoughts on the broader (language-independent) issue of packaging dependencies as well. Is there something I am missing or is this an easy decision that I am just over-thinking? Addendum 1 It is worth mentioning that I am also quite sensitive to the needs of downstream packagers. I would like it to be as straightforward as possible to wrap the application up in a distribution-specific Deb or RPM.
When is it (not) appropriate to bundle dependencies with an application?
0.024995
0
0
1,453
598,299
2009-02-28T16:59:00.000
1
0
1
1
python,dependencies,distribution,packaging
598,599
8
false
0
0
I always include all dependancies for my web applications. Not only does this make installation simpler, the application remains stable and working the way you expect it to even when other components on the system are upgraded.
7
14
0
Summary I recently had a conversation with the creator of a framework that one of my applications depends on. During that conversation he mentioned as a sort of aside that it would make my life simpler if I just bundled his framework with my application and delivered to the end user a version that I knew was consistent with my code. Intuitively I have always tried to avoid doing this and, in fact, I have taken pains to segment my own code so that portions of it could be redistributed without taking the entire project (even when there was precious little chance anyone would ever reuse any of it). However, after mulling it over for some time I have not been able to come up with a particularly good reason why I do this. In fact, now that I have thought about it, I'm seeing a pretty compelling case to bundle all my smaller dependencies. I have come up with a list of pros and cons and I'm hoping someone can point out anything that I'm missing. Pros Consistency of versions means easier testing and troubleshooting. Application may reach a wider audience since there appear to be fewer components to install. Small tweaks to the dependency can more easily be made downstream and delivered with the application, rather than waiting for them to percolate into the upstream code base. Cons More complex packaging process to include dependencies. User may end up with multiple copies of a dependency on their machine. Per bortzmeyer's response, there are potential security concerns with not being able to upgrade individual components. Notes For reference, my application is written in Python and the dependencies I'm referencing are "light", by which I mean small and not in very common use. (So they do not exist on all machines or even in all repositories.) And when I say "package with" my application, I mean distribute under my own source tree, not install with a script that resides inside my package, so there would be no chance of conflicting versions. I am also developing solely on Linux so there are no Windows installation issues to worry about. All that being said, I am interested in hearing any thoughts on the broader (language-independent) issue of packaging dependencies as well. Is there something I am missing or is this an easy decision that I am just over-thinking? Addendum 1 It is worth mentioning that I am also quite sensitive to the needs of downstream packagers. I would like it to be as straightforward as possible to wrap the application up in a distribution-specific Deb or RPM.
When is it (not) appropriate to bundle dependencies with an application?
0.024995
0
0
1,453
598,569
2009-02-28T19:55:00.000
0
0
1
1
python
598,571
3
false
0
0
Unless the said executable takes command line arguments which will specify which function to use, I don't think this is possible. With that being said, if you created the EXE, command line arguments are a good way to implement the functionality you're looking for.
2
4
0
I need to know a way to call a function defined in the exe from a python script. I know how to call entire exe from py file.
Calling function defined in exe
0
0
0
2,356
598,569
2009-02-28T19:55:00.000
1
0
1
1
python
598,585
3
false
0
0
Not sure if it is for windows. But you can treat an exe like a dll (if functions are exported). And they can be used by other programs.
2
4
0
I need to know a way to call a function defined in the exe from a python script. I know how to call entire exe from py file.
Calling function defined in exe
0.066568
0
0
2,356
598,577
2009-02-28T20:00:00.000
5
0
0
0
python,django,administration
599,054
2
false
1
0
Generally, you shouldn't use the admin for access by people you don't really trust. Even though there's plenty of flexibility in terms of locking things down and controlling access (much more so since Django 1.0), the admin is still designed on the assumption that the people using it are trusted members of your staff.
2
4
0
I've been applying Django's automatic administration capabilities to some applications who had previously been very difficult to administer. I'm thinking of a lot of ways to apply it to other applications we use (including using it to replace some internal apps altogether). Before I go overboard though, is there anything in particular I shouldn't use it for?
What SHOULDN'T Django's admin interface be used for?
0.462117
0
0
352
598,577
2009-02-28T20:00:00.000
7
0
0
0
python,django,administration
598,580
2
true
1
0
User-specific privileges. I myself had been trying to work it into that-- some of the new (and at least at the time, undocumented) features (from newforms-admin) make it actually possible. Depending on how fine you want the control to be, though, you can end up getting very, very deep into the Django/admin internals. Just because you can doesn't mean you should-- it's easier and less fragile to do so with a custom admin app.
2
4
0
I've been applying Django's automatic administration capabilities to some applications who had previously been very difficult to administer. I'm thinking of a lot of ways to apply it to other applications we use (including using it to replace some internal apps altogether). Before I go overboard though, is there anything in particular I shouldn't use it for?
What SHOULDN'T Django's admin interface be used for?
1.2
0
0
352
598,668
2009-02-28T20:54:00.000
0
0
1
0
python,python-module,python-import
15,196,925
6
false
0
0
If you want to store your RSS file in a different place use sys.append("") and pout the module in that directory and use import or from import *
1
6
0
I'm just beginning Python, and I'd like to use an external RSS class. Where do I put that class and how do I import it? I'd like to eventually be able to share python programs.
External classes in Python
0
0
0
26,764
598,931
2009-03-01T00:03:00.000
5
0
1
0
python,c
598,945
5
false
0
0
Without taking pages and pages to go into the details, think of a C struct as a way to organize data, while a Python (or C++ or Objective-C) "class" is a way to organize not only your data, but the operations for that data. A Python "class," for example, can inherit from other objects, to give you an interator for the data associated with it (or you can write your own interator in the class). There's more to say, I'm sure, but this gets into "what is OOP" pretty quickly, well beyond the scope of this thread.
3
2
0
I'm new to python. I've studied C and I noticed that that the C structure (struct) seemed to have the same task as "class" in python. So what is, conceptually, the difference?
Difference between class (Python) and struct (C)
0.197375
0
0
8,064
598,931
2009-03-01T00:03:00.000
24
0
1
0
python,c
598,955
5
false
0
0
Structs encapsulate data. Classes encapsulate behavior and data.
3
2
0
I'm new to python. I've studied C and I noticed that that the C structure (struct) seemed to have the same task as "class" in python. So what is, conceptually, the difference?
Difference between class (Python) and struct (C)
1
0
0
8,064
598,931
2009-03-01T00:03:00.000
3
0
1
0
python,c
598,941
5
false
0
0
Classes typically have methods (which are mostly just functions) associated with them, whereas C structs don't. You'll probably want to learn about what object-oriented programming is, if you want to make effective use of classes in Python (or any other object-oriented language, like Java or C++). Of course, it is possible to use a Python class the same way you'd use a C struct, as a container for data. But that's not done very often.
3
2
0
I'm new to python. I've studied C and I noticed that that the C structure (struct) seemed to have the same task as "class" in python. So what is, conceptually, the difference?
Difference between class (Python) and struct (C)
0.119427
0
0
8,064
599,205
2009-03-01T03:40:00.000
0
0
0
1
python,google-app-engine,setuptools,pkg-resources
2,164,138
3
true
0
0
Create a setup.py for the package just as you would normally, and then use "setup.py sdist --formats=zip" to build your source zip. The built source zip will include an .egg-info metadata directory, which will then be findable by pkg_resources. Alternately, you can use bdist_egg for all your packages.
2
1
0
I'm trying to get a package installed on Google App Engine. The package relies rather extensively on pkg_resources, but there's no way to run setup.py on App Engine. There's no platform-specific code in the source, however, so it's no problem to just zip up the source and include those in the system path. And I've gotten a version of pkg_resources installed and working as well. The only problem is getting the package actually registered with pkg_resources so when it calls iter_entry_points it can find the appropriate plugins. What methods do I need to call to register modules on sys.path with all the appropriate metadata, and how do I figure out what that metadata needs to be?
How can I manually register distributions with pkg_resources?
1.2
0
0
724
599,205
2009-03-01T03:40:00.000
0
0
0
1
python,google-app-engine,setuptools,pkg-resources
744,882
3
false
0
0
On your local development system, run python setup.py bdist_egg, which will create a Zip archive with the necessary metadata included. Add it to your sys.path, and it should work properly.
2
1
0
I'm trying to get a package installed on Google App Engine. The package relies rather extensively on pkg_resources, but there's no way to run setup.py on App Engine. There's no platform-specific code in the source, however, so it's no problem to just zip up the source and include those in the system path. And I've gotten a version of pkg_resources installed and working as well. The only problem is getting the package actually registered with pkg_resources so when it calls iter_entry_points it can find the appropriate plugins. What methods do I need to call to register modules on sys.path with all the appropriate metadata, and how do I figure out what that metadata needs to be?
How can I manually register distributions with pkg_resources?
0
0
0
724
600,190
2009-03-01T18:00:00.000
1
0
1
0
python,oop,module
600,325
7
false
0
0
Why not go with an instance of that class? That way you might even be able later on to have 2 different "sessions" running, depending on what instance you use. It might make it more flexible. Maybe add some method get_appstate() to the module so it instanciates the class once. Later on if you might want several instances you can change this method to eventually take a parameter and use some dictionary etc. to store those instances. You could also use property decorators btw to make things more readable and have the flexibility of storing it how and where you want it stores. I agree that it would be more pythonic to use the module approach instead of classmethods. BTW, I am not such a big fan of having things available globally by some "magic". I'd rather use some explicit call to obtain that information. Then I know where things come from and how to debug it when things fail.
4
23
0
In my application I have to maintain some global application state and global application wide methods like currently connected users, total number of answers, create an application config file etc. There are two options: Make a separate appstate.py file with global variables with functions over them. It looks fine initially but it seems that I am missing something in clarity of my code. Create a class AppState with class functions in a appstate.py file, all other modules have been defined by their specific jobs. This looks fine. But now I have to write longer line like appstate.AppState.get_user_list(). Moreover, the methods are not so much related to each other. I can create separate classes but that would be too many classes. EDIT: If I use classes I will be using classmethods. I don't think there is a need to instantiate the class to an object.
choosing between Modules and Classes
0.028564
0
0
11,569
600,190
2009-03-01T18:00:00.000
0
0
1
0
python,oop,module
600,206
7
false
0
0
I'd definitely go for the second option : having already used the first one, I'm now forced to refactor, as my application evolved and have to support more modular constructs, so I now need to handle multiple simulataneous 'configurations'. The second approach is, IMO, more flexible and future proof. To avoid the longer lines of code, you could use from appstate import AppState instead of just import appstate.
4
23
0
In my application I have to maintain some global application state and global application wide methods like currently connected users, total number of answers, create an application config file etc. There are two options: Make a separate appstate.py file with global variables with functions over them. It looks fine initially but it seems that I am missing something in clarity of my code. Create a class AppState with class functions in a appstate.py file, all other modules have been defined by their specific jobs. This looks fine. But now I have to write longer line like appstate.AppState.get_user_list(). Moreover, the methods are not so much related to each other. I can create separate classes but that would be too many classes. EDIT: If I use classes I will be using classmethods. I don't think there is a need to instantiate the class to an object.
choosing between Modules and Classes
0
0
0
11,569
600,190
2009-03-01T18:00:00.000
6
0
1
0
python,oop,module
600,219
7
false
0
0
The second approach is only significantly different from the first approach if you have application state stored in an instance of AppState, in which case your complaint doesn't apply. If you're just storing stuff in a class and using static/class methods, your class is no different than a module, and it would be pythonic to instead actually have it as a module.
4
23
0
In my application I have to maintain some global application state and global application wide methods like currently connected users, total number of answers, create an application config file etc. There are two options: Make a separate appstate.py file with global variables with functions over them. It looks fine initially but it seems that I am missing something in clarity of my code. Create a class AppState with class functions in a appstate.py file, all other modules have been defined by their specific jobs. This looks fine. But now I have to write longer line like appstate.AppState.get_user_list(). Moreover, the methods are not so much related to each other. I can create separate classes but that would be too many classes. EDIT: If I use classes I will be using classmethods. I don't think there is a need to instantiate the class to an object.
choosing between Modules and Classes
1
0
0
11,569
600,190
2009-03-01T18:00:00.000
28
0
1
0
python,oop,module
600,201
7
false
0
0
Sounds like the classic conundrum :-). In Python, there's nothing dirty or shameful about choosing to use a module if that's the best approach. After all, modules, functions, and the like are, in fact, first-class citizens in the language, and offer introspection and properties that many other programming languages offer only by the use of objects. The way you've described your options, it kinda sounds like you're not too crazy about a class-based approach in this case. I don't know if you've used the Django framework, but if not, have a look at the documentation on how it handle settings. These are app-wide, they are defined in a module, and they are available globally. The way it parses the options and expose them globally is quite elegant, and you may find such an approach inspiring for your needs.
4
23
0
In my application I have to maintain some global application state and global application wide methods like currently connected users, total number of answers, create an application config file etc. There are two options: Make a separate appstate.py file with global variables with functions over them. It looks fine initially but it seems that I am missing something in clarity of my code. Create a class AppState with class functions in a appstate.py file, all other modules have been defined by their specific jobs. This looks fine. But now I have to write longer line like appstate.AppState.get_user_list(). Moreover, the methods are not so much related to each other. I can create separate classes but that would be too many classes. EDIT: If I use classes I will be using classmethods. I don't think there is a need to instantiate the class to an object.
choosing between Modules and Classes
1
0
0
11,569
600,225
2009-03-01T18:22:00.000
2
0
0
0
python,google-app-engine,e-commerce,satchmo
833,823
3
false
1
0
Nothing is impossible - this will just require lots of effort - if there will be somebody wishing to do so - why not? But it might be easier (cheaper) to get Django friendly hosting instead of spending hours on hacking the code.
1
4
0
I understand that there are big differences in data-store, but surely since django is bundled and it abstracts data-store away from Satchmo, something can be done? Truth is that I am not a Python guy, been mostly Java/PHP thus far, but I am willing to learn. Plus, if this is not possible today, lets band together and form a new Open Source project to "extend" satchmo or perhaps branch it, for compatibility?
How to make Satchmo work in Google App Engine
0.132549
0
0
1,984
600,401
2009-03-01T20:04:00.000
6
0
1
0
python,ide,debugging
600,436
4
false
0
0
Forgive me for the shameless functional programming plug, but... The ability to step backwards.
2
2
0
Please tell me which features you wish your current Python debugger had. I'm creating a new Python IDE/debugger and am looking forward to challenging requests!
What features would a *perfect* Python debugger have?
1
0
0
529
600,401
2009-03-01T20:04:00.000
2
0
1
0
python,ide,debugging
600,434
4
false
0
0
The #1 debug feature for me (that my current IDE, Wing, does happen to have) is the ability to drop into a python interpreter and run arbitrary python code when at a breakpoint. Reminds me of using Smalltalk back in the day. Ability to execute code in local scope is incredibly useful, especially in contrast to working in C++ when it can sometimes be a fight to inspect a local variable.
2
2
0
Please tell me which features you wish your current Python debugger had. I'm creating a new Python IDE/debugger and am looking forward to challenging requests!
What features would a *perfect* Python debugger have?
0.099668
0
0
529
601,039
2009-03-02T01:54:00.000
5
1
1
0
python,vim
601,053
12
false
0
0
Command combination seems to work through the | character, so perhaps something like aliasing :w|!your-command-here to a distinct key combination.
1
52
0
I do a lot of Python quick simulation stuff and I'm constantly saving (:w) and then running (:!!). Is there a way to combine these actions? Maybe a "save and run" command.
Save and run at the same time in Vim
0.083141
0
0
19,544
601,236
2009-03-02T04:04:00.000
3
0
1
1
python,macos
618,078
11
false
0
0
How about EPD from Enthought? Yes, it's large but it is a framework build and includes things like wxPython, vtk, numpy, scipy, and ipython built-in.
4
8
0
I bought a low-end MacBook about a month ago and am finally getting around to configuring it for Python. I've done most of my Python work in Windows up until now, and am finding the choices for OS X a little daunting. It looks like there are at least five options to use for Python development: "Stock" Apple Python MacPython Fink MacPorts roll-your-own-from-source I'm still primarily developing for 2.5, so the stock Python is fine from a functionality standpoint. What I want to know is: why should I choose one over the other? Update: To clarify, I am looking for a discussion of the various options, not links to the documentation. I've marked this as a Community Wiki question, as I don't feel there is a "correct" answer. Thanks to everyone who has already commented for their insight.
Recommendations for Python development on a Mac?
0.054491
0
0
6,687
601,236
2009-03-02T04:04:00.000
0
0
1
1
python,macos
601,287
11
false
0
0
I recommend python (any python?) plus the ipython shell. My most recent experience with MacPython was MacPython 2.5, and I found IDLE frustrating to use as an editor. It's not very featureful, and its' very slow to scroll large quantities of output.
4
8
0
I bought a low-end MacBook about a month ago and am finally getting around to configuring it for Python. I've done most of my Python work in Windows up until now, and am finding the choices for OS X a little daunting. It looks like there are at least five options to use for Python development: "Stock" Apple Python MacPython Fink MacPorts roll-your-own-from-source I'm still primarily developing for 2.5, so the stock Python is fine from a functionality standpoint. What I want to know is: why should I choose one over the other? Update: To clarify, I am looking for a discussion of the various options, not links to the documentation. I've marked this as a Community Wiki question, as I don't feel there is a "correct" answer. Thanks to everyone who has already commented for their insight.
Recommendations for Python development on a Mac?
0
0
0
6,687
601,236
2009-03-02T04:04:00.000
2
0
1
1
python,macos
601,250
11
false
0
0
I recommend using Python Virtual environments, especially if you use a Timecapsule because Timecapsule will back everything up, except modules you added to Python!
4
8
0
I bought a low-end MacBook about a month ago and am finally getting around to configuring it for Python. I've done most of my Python work in Windows up until now, and am finding the choices for OS X a little daunting. It looks like there are at least five options to use for Python development: "Stock" Apple Python MacPython Fink MacPorts roll-your-own-from-source I'm still primarily developing for 2.5, so the stock Python is fine from a functionality standpoint. What I want to know is: why should I choose one over the other? Update: To clarify, I am looking for a discussion of the various options, not links to the documentation. I've marked this as a Community Wiki question, as I don't feel there is a "correct" answer. Thanks to everyone who has already commented for their insight.
Recommendations for Python development on a Mac?
0.036348
0
0
6,687
601,236
2009-03-02T04:04:00.000
9
0
1
1
python,macos
601,252
11
false
0
0
One advantage I see in using the "stock" Python that's included with Mac OS X is that it makes deployment to other Macs a piece of cake. I don't know what your deployment scenario is, but for me this is important. My code has to run on any number of Macs at work, and I try to minimize the amount of work it takes to run my code on all of those systems.
4
8
0
I bought a low-end MacBook about a month ago and am finally getting around to configuring it for Python. I've done most of my Python work in Windows up until now, and am finding the choices for OS X a little daunting. It looks like there are at least five options to use for Python development: "Stock" Apple Python MacPython Fink MacPorts roll-your-own-from-source I'm still primarily developing for 2.5, so the stock Python is fine from a functionality standpoint. What I want to know is: why should I choose one over the other? Update: To clarify, I am looking for a discussion of the various options, not links to the documentation. I've marked this as a Community Wiki question, as I don't feel there is a "correct" answer. Thanks to everyone who has already commented for their insight.
Recommendations for Python development on a Mac?
1
0
0
6,687
601,442
2009-03-02T06:34:00.000
1
0
0
0
python,django,mapping,geodjango
614,489
4
false
1
0
How often will the floor plan change? From your description a simple image with a imagemap would suffice.
2
7
0
I want to create a floor plan map of an interior space that has clickable regions. My first thought was to investigate GeoDjango since its the mapping app for Django. But considering the dependencies, the learning curve and overall complexity, I'm concerned that I may be trying to swat a fly with a bazooka. Should I use GeoDjango for this, or should I just store integer lists in a database field? EDIT: The floor plan would be fairly simple; a collection of walls and workstations with the ability to define regions for how much space the workstation occupies, thus allowing offices to be defined as well as open plan layouts.
Should I use GeoDjango for mapping a floor plan?
0.049958
0
0
3,422
601,442
2009-03-02T06:34:00.000
5
0
0
0
python,django,mapping,geodjango
613,955
4
true
1
0
I'd say that using GeoDjango for this purpose is definitely overkill. It could be implemented simply with an image map, or Canvas/SVG or Flash for extra pretty-points :)
2
7
0
I want to create a floor plan map of an interior space that has clickable regions. My first thought was to investigate GeoDjango since its the mapping app for Django. But considering the dependencies, the learning curve and overall complexity, I'm concerned that I may be trying to swat a fly with a bazooka. Should I use GeoDjango for this, or should I just store integer lists in a database field? EDIT: The floor plan would be fairly simple; a collection of walls and workstations with the ability to define regions for how much space the workstation occupies, thus allowing offices to be defined as well as open plan layouts.
Should I use GeoDjango for mapping a floor plan?
1.2
0
0
3,422
602,030
2009-03-02T11:46:00.000
0
0
1
0
python,django
603,637
4
false
1
0
You'd either have to use a cache, or fetch the most recent change on each request (since you can't persist objects between requests in-memory). From what you describe, it sounds as if it's being hit fairly frequently, so the cache is probably the way to go.
1
0
0
I am working on ajax-game. The abstract: 2+ gamers(browsers) change a variable which is saved to DB through json. All gamers are synchronized by javascript-timer+json - periodically reading that variable from DB. In general, all changes are stored in DB as history, but I want the recent change duplicated in memory. So the problem is: i want one variable to be stored in memory instead of DB.
Store last created model's row in memory
0
1
0
127
602,046
2009-03-02T11:55:00.000
13
0
1
0
python,typechecking
602,078
7
true
0
0
The simple answer is No, use Polymorphism, Exceptions etc. In the case of constructor arguments being of the wrong type, an exception will be thrown when executing code that depend s on the parameter being of a particular type. If it is a weird, domain specific thing, raise your own Exception. Surround blocks of code which are likely to fail with try-except and handle errors. So it is better to use Exception handling. (Same goes for function arguments) In properties, the same argument applies. If you are validating the value received, use an assertion to check its range etc. If the value is of the wrong type, it will fail anyway. Then, handle AssertionError. In Python, you treat programmers as intelligent beings!! Just document your code well (make things obvious), raise Exceptions where appropriate, write polymorphic code etc. Leave the Exception handling(where it is appropriate only)/errors in construction to the client code. Warning Leaving Exception handling to clients doesn't mean that you should chuck a lot of garbage errors at the unwitting user. If at all possible, handle exceptions that might occur due to bad construction or any other reason in your code itself. Your code should be robust. Where it is impossible for you to handle the error, politely inform the user/client code programmer! Note In general, bad arguments to a constructor isn't something I worry about too much.
1
15
0
Python discourages checking the types. But in many cases this may be useful: Checking constructor arguments. e.g. checking foe Boolean, string, dict etc. If I don't and set the object's members to the arguments it will cause problems later. Checking functions arguments. In properties. If someone sets a wrong value or different type, I should respond quickly.
Should I check the types of constructor arguments (and at other places too)?
1.2
0
0
12,261
602,322
2009-03-02T13:17:00.000
1
0
0
0
jquery,python,html,dhtml
602,381
3
false
1
0
Without thinking of deltas: You can use JSON quite easily to do this sort of thing. You can roll out your own compressed format, too. I think compressing the data using gzip would help a lot. Most browsers nowadays support it, and it will greatly reduce the size of your responses.
1
2
0
I have a game that's based on a 25x20 HTML table (the game board). Every 3 seconds the user can "move," which sends an AJAX request to the server, at which time the server rerenders the entire HTML table and sends it to the user. This was easy to write, but it wastes a lot of bandwidth. Are there any libraries, client (preferably jquery) or server-side, that help send differential instead of full updates for large tables? Usually only 5-10 tiles change on a given reload, so I feel like I could cut bandwidth use by an order of magnitude by sending just those tiles instead of all 500 every 3 seconds. I'm also open to "you idiot, why are you using HTML tables"-type comments if you can suggest a better alternative. For example are there any CSS/DOM manipulation techniques I should be considering instead of using an HTML table? Should I use a table but give each td coordinates for an id (like "12x08") and then use jquery to replace cells by id? A clarification: the tiles are text, not images.
Differential AJAX updates for HTML table?
0.066568
0
0
981
602,599
2009-03-02T14:51:00.000
2
0
1
0
python,debugging,pdb
602,733
2
false
0
0
';;' allow to separate commands [crchemist@test tmp]$ python t.py > /home/crchemist/tmp/t.py(7)() -> a() (Pdb) p a ;; l function a at 0xb7e96df4 2 b = 49 + 45 3 v = 'fff' 4 return v 5 6 import pdb; pdb.set_trace() 7 -> a() [EOF] (Pdb) s ;; l --Call-- > /home/crchemist/tmp/t.py(1)a() -> def a(): 1 -> def a(): 2 b = 49 + 45 3 v = 'fff' 4 return v 5 6 import pdb; pdb.set_trace() 7 a() [EOF] (Pdb) s ;; l > /home/crchemist/tmp/t.py(2)a() -> b = 49 + 45 1 def a(): 2 -> b = 49 + 45 3 v = 'fff' 4 return v 5 6 import pdb; pdb.set_trace() 7 a() [EOF] (Pdb)
1
5
0
I would like to have the output of the python pdb 'l' command printed to the screen after every command I enter in an interactive debugging session. Is there a way to setup python pdb to do this?
How to show the output of 'l' in python pdb after every command entered
0.197375
0
0
1,455
603,856
2009-03-02T20:24:00.000
0
0
0
0
python,urllib2
603,916
8
false
0
0
see urllib2.py:do_request (line 1044 (1067)) and urllib2.py:do_open (line 1073) (line 293) self.addheaders = [('User-agent', client_version)] (only 'User-agent' added)
1
15
0
I have a Python web client that uses urllib2. It is easy enough to add HTTP headers to my outgoing requests. I just create a dictionary of the headers I want to add, and pass it to the Request initializer. However, other "standard" HTTP headers get added to the request as well as the custom ones I explicitly add. When I sniff the request using Wireshark, I see headers besides the ones I add myself. My question is how do a I get access to these headers? I want to log every request (including the full set of HTTP headers), and can't figure out how. any pointers? in a nutshell: How do I get all the outgoing headers from an HTTP request created by urllib2?
How do you get default headers in a urllib2 Request?
0
0
1
14,482
605,629
2009-03-03T09:02:00.000
2
1
0
0
c++,python,observer-pattern,publish-subscribe
607,627
3
false
0
0
Perhaps you misunderstand what signals and slots are. With signals and slots you don't have to know who sends signals. Your "client" class just declares slots, and an outside manager can connect signals to them. I recommend you to check out Qt. It's an amazing cross-platform library with much more than just GUI support. It has a convenient and efficient implementation of signals and slots which you can use. These days it's also licensed with LGPL (in addition to GPL and commercial), so you can use it for practically any purpose. Re your clarification comment, why not raise an exception for the error? The parent can notify the GUI, or alternatively the GUI can register for a signal the parent emits. This way the parent also doesn't have to know about the GUI.
1
1
0
i'm looking for a C++ replacement of the Python PubSub Library in which i don't have to connect a signal with a slot or so, but instead can register for a special Kind of messages, without knowing the object which can send it.
Python's PubSub/observer Pattern for C++?
0.132549
0
0
1,723
606,516
2009-03-03T14:12:00.000
0
0
1
0
python,graph
10,728,193
8
false
0
0
I second zweiterlinde's suggestion to use python-graph. I've used it as the basis of a graph-based research project that I'm working on. The library is well written, stable, and has a good interface. The authors are also quick to respond to inquiries and reports.
1
386
0
I'm writing a python application that will make heavy use of a graph data structure. Nothing horribly complex, but I'm thinking some sort of graph/graph-algorithms library would help me out. I've googled around, but I don't find anything that particularly leaps out at me. Anyone have any good recommendations?
Python Graph Library
0
0
0
254,177
608,098
2009-03-03T20:45:00.000
0
0
0
0
python,qt,sqlite,pyqt4,pywin32
608,262
1
false
0
0
When dealing with databases and PyQt UIs, I'll use something similar to model-view-controller model to help organize and simplify the code. View module uses/holds any QObjects that are necessary for the UI contain simple functions/methods for updating your QTGui Object, as well as extracting input from GUI objects Controller module will perform all DB interactions the more complex code lives here By using a MVC, you will not need to rely on the QT Library as much, and you will run into less problems linking QT with Python. So I guess my suggestion is to continue using pysqlite (since that's what you are used to), but refactor your design a little so the only thing dealing with the QT libraries is the UI. From the description of your GUI, it should be fairly straightforward.
1
1
0
I am writing a Python (2.5) GUI Application that does the following: Imports from Access to an Sqlite database Saves ui form settings to an Sqlite database Currently I am using pywin32 to read Access, and pysqlite2/dbapi2 to read/write Sqlite. However, certain Qt objects don't automatically cast to Python or Sqlite equivalents when updating the Sqlite database. For example, a QDate, QDateTime, QString and others raise an error. Currently I am maintaining conversion functions. I investigated using QSql, which appears to overcome the casting problem. In addition, it is able to connect to both Access and Sqlite. These two benefits would appear to allow me to refactor my code to use less modules and not maintain my own conversion functions. What I am looking for is a list of important side-effects, performance gains/losses, functionality gains/losses that any of the SO community has experienced as a result from the switch to QSql. One functionality loss I have experienced thus far is the inability to use Access functions using the QODBC driver (e.g., 'SELECT LCASE(fieldname) from tablename' fails, as does 'SELECT FORMAT(fieldname, "General Number") from tablename')
What will I lose or gain from switching database APIs? (from pywin32 and pysqlite to QSql)
0
1
0
241
608,316
2009-03-03T21:33:00.000
2
0
1
0
python,file-io,commit,buffering
609,465
4
false
0
0
As has already been stated use the .flush() method to force the write out of the buffer, but avoid using a lot of calls to flush as this can actually slow your writing down (if the application relies on fast writes) as you'll be forcing your filesystem to write changes that are smaller than it's buffer size which can bring you to your knees. :)
4
8
0
I have a file open for writing, and a process running for days -- something is written into the file in relatively random moments. My understanding is -- until I do file.close() -- there is a chance nothing is really saved to disk. Is that true? What if the system crashes when the main process is not finished yet? Is there a way to do kind of commit once every... say -- 10 minutes (and I call this commit myself -- no need to run timer)? Is file.close() and open(file,'a') the only way, or there are better alternatives?
is there COMMIT analog in python for writing into a file?
0.099668
0
0
3,963
608,316
2009-03-03T21:33:00.000
21
0
1
0
python,file-io,commit,buffering
608,322
4
true
0
0
You should be able to use file.flush() to do this.
4
8
0
I have a file open for writing, and a process running for days -- something is written into the file in relatively random moments. My understanding is -- until I do file.close() -- there is a chance nothing is really saved to disk. Is that true? What if the system crashes when the main process is not finished yet? Is there a way to do kind of commit once every... say -- 10 minutes (and I call this commit myself -- no need to run timer)? Is file.close() and open(file,'a') the only way, or there are better alternatives?
is there COMMIT analog in python for writing into a file?
1.2
0
0
3,963
608,316
2009-03-03T21:33:00.000
2
0
1
0
python,file-io,commit,buffering
608,518
4
false
0
0
To make sure that you're data is written to disk, use file.flush() followed by os.fsync(file.fileno()).
4
8
0
I have a file open for writing, and a process running for days -- something is written into the file in relatively random moments. My understanding is -- until I do file.close() -- there is a chance nothing is really saved to disk. Is that true? What if the system crashes when the main process is not finished yet? Is there a way to do kind of commit once every... say -- 10 minutes (and I call this commit myself -- no need to run timer)? Is file.close() and open(file,'a') the only way, or there are better alternatives?
is there COMMIT analog in python for writing into a file?
0.099668
0
0
3,963
608,316
2009-03-03T21:33:00.000
3
0
1
0
python,file-io,commit,buffering
608,373
4
false
0
0
If you don't want to kill the current process to add f.flush() (it sounds like it's been running for days already?), you should be OK. If you see the file you are writing to getting bigger, you will not lose that data... From Python docs: write(str) Write a string to the file. There is no return value. Due to buffering, the string may not actually show up in the file until the flush() or close() method is called. It sounds like Python's buffering system will automatically flush file objects, but it is not guaranteed when that happens.
4
8
0
I have a file open for writing, and a process running for days -- something is written into the file in relatively random moments. My understanding is -- until I do file.close() -- there is a chance nothing is really saved to disk. Is that true? What if the system crashes when the main process is not finished yet? Is there a way to do kind of commit once every... say -- 10 minutes (and I call this commit myself -- no need to run timer)? Is file.close() and open(file,'a') the only way, or there are better alternatives?
is there COMMIT analog in python for writing into a file?
0.148885
0
0
3,963
608,710
2009-03-03T23:41:00.000
0
0
0
0
python,cocoa,macos,idle-processing
608,833
2
false
0
0
You can use Quartz event taps and an NSTimer. Any time one of your event taps lights up, postpone the timer by setting its fire date. When the timer fires, the user is idle. I'm not sure whether Quartz event taps are exposed to Python, though. The drawing APIs are, but I'm not sure about event taps.
1
3
0
Developing a mac app, how can I tell whether the user is currently at their computer or not? Or how long ago they last pressed a key or moved the mouse?
Monitoring user idle time
0
0
0
895
609,190
2009-03-04T04:10:00.000
0
0
1
0
python,ide,editor,python-idle
612,104
5
false
0
0
You could use custom print function.
1
2
0
Sometimes I'll be working with, say, a list of thousands of items in IDLE, and accidently print it out to the shell. When this happens, it crashes or at least very significaly slows down IDLE. As you can imagine, this is extremely inconvenient. Is there a way to make it, rather than printing the entire thing, just give me a summarised [1, 2, ...] output? Any help would be much appreciated.
How can I stop IDLE from printing giant lists?
0
0
0
681
609,516
2009-03-04T07:08:00.000
0
0
0
0
python,sqlite,pysqlite
610,761
2
false
0
0
You probably have to cast it to the correct type. Try "SELECT * FROM tasks WHERE (display = CAST ('True' AS bool))".
1
1
0
Using pysqlite how can a user-defined-type be used as a value in a comparison, e. g: “... WHERE columnName > userType”? For example, I've defined a bool type with the requisite registration, converter, etc. Pysqlite/Sqlite responds as expected for INSERT and SELECT operations (bool 'True' stored as an integer 1 and returned as True). But it fails when the bool is used in either “SELECT * from tasks WHERE display = True” or “... WHERE display = 'True.' “ In the first case Sqlite reports an error that there is not a column named True. And in the second case no records are returned. The select works if a 1 is used in place of True. I seem to have the same problem when using pysqlite's own date and timestamp adaptors. I can work around this behavior for this and other user-types but that's not as fun. I'd like to know if using a user-defined type in a query is or is not possible so that I don't keep banging my head on this particular wall. Thank you.
pysqlite user types in select statement
0
1
0
671
610,128
2009-03-04T11:11:00.000
0
1
0
0
performance,ironpython
613,533
3
true
1
1
Turns out, after aspnet_wp goes to about 500mb, the garbage collector kicks in and cleans out the mess. The memory usage then drops to about 20mb and steadily starts increasing again during load testing. So there's no memory 'leak' as such.
2
2
0
I'm hosting IronPython in a c#-based WebService to be able to provide custom extension scripts. However, I'm finding that memory usage sharply increases when I do simple load testing by executing the webservice repeatedly in a loop. IronPython-1.1 implemented IDisposable on its objects so that you can dispose of them when they are done. The new IronPython-2 engine based on the DLR has no such concept. From what I understood, everytime you execute a script in the ScriptEngine a new assembly is injected in the appdomain and can't be unloaded. Is there any way around this?
IronPython memory usage
1.2
0
0
1,344
610,128
2009-03-04T11:11:00.000
1
1
0
0
performance,ironpython
611,623
3
false
1
1
You could try creating a new AppDomain every time you run one of your IronPython scripts. Although assebmlies cannot be unloaded from memory you can unload an AppDomain and this will allow you to get the injected assembly out of memory.
2
2
0
I'm hosting IronPython in a c#-based WebService to be able to provide custom extension scripts. However, I'm finding that memory usage sharply increases when I do simple load testing by executing the webservice repeatedly in a loop. IronPython-1.1 implemented IDisposable on its objects so that you can dispose of them when they are done. The new IronPython-2 engine based on the DLR has no such concept. From what I understood, everytime you execute a script in the ScriptEngine a new assembly is injected in the appdomain and can't be unloaded. Is there any way around this?
IronPython memory usage
0.066568
0
0
1,344
610,892
2009-03-04T14:48:00.000
7
0
0
0
python,graph,procedural-generation
611,124
2
true
0
0
First, you need some sense of Location. Your various objects occupy some amount of coordinate space. You have to decide how regular these various things are. In the trivial case, you can drop them into your coordinate space as simple rectangles (or rectangular solids) to make locations simpler to plan out. If the things are irregular -- and densely packed -- life is somewhat more complex. Define a Map to contain locations. Each location has a span of coordinates; if you work with simple rectangles, then each location can have a (left, top, right, bottom) tuple. Your Map will need methods to determine who is residing in a given space, and what's adjacent to the space, etc. You can then unit test this with a fixed set of locations you've worked out that can all be dropped into the map and pass some basic sanity checks for non-conflicting, adjacent, and the like. Second, you need a kind of "maze generator". A simply-connected maze is easily generated as a tree structure that's folded up into the given space. The maze/tree has a "root" node that will be the center of the maze. Not necessarily the physical center of your space, but the root node will be the middle of the maze structure. Ideally, one branch from this node contains one "entrance" to the entire space. The other branch from this node contains one "exit" from the entire space. Someone can wander from entrance to exit, visiting a lot of "dead-end" locations along the way. Pick a kind of space for the root node. Drop it into your Map space. This will have 1 - n entrances, each of which is a sub-tree with a root node and 1 - n entrances. It's this multiple-entrance business that makes a tree a natural fit for this structure. Also a proper tree is always well-connected in that you never have isolated sections that can't be reached. You'll -- recursively -- fan out from the root node, picking locations and dropping them into the available space. Unit test this to be sure it fills space reasonably well. The rest of your requirements are fine-tuning on the way the maze generator picks locations. The easiest is to have a table of weights and random choices. Choose a random number, compare it with the weights to see which kind of location gets identified. Your definition of space can be 2D or 3D -- both are pretty rational. For bonus credit, consider how you'd implement a 2D-space tiled with hexagons instead of squares. This "geometry" can be a Strategy plug-in to the various algorithms. If you can replace square 2D with hexagonal 2D, you've done a good job of OO Design.
1
9
0
I'm developing a procedurally-generated game world in Python. The structure of the world will be similar to the MUD/MUSH paradigm of rooms and exits arranged as a directed graph (rooms are nodes, exits are edges). (Note that this is not necessarily an acyclic graph, though I'm willing to consider acyclic solutions.) To the world generation algorithm, rooms of different sorts will be distinguished by each room's "tags" attribute (a set of strings). Once they have been instantiated, rooms can be queried and selected by tags (single-tag, tag intersection, tag union, best-candidate). I'll be creating specific sorts of rooms using a glorified system of template objects and factory methods--I don't think the details are important here, as the current implementation will probably change to match the chosen strategy. (For instance, it would be possible to add tags and tag-queries to the room template system.) For an example, I will have rooms of these sorts: side_street, main_street, plaza, bar, hotel, restaurant, shop, office Finally, the question: what is a good strategy for instantiating and arranging these rooms to create a graph that might correspond to given rules? Some rules might include: one plaza per 10,000 population; main_street connects to plaza; side_street connects to main_street or side_street; hotel favors main_street or plaza connections, and receives further tags accordingly; etc. Bonus points if a suggested strategy would enable a data-driven implementation.
What is a good strategy for constructing a directed graph for a game map (in Python)?
1.2
0
0
1,142
611,691
2009-03-04T17:49:00.000
4
0
0
0
python,python-3.x,django,django-models,django-admin
611,725
5
true
1
0
If you are inheriting the model then it is probably not wise to attempt to hide or disable any existing fields. The best thing you could probably do is exactly what you suggested: override save() and handle your logic in there.
1
10
0
I want to inherit a model class from some 3rd party code. I won't be using some of the fields but want my client to be able to edit the model in Admin. Is the best bet to hide them from Admin or can I actually prevent them being created in the first place? Additionally - what can I do if one of the unwanted fields is required? My first thought is to override the save method and just put in a default value.
Django Model Inheritance. Hiding or removing fields
1.2
0
0
6,399
612,372
2009-03-04T20:51:00.000
6
0
0
0
python,django
612,955
14
false
1
0
No, but you can copy admin template and define app name there.
1
151
0
In the same way that you can give fields and models verbose names that appear in the Django admin, can you give an app a custom name?
Can you give a Django app a verbose name for use throughout the admin?
1
0
0
84,109
613,471
2009-03-05T03:18:00.000
3
0
0
0
python,ip-address,tcp
613,477
16
false
0
0
Your simplest way may be to ask some server on the outside of your network. One thing to keep in mind is that different destinations may see a different address for you. The router may be multihomed. And really that's just where problems begin.
3
28
0
I'm behind a router, I need a simple command to discover my public ip (instead of googling what's my ip and clicking one the results) Are there any standard protocols for this? I've heard about STUN but I don't know how can I use it? P.S. I'm planning on writing a short python script to do it
Discovering public IP programmatically
0.037482
0
1
19,213
613,471
2009-03-05T03:18:00.000
1
0
0
0
python,ip-address,tcp
60,525,518
16
false
0
0
Here are a few public services that support IPv4 and IPv6: curl http://icanhazip.com curl http://www.trackip.net/ip curl https://ipapi.co/ip curl http://api6.ipify.org curl http://www.cloudflare.com/cdn-cgi/trace curl http://checkip.dns.he.net The following seem to support only IPv4 at this time: curl http://bot.whatismyipaddress.com curl http://checkip.dyndns.org curl http://ifconfig.me curl http://ip-api.com curl http://api.infoip.io/ip It's easy to make an HTTP call programmatically. So all should be relatively easy to use, and you can try multiple different URLs in case one fails.
3
28
0
I'm behind a router, I need a simple command to discover my public ip (instead of googling what's my ip and clicking one the results) Are there any standard protocols for this? I've heard about STUN but I don't know how can I use it? P.S. I'm planning on writing a short python script to do it
Discovering public IP programmatically
0.012499
0
1
19,213
613,471
2009-03-05T03:18:00.000
3
0
0
0
python,ip-address,tcp
613,518
16
false
0
0
If the network has an UpNp server running on the gateway you are able to talk to the gateway and ask it for your outside IP address.
3
28
0
I'm behind a router, I need a simple command to discover my public ip (instead of googling what's my ip and clicking one the results) Are there any standard protocols for this? I've heard about STUN but I don't know how can I use it? P.S. I'm planning on writing a short python script to do it
Discovering public IP programmatically
0.037482
0
1
19,213
615,100
2009-03-05T14:52:00.000
0
1
1
0
c++,python
615,254
17
false
0
0
Try LISP instead (or afterwards, it's your call). You are at least partially right, though. using Python for a while makes you not want to go back to a statically typed and compiled language. It's just sooo much more comfortable not to have to please the compiler like ALL THE TIME ;). And yet another aspect is the readability of python code, which is awesome.
17
8
0
I`m currently studying C++ and want to learn another language. For work I use C# + ASP (just started learning it, actually), but I want something "less Microsoft" and powerful. I have heard Python is a popular and powerful language, not so complicated as C++. But many people mentioned it was hard for them to get back to C++/Java from Python because they started thinking in it, get used to absence of memory management, etc. What do you recommend?
Should I learn Python after C++?
0
0
0
9,495
615,100
2009-03-05T14:52:00.000
2
1
1
0
c++,python
615,121
17
false
0
0
I don't think that "Python makes you lazy" (nice title, anyway!). On the contrary, in programming as in life, knowing more than one language is important; I think you'll find python amusing and sufficiently different from C++ or C# so that the languages will not get mixed in your head...
17
8
0
I`m currently studying C++ and want to learn another language. For work I use C# + ASP (just started learning it, actually), but I want something "less Microsoft" and powerful. I have heard Python is a popular and powerful language, not so complicated as C++. But many people mentioned it was hard for them to get back to C++/Java from Python because they started thinking in it, get used to absence of memory management, etc. What do you recommend?
Should I learn Python after C++?
0.023525
0
0
9,495
615,100
2009-03-05T14:52:00.000
1
1
1
0
c++,python
615,129
17
false
0
0
Learning more languages can only make you a better developer, regardless of their approach. Besides, your experience with C++ (or, at least C) will come in handy for writing high-performance parts of your applications using Python's C API, which lets "raw" C and C++ code intermingle nicely with the pure Python stuff. I still write code in Objective-C (1.0... before memory management) and Python on a daily basis. The variety is actually fun, rather than confusing; keeps things from being boring.
17
8
0
I`m currently studying C++ and want to learn another language. For work I use C# + ASP (just started learning it, actually), but I want something "less Microsoft" and powerful. I have heard Python is a popular and powerful language, not so complicated as C++. But many people mentioned it was hard for them to get back to C++/Java from Python because they started thinking in it, get used to absence of memory management, etc. What do you recommend?
Should I learn Python after C++?
0.011764
0
0
9,495
615,100
2009-03-05T14:52:00.000
2
1
1
0
c++,python
615,163
17
false
0
0
Python is complementary to C++ and easy to integrate with C++. (As evidence of this claim, the C++ gurus from Boost use Python.) And as you said, Python gives you a way to get a perspective outside the Microsoft orbit. But even there, if you need to integrate Python with MS tools, there's IronPython.
17
8
0
I`m currently studying C++ and want to learn another language. For work I use C# + ASP (just started learning it, actually), but I want something "less Microsoft" and powerful. I have heard Python is a popular and powerful language, not so complicated as C++. But many people mentioned it was hard for them to get back to C++/Java from Python because they started thinking in it, get used to absence of memory management, etc. What do you recommend?
Should I learn Python after C++?
0.023525
0
0
9,495
615,100
2009-03-05T14:52:00.000
0
1
1
0
c++,python
615,155
17
false
0
0
You could learn a new programming language, like python, and use it to do all the tasks you'd normally perform in your 'core' languages; or you could take a language (like python, or perl) and use it to complement your core language. You could learn VBScript and use it to write scripts that glue your code and others together. If you want something less Microsoft, then python, perl or bash scripting would be a good idea - not just to learn how to code in the new, but also how to do things differently from the usual 'code an app' way.
17
8
0
I`m currently studying C++ and want to learn another language. For work I use C# + ASP (just started learning it, actually), but I want something "less Microsoft" and powerful. I have heard Python is a popular and powerful language, not so complicated as C++. But many people mentioned it was hard for them to get back to C++/Java from Python because they started thinking in it, get used to absence of memory management, etc. What do you recommend?
Should I learn Python after C++?
0
0
0
9,495
615,100
2009-03-05T14:52:00.000
4
1
1
0
c++,python
615,152
17
false
0
0
Many would argue that you would benefit from learning Python before C++. The syntax hurdles are much, much lower; Debugging is much more friendly There are a plethora of libraries---batteries included, you know. It's easy to experiment with web scraping, XML, etc. in Python. Again, the barriers to entry in C++ are much higher. It's still good to learn C/C++, because of its close connection to the machine. But a new programmer can learn an awful lot from exploring in Python.
17
8
0
I`m currently studying C++ and want to learn another language. For work I use C# + ASP (just started learning it, actually), but I want something "less Microsoft" and powerful. I have heard Python is a popular and powerful language, not so complicated as C++. But many people mentioned it was hard for them to get back to C++/Java from Python because they started thinking in it, get used to absence of memory management, etc. What do you recommend?
Should I learn Python after C++?
0.047024
0
0
9,495
615,100
2009-03-05T14:52:00.000
1
1
1
0
c++,python
615,150
17
false
0
0
It is up to what exactly is the kind of applications you want to program, for example for Websites that need access to databases I would go for Ruby( and Ruby on Rails framework ) , for financial applications or applications that need a lot of parallel processing I would go for a funcional programming language like Haskell, oCaml or the new F#, these last 3 wil make you a better programer even if you don't programm a lot in them , by the way c# has been lately in the latest versions adding more and more funcional programming features. I would learn Python for a security and exploits kinds of applications.
17
8
0
I`m currently studying C++ and want to learn another language. For work I use C# + ASP (just started learning it, actually), but I want something "less Microsoft" and powerful. I have heard Python is a popular and powerful language, not so complicated as C++. But many people mentioned it was hard for them to get back to C++/Java from Python because they started thinking in it, get used to absence of memory management, etc. What do you recommend?
Should I learn Python after C++?
0.011764
0
0
9,495
615,100
2009-03-05T14:52:00.000
4
1
1
0
c++,python
615,148
17
false
0
0
Well, I've learnt Python after C/C++, Java and C#. Python is a great language, and its simplicity and consistency have improved the way I code. It has also helped me think more clearly about the algorithms underlying my code. I could go on about the benifits it brought me, instead I'll summarize the reason to learn it -> Learning a new lanuage doesn't take away, it adds to your programming skill and keeps you sharp by teaching you to shift between the frames of mind that each language requires. So go out there and learn Python. Your code will improve(TM). P.S. 1.You'll lose C++ (or any other language) skills, if you neglect their upkeep and maintainance. Thats entirely up to you. 2.Programmer (intelligent) laziness is a virtue.
17
8
0
I`m currently studying C++ and want to learn another language. For work I use C# + ASP (just started learning it, actually), but I want something "less Microsoft" and powerful. I have heard Python is a popular and powerful language, not so complicated as C++. But many people mentioned it was hard for them to get back to C++/Java from Python because they started thinking in it, get used to absence of memory management, etc. What do you recommend?
Should I learn Python after C++?
0.047024
0
0
9,495
615,100
2009-03-05T14:52:00.000
0
1
1
0
c++,python
615,248
17
false
0
0
I learned, in order: BASIC Pascal Ada (A little bit of Haskell) Java Python C++ C# I don't feel Python inhibited my ability to learn or use C++. I am glad though that I learned pointers in Pascal before encountering reference types in Java, Python and C#, because I feel it gave me a good basis to understand the idea of the differences between "value types" and "reference types". I think for me the most important of those languages are Python, Haskell and C++. All of them complement each other, and although there are times I'm working in one and wish I had a feature from another, on the whole I think I benefit greatly from a deeper understanding of things like type systems, object orientation and metaprogramming by seeing the different ways these languages approach these things.
17
8
0
I`m currently studying C++ and want to learn another language. For work I use C# + ASP (just started learning it, actually), but I want something "less Microsoft" and powerful. I have heard Python is a popular and powerful language, not so complicated as C++. But many people mentioned it was hard for them to get back to C++/Java from Python because they started thinking in it, get used to absence of memory management, etc. What do you recommend?
Should I learn Python after C++?
0
0
0
9,495
615,100
2009-03-05T14:52:00.000
1
1
1
0
c++,python
618,870
17
false
0
0
I learned C/C++, Java, Python & C# in that order. The two I actually invariably end up using are C++ & Python; I find the niche Java & C# occupy between them to be too narrow to feel the need to use them much (at least for the stuff I do). I also think I didn't really "get" C++ functors and boost::bind until I'd been exposed to Python.
17
8
0
I`m currently studying C++ and want to learn another language. For work I use C# + ASP (just started learning it, actually), but I want something "less Microsoft" and powerful. I have heard Python is a popular and powerful language, not so complicated as C++. But many people mentioned it was hard for them to get back to C++/Java from Python because they started thinking in it, get used to absence of memory management, etc. What do you recommend?
Should I learn Python after C++?
0.011764
0
0
9,495
615,100
2009-03-05T14:52:00.000
1
1
1
0
c++,python
615,138
17
false
0
0
Flex your brain and improve your skill set. Give a functional language a whirl.
17
8
0
I`m currently studying C++ and want to learn another language. For work I use C# + ASP (just started learning it, actually), but I want something "less Microsoft" and powerful. I have heard Python is a popular and powerful language, not so complicated as C++. But many people mentioned it was hard for them to get back to C++/Java from Python because they started thinking in it, get used to absence of memory management, etc. What do you recommend?
Should I learn Python after C++?
0.011764
0
0
9,495
615,100
2009-03-05T14:52:00.000
0
1
1
0
c++,python
617,254
17
false
0
0
It is true. After learning python, everything else will seem like too much effort for the same amount of real work being done. You'll get used to the clean, small syntax and the freedom of GC. You will enjoy working in list comps, generators, etc. You'll start to think in python and C++ and Java will be like building a ship in a bottle one twiggy little stick at a time. But since it's that much easier, doesn't it tempt you to try it all the more?
17
8
0
I`m currently studying C++ and want to learn another language. For work I use C# + ASP (just started learning it, actually), but I want something "less Microsoft" and powerful. I have heard Python is a popular and powerful language, not so complicated as C++. But many people mentioned it was hard for them to get back to C++/Java from Python because they started thinking in it, get used to absence of memory management, etc. What do you recommend?
Should I learn Python after C++?
0
0
0
9,495
615,100
2009-03-05T14:52:00.000
0
1
1
0
c++,python
949,801
17
false
0
0
I think it is always good to know several programming languages. I've learned c++ at school and I've used it a lot in the past years because it is really a standard in the industry. I've learned python by my own and I am using it to make a lot of nice tools that would be too long to write in c++. Python has just a very positive influence on my c++ skills. It gives another way to think.
17
8
0
I`m currently studying C++ and want to learn another language. For work I use C# + ASP (just started learning it, actually), but I want something "less Microsoft" and powerful. I have heard Python is a popular and powerful language, not so complicated as C++. But many people mentioned it was hard for them to get back to C++/Java from Python because they started thinking in it, get used to absence of memory management, etc. What do you recommend?
Should I learn Python after C++?
0
0
0
9,495
615,100
2009-03-05T14:52:00.000
30
1
1
0
c++,python
615,128
17
true
0
0
There's no right or wrong answer, really. But I think you'll benefit more from learning Python. Given the similarities between C# and C++, you'll learn a different way of thinking from Python. The more ways you learn to think about a problem, the better it makes you as a programmer, regardless of the language.
17
8
0
I`m currently studying C++ and want to learn another language. For work I use C# + ASP (just started learning it, actually), but I want something "less Microsoft" and powerful. I have heard Python is a popular and powerful language, not so complicated as C++. But many people mentioned it was hard for them to get back to C++/Java from Python because they started thinking in it, get used to absence of memory management, etc. What do you recommend?
Should I learn Python after C++?
1.2
0
0
9,495
615,100
2009-03-05T14:52:00.000
9
1
1
0
c++,python
615,118
17
false
0
0
The benefit of going from a more static language to a dynamic language is to change your programming paradigm -- it's not a matter of becoming "lazy" so much as realizing new ways of accomplishing things, which will make you better in any language.
17
8
0
I`m currently studying C++ and want to learn another language. For work I use C# + ASP (just started learning it, actually), but I want something "less Microsoft" and powerful. I have heard Python is a popular and powerful language, not so complicated as C++. But many people mentioned it was hard for them to get back to C++/Java from Python because they started thinking in it, get used to absence of memory management, etc. What do you recommend?
Should I learn Python after C++?
1
0
0
9,495
615,100
2009-03-05T14:52:00.000
1
1
1
0
c++,python
1,235,385
17
false
0
0
Many languages are quite similar to others, but to move between imperitave and functional / dynamic and static / Object and Procedural languages you do need to train yourself to think within the constraints of the language you are using. Since most projects are at least a few weeks, this is generally not a problem after the first few days. You will find it more difficult to switch away from a language+environment you enjoy in your after-hours / hobby development. C, Macro Assembler => basically the same - difference is mainly libraries C++, Java, C#, Delphi => basically the same paradigm - you learn quickly how to leverage the features of the specific language and adopt concepts from one syntax to another. It's basically the same way of thinking, the biggest exception is how you think of memory manangement. Python - good language, strategically a better choice than ruby, although there are other aspects of ruby that can be argued to be superior. What make python a good choice is the presence of a formal language body which keeps python environments on different platforms very compatible to one another. If you are interested, read this http://cmdematos.com/?p=120 on making a strategic language choice.
17
8
0
I`m currently studying C++ and want to learn another language. For work I use C# + ASP (just started learning it, actually), but I want something "less Microsoft" and powerful. I have heard Python is a popular and powerful language, not so complicated as C++. But many people mentioned it was hard for them to get back to C++/Java from Python because they started thinking in it, get used to absence of memory management, etc. What do you recommend?
Should I learn Python after C++?
0.011764
0
0
9,495
615,100
2009-03-05T14:52:00.000
0
1
1
0
c++,python
615,218
17
false
0
0
From a utility perspective, it is good to learn one of the more dynamic languages like Python (or Ruby or Perl) too. Not only do they stretch your mind, but they are superior for certain kinds of tasks. If you want to manipulate text, for example, C++ is a lot harder to use than Python. It gives you another arrow in your quiver to use when appropriate.
17
8
0
I`m currently studying C++ and want to learn another language. For work I use C# + ASP (just started learning it, actually), but I want something "less Microsoft" and powerful. I have heard Python is a popular and powerful language, not so complicated as C++. But many people mentioned it was hard for them to get back to C++/Java from Python because they started thinking in it, get used to absence of memory management, etc. What do you recommend?
Should I learn Python after C++?
0
0
0
9,495
615,632
2009-03-05T16:48:00.000
0
0
1
0
python
615,682
2
false
0
0
works fine for me. Could it be that you're not setting doraise to True somehow?
1
0
0
How do I detect an error when compiling a directory of python files using compile_dir? Currently I get something on stderr, but no way to detect it in my app. py_compile.compile() takes a 'doraise' argument, but nothing here. Or is there a better way to do this from a python script? Edit: I fixed it with os.walk and calling py_compile.compile for each file. But the question remains.
How to detect errors from compileall.compile_dir?
0
0
0
970
617,892
2009-03-06T06:55:00.000
2
1
0
0
python,python-2.5,poplib
628,130
4
false
0
0
You can also try imaplib module since GMail also provides access to email via IMAP protocol.
1
1
0
I want to get all the messages from my gmail inbox, but I am facing 2 problems. It does not get all the emails, (as per the count in stat function) The order of emails it get is random. I am unsure if its the problem with poplib or gmail pop server. What am I missing here?
Poplib not working correctly?
0.099668
0
1
1,096
619,384
2009-03-06T16:11:00.000
3
0
0
0
python,django,orm
620,117
3
true
1
0
Since the issue is "manually converting query results into objects," the simplest solution is often to see if your custom SQL can fit into an ORM .extra() call rather than being a pure-SQL query. Often it can, and then you let the ORM do all the work of building up objects as usual.
1
2
0
I often need to execute custom sql queries in django, and manually converting query results into objects every time is kinda painful. I wonder how fellow Slackers deal with this. Maybe someone had written some kind of a library to help dealing with custom SQL in Django?
Tools to ease executing raw SQL with Django ORM
1.2
1
0
3,263
619,437
2009-03-06T16:25:00.000
0
1
1
0
python,interpreter,pypy
619,480
4
false
0
1
cross-platform compatibility Yes
2
28
0
From what I have seen and read on blogs, PyPy is a very ambitious project. What are some advantages it will bring to the table over its siblings (CPython, Jython, and IronPython)? Is it speed, cross-platform compatibility (including mobile platforms), the ability to use c-extensions without the GIL, or is this more of a technical exercise on what can be done?
What does PyPy have to offer over CPython, Jython, and IronPython?
0
0
0
3,214
619,437
2009-03-06T16:25:00.000
38
1
1
0
python,interpreter,pypy
619,544
4
true
0
1
PyPy is really two projects: An interpreter compiler toolchain allowing you to write interpreters in RPython (a static subset of Python) and have cross-platform interpreters compiled standalone, for the JVM, for .NET (etc) An implementation of Python in RPython These two projects allow for many things. Maintaining Python in Python is much easier than maintaining it in C From a single codebase you can generate Python interpreters that run on the JVM, .NET and standalone - rather than having multiple slightly incompatible implementations Part of the compiler toolchain includes an experimental JIT generator (now in its fifth incarnation and starting to work really well) - the goal is for a JITed PyPy to run much faster than CPython It is much easier to experiment with fundamental language features - like removing the GIL, better garbage collection, integrating stackless and so on So there are really a lot of reasons for PyPy to be exciting, and it is finally starting to live up to all its promises.
2
28
0
From what I have seen and read on blogs, PyPy is a very ambitious project. What are some advantages it will bring to the table over its siblings (CPython, Jython, and IronPython)? Is it speed, cross-platform compatibility (including mobile platforms), the ability to use c-extensions without the GIL, or is this more of a technical exercise on what can be done?
What does PyPy have to offer over CPython, Jython, and IronPython?
1.2
0
0
3,214
620,610
2009-03-06T22:07:00.000
-3
0
0
0
python,sql,sqlalchemy
620,784
2
false
0
0
You can use multiple transactions and manage it within scope.
1
53
0
When I have created a table with an auto-incrementing primary key, is there a way to obtain what the primary key would be (that is, do something like reserve the primary key) without actually committing? I would like to place two operations inside a transaction however one of the operations will depend on what primary key was assigned in the previous operation.
SQLAlchemy Obtain Primary Key With Autoincrement Before Commit
-0.291313
1
0
19,996
621,649
2009-03-07T10:36:00.000
2
0
1
0
python,encryption,key
621,653
5
false
0
0
Why not take first 21 chars from md5 or SHA1 hash?
1
7
0
I am using an api which takes a name of 21 char max to represent an internal session which has a lifetime of around "two days". I would like the name not to be meaningfull using some kind of hasing ? md5 generates 40 chars, is there something else i could use ? For now i use 'userid[:10]' + creation time: ddhhmmss + random 3 chars. Thanks,
Python and random keys of 21 char max
0.07983
0
0
7,418
621,802
2009-03-07T12:51:00.000
5
0
0
1
python,django,comet,daemon
622,509
6
true
1
0
I would recommend looking into Twisted, their twisted.web server, and the comet work done on top of it at Divmod. They can handle far more concurrent connections than traditional thread or process based servers, which is exactly what you need for something like this. And, yes, I've architected systems using Twisted for COMET stuff, while using other things for the more front-facing web applications beside it. It works out well with each part doing what it does best.
1
13
0
I want to push data to the browser over HTTP without killing my django/python application. I decided to use a comet server, to proxy requests between my application and the client (though I still haven't really figured it out properly). I've looked into the following engines: orbited cometd ejabberd jetty Has anyone had any experience working with these servers and deploying them? Any insight and links regarding the topics would be great. Thank you.
Choosing and deploying a comet server
1.2
0
0
7,360
623,054
2009-03-08T04:44:00.000
13
0
1
0
python,multithreading
623,070
7
true
1
0
You will probably find your application is bandwidth limited not CPU or I/O limited. As such, add as many as you like until performance begins to degrade. You may come up against other limits depending on your network setup. Like if you're behind an ADSL router, there will be a limit on the number of concurrent NAT sessions, which may impact making too many HTTP requests at once. Make too many and your provider may treat you as being infected by a virus or the like. There's also the issue of how many requests the server you're crawling can handle and how much of a load you want to put on it. I wrote a crawler once that used just one thread. It took about a day to process all the information I wanted at about one page every two seconds. I could've done it faster but I figured this was less of a burden for the server. So really theres no hard and fast answer. Assuming a 1-5 megabit connection I'd say you could easily have up to 20-30 threads without any problems.
3
3
0
I have a simple Python web crawler. It uses SQLite to store its output and also to keep a queue. I want to make the crawler multi-threaded so that it can crawl several pages at a time. I figured i would make a thread and just run several instances of the class at once, so they all run concurrently. But the question is, how many should i run at once? should i stick to two? can i go higher? what would be a reasonable limit for a number of threads? Keep in mind that each thread goes out to a web page, downloads the html, runs a few regex searches through it, stores the info it finds in a SQLite db, and then pops the next url off the queue.
For my app, how many threads would be optimal?
1.2
0
0
2,509