¡@

Home 

python Programming Glossary: able

How do you send a HEAD HTTP request in Python?

http://stackoverflow.com/questions/107405/how-do-you-send-a-head-http-request-in-python

a given URL so I can determine the mime type. I want to be able to see if http somedomain foo will return an html document or..

py2exe - generate single executable file

http://stackoverflow.com/questions/112698/py2exe-generate-single-executable-file

generate single executable file I thought I heard that py2exe was able to do this but.. single executable file I thought I heard that py2exe was able to do this but I never figured it out. Has anyone successfully.. used Basically I'm thinking of it giving me a single executable file that does something like unzips itself to maybe temp and..

Is Python any good for GUI development? [closed]

http://stackoverflow.com/questions/115495/is-python-any-good-for-gui-development

wxWidgets C and finally moved onto wxPython. I find I'm able to get working GUIs in no time at all with wxPython compared..

Having Django serve downloadable files

http://stackoverflow.com/questions/1156246/having-django-serve-downloadable-files

Django serve downloadable files I want users on the site to be able to download files.. serve downloadable files I want users on the site to be able to download files whose paths are obscured so they cannot be.. f somefile.txt And on the server I know that all downloadable files reside in a folder home user files . Is there a way to..

Difference between __str__ and __repr__ in Python

http://stackoverflow.com/questions/1436703/difference-between-str-and-repr-in-python

goal is to be unambiguous __str__ goal is to be readable Container ™s __str__ uses contained objects __repr__ Default.. you implement should have a functional __repr__ that ™s usable for understanding the object. Implementing __str__ is optional.. or you ™re defeating the goal of repr. You want to be able to differentiate MyClass 3 and MyClass 3 . The goal of __str__..

How to install MySQLdb (Python data access library to MySQL) on Mac OS X?

http://stackoverflow.com/questions/1448429/how-to-install-mysqldb-python-data-access-library-to-mysql-on-mac-os-x

installed it instructions on this fiddly task are available on SO here then download and install the 32 bit version package.. usr lib libmysqlclient.18.dylib You should then be able to import MySQLdb without any errors. One final hiccup though..

How can I use a DLL from Python

http://stackoverflow.com/questions/252417/how-can-i-use-a-dll-from-python

you can actually call the DLL function. # Set up the variables and call the Python name with them. p1 ctypes.c_int 1 p2 ctypes.c_char_p.. do that the HLL API returns values by modifying a variable passed by reference . In terms of the specific example shown.. here . This makes for a single simple ctypes function able to do anything the EHLLAPI library provides but it's likely..

What are “named tuples” in Python?

http://stackoverflow.com/questions/2970608/what-are-named-tuples-in-python

of named tuples Is there any kind of named list a mutable version of the named tuple python tuples namedtuple share.. tuple instances can be referenced using object like variable deferencing or the standard tuple syntax. They can be used similarly.. or other common record types except that they are immutable. They were added in Python 2.6 and Python 3.0 although there..

Dynamic module import in Python

http://stackoverflow.com/questions/301134/dynamic-module-import-in-python

I want the application to be extensible that is to be able to add new modules that implement new commands without having.. foo.py bar.py So I want the application to find the available command modules at runtime and execute the appropriate one...

What kinds of patterns could I enforce on the code to make it easier to translate to another programming language?

http://stackoverflow.com/questions/3455456/what-kinds-of-patterns-could-i-enforce-on-the-code-to-make-it-easier-to-translat

PHP should be easier to start with but ideally I would be able to add other languages with relative ease. The plan is This.. which is a start. From then on I can build the AST symbol tables and control flow. Then I believe I can start outputting code... DMS provides generic parsing AST building symbol tables control and data flow analysis application of translation rules..

Weighted random selection with and without replacement

http://stackoverflow.com/questions/352670/weighted-random-selection-with-and-without-replacement

power of 2 greater than or equal to the number of variables and create this number of partitions p . Each partition represents.. mass of 1 p . In this case we create 8 partitions each able to contain 0.125. Take the variable with the least remaining.. 8 partitions each able to contain 0.125. Take the variable with the least remaining weight and place as much of it's mass..

Non-blocking read on a subprocess.PIPE in python

http://stackoverflow.com/questions/375427/non-blocking-read-on-a-subprocess-pipe-in-python

and connect to it's output stream stdout . I want to be able to execute non blocking reads on its stdout. Is there a way.. stream before I invoke .readline I'd like this to be portable or at least work under Windows and Linux. here is how I do it.. fcntl select asyncproc won't help in this case. Reliable way to read a stream without blocking on both Windows and Linux..

How to improve performance of this code?

http://stackoverflow.com/questions/4295799/how-to-improve-performance-of-this-code

of this code Thanks to some help from people here I was able to get my code for Tasmanian camels puzzle working. However.. more efficient than for lists. However lists aren't hashable items so you will have to change your configurations into tuples..

How do I unload (reload) a Python module?

http://stackoverflow.com/questions/437589/how-do-i-unload-reload-a-python-module

I have a long running Python server and would like to be able to upgrade a service without restarting the server. What's the..

How to install pip on windows?

http://stackoverflow.com/questions/4750806/how-to-install-pip-on-windows

C Python27 Scripts to your path Start Edit environment variables . Now you should be able to run pip from the command line... path Start Edit environment variables . Now you should be able to run pip from the command line. Try installing a package pip.. be behind a HTTP proxy. If so set the environment variables http_proxy and https_proxy . Most Python applications and other..

Dynamically adding a form to a Django formset with Ajax

http://stackoverflow.com/questions/501719/dynamically-adding-a-form-to-a-django-formset-with-ajax

a form to a Django formset with Ajax I'd like to be able to automatically add new forms to a Django formset with an ajax.. for form in serviceFormset.forms div class 'table' table class 'no_error' form.as_table table div endfor input.. for form in serviceFormset.forms div class 'table' table class 'no_error' form.as_table table div endfor input type button..

Syntax error on print with Python 3

http://stackoverflow.com/questions/826948/syntax-error-on-print-with-python-3

why print is giving a syntax here. Hoping someone might be able to point me in the right direction. Thanks Python 3.0.1 r301..

How do I access the child classes of an object in django without knowing the name of the child class?

http://stackoverflow.com/questions/929029/how-do-i-access-the-child-classes-of-an-object-in-django-without-knowing-the-nam

inheritance hierarchies there's a better technique available which doesn't require the added real_type field on the parent.. the added real_type field on the parent model. It's available as InheritanceManager in the django model utils project. The.. you may have to do quite a number of queries on child tables to find the instance depending how large your inheritance tree..

Why is reading lines from stdin much slower in C++ than Python?

http://stackoverflow.com/questions/9371238/why-is-reading-lines-from-stdin-much-slower-in-c-than-python

too pertinent. Edit 2 Removed this edit as no longer applicable for i in 1..5 do echo Test run i at `date` echo n CPP cat test_lines.. hit from std string getline is typical and reasonable. Edit 4 was Final Edit Solution Adding cin.sync_with_stdio false.. Pro using the original code the original with the sync disabled and the original python respectively on a file with 20M lines..