¡@

Home 

python Programming Glossary: note

The meaning of a single- and a double-underscore before an object name in Python

http://stackoverflow.com/questions/1301346/the-meaning-of-a-single-and-a-double-underscore-before-an-object-name-in-python

mucking with instance variables by code outside the class. Note that the mangling rules are designed mostly to avoid accidents..

Difference between __str__ and __repr__ in Python

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

if objects reference each other . So Python cops out. Note that there is one default which is true if __repr__ is defined.. œthis is everything you need to know about this instance Note I used r above not s . You always want to use repr or r formatting..

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

experience of the issue... apply a bit of that SO magic. Note Comments in next paragraph applied to Snow Leopard but not to..

Python - How do I pass a string into subprocess.Popen (using the stdin argument)?

http://stackoverflow.com/questions/163542/python-how-do-i-pass-a-string-into-subprocess-popen-using-the-stdin-argument

improve this question Popen.communicate documentation Note that if you want to send data to the process ™s stdin you need..

How do I watch a file for changes using Python?

http://stackoverflow.com/questions/182197/how-do-i-watch-a-file-for-changes-using-python

probably be the only really platform independent option. Note I haven't tried any of these solutions. share improve this..

Lexical closures in Python

http://stackoverflow.com/questions/233673/lexical-closures-in-python

x return x i flist.append func for f in flist print f 2 Note that this example mindfully avoids lambda . It prints 4 4 4..

Dynamic module import in Python

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

way to accomplish what we are doing with this code. Note that I specifically don't want to get in to using eggs or extension.. how to do it. You can use exec if you want to as well. Note you can import a list of modules by doing this moduleNames 'sys'..

Suggestions for a Cron like scheduler in Python?

http://stackoverflow.com/questions/373335/suggestions-for-a-cron-like-scheduler-in-python

t if self.matchtime t self.action self.args self.kwargs Note Not thoroughly tested Then your CronTab can be specified in..

Flattening a shallow list in Python

http://stackoverflow.com/questions/406121/flattening-a-shallow-list-in-python

x list x mi.image_set.all for mi in list_of_menuitems Note I need that list x call there because x is a Django QuerySet..

What is the most “pythonic” way to iterate over a list in chunks?

http://stackoverflow.com/questions/434287/what-is-the-most-pythonic-way-to-iterate-over-a-list-in-chunks

example terse. grouper 'ABCDEFG' 3 'x' 'ABC' 'DEF' 'Gxx' Note izip_longest is new to Python 2.6 share improve this answer..

Generator Expressions vs. List Comprehension

http://stackoverflow.com/questions/47789/generator-expressions-vs-list-comprehension

Simple Prime Generator in Python

http://stackoverflow.com/questions/567222/simple-prime-generator-in-python

Understanding Python super() and init methods

http://stackoverflow.com/questions/576169/understanding-python-super-and-init-methods

the standard docs on super if you haven't already. Edit Note that the syntax changed in Python 3.0 you can just say super..

Python: Sort a dictionary by value

http://stackoverflow.com/questions/613183/python-sort-a-dictionary-by-value

sort on the keys but how can I sort based on the values Note I have read this post and probably could change my code to have..

How to import a module given the full path?

http://stackoverflow.com/questions/67631/how-to-import-a-module-given-the-full-path

path How can I load a Python module given its full path Note that the file can be anywhere in the filesystem as it is a configuration..

Django dynamic model fields

http://stackoverflow.com/questions/7933596/django-dynamic-model-fields

models.CharField max_length 1024 class Meta abstract True Note how CustomDataField has a ForeignKey to Site each Site will..

Converting datetime.date to UTC timestamp in Python

http://stackoverflow.com/questions/8777753/converting-datetime-date-to-utc-timestamp-in-python

timestamp dt.replace tzinfo timezone.utc .timestamp Note It is necessary to supply timezone.utc explicitly otherwise..

list comprehension without [ ], Python

http://stackoverflow.com/questions/9060653/list-comprehension-without-python

is that the former don't create the list in memory. Note that there's a third way to write the expression ''.join map..

Command Line Arguments In Python

http://stackoverflow.com/questions/1009860/command-line-arguments-in-python

Default values. Generation of a usage help message. Please note that optparse was deprecated in version 2.7 of Python http docs.python.org..

Source interface with Python and urllib2

http://stackoverflow.com/questions/1150332/source-interface-with-python-and-urllib2

edit alternative so I don't need to expand much on that note however that it doesn't exactly reproduce socket.create_connection..

Showing the stack trace from a running Python application

http://stackoverflow.com/questions/132058/showing-the-stack-trace-from-a-running-python-application

variables. Use control d EOF to continue running though note that you will probably interrupt any I O etc at the point you..

Image comparison algorithm

http://stackoverflow.com/questions/1819124/image-comparison-algorithm

16482.883608327804 15873.465425120798 So note that im1 compared with itself gives a score of 42105 im2 compared..

Why is numpy's einsum faster than numpy's built in functions?

http://stackoverflow.com/questions/18365073/why-is-numpys-einsum-faster-than-numpys-built-in-functions

without mkl was also used to verify the timings. Please note the timings scale nearly linearly with system size and are not..

How do I execute a program from python? os.system fails due to spaces in path

http://stackoverflow.com/questions/204017/how-do-i-execute-a-program-from-python-os-system-fails-due-to-spaces-in-path

just exits but I need to wait for it to complete. Also note moving the program to a non spaced path is not an option either... single double quotes. with or without a parameter to notepad here it fails with the error message The filename directory..

How are Python's Built In Dictionaries Implemented

http://stackoverflow.com/questions/327311/how-are-pythons-built-in-dictionaries-implemented

PyDictMINSIZE 1 but that's not really important . Just note that the initial slot i that is checked depends on the hash..

Python UnicodeDecodeError - Am I misunderstanding encode?

http://stackoverflow.com/questions/368805/python-unicodedecodeerror-am-i-misunderstanding-encode

and I think you wanted the string add œMonitoring to list note the second quote you actually are using a string already encoded.. I'm sleepy but I sure hope I help. PS A humorous side note Mayans didn't have Unicode ancient Romans ancient Greeks ancient..

Suggestions for a Cron like scheduler in Python?

http://stackoverflow.com/questions/373335/suggestions-for-a-cron-like-scheduler-in-python

t time.sleep t datetime.now .seconds A few things to note Python's weekdays months are zero indexed unlike cron and that..

Editing specific line in text file in python

http://stackoverflow.com/questions/4719438/editing-specific-line-in-text-file-in-python

data print Your name data 0 # now change the 2nd line note that you have to add a newline data 1 'Mage n' # and write everything..

How to print in Python without newline or space?

http://stackoverflow.com/questions/493386/how-to-print-in-python-without-newline-or-space

# this will still print a space but not a newline Please note that in Python 3 the print statement has been changed into a..

What is the best way to remove accents in a python unicode string?

http://stackoverflow.com/questions/517923/what-is-the-best-way-to-remove-accents-in-a-python-unicode-string

standard library And what about in python 3.0 Important note I would like to avoid code with an explicit mapping from accented..

Python in Xcode 4 or Xcode 5

http://stackoverflow.com/questions/5276967/python-in-xcode-4-or-xcode-5

it will take more effort than it actually does. Please note that these instructions are for creating a project from scratch...

Is it Pythonic to use list comprehensions for just side effects?

http://stackoverflow.com/questions/5753597/is-it-pythonic-to-use-list-comprehensions-for-just-side-effects

fun_with_side_effects x for x in y if ...conditions... note that I don't save the list anywhere Or should I call this func..

Creating a singleton in python

http://stackoverflow.com/questions/6760685/creating-a-singleton-in-python

they are singletons . Method #1 fails this test as you noted with MyClass itself is a a function not a class so you cannot.. but because it is very easy for them to go bad. As a side note Java enumeration are just these kind of singletons. As long..

How do I convert local time to UTC in Python?

http://stackoverflow.com/questions/79797/how-do-i-convert-local-time-to-utc-in-python

. Also from http lucumr.pocoo.org 2011 7 15 eppur si muove note that in general this isn't possible as with DST and other issues..

Changing user agent on urllib2.urlopen

http://stackoverflow.com/questions/802134/changing-user-agent-on-urllib2-urlopen

a dictionary when creating the Request itself as the docs note headers should be a dictionary and will be treated as if add_header..

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

in 1 seconds. LPS 5570000 Thanks in advance Edit I should note that I tried this both under OS X 10.6.8 and Linux 2.6.32 RHEL.. I actually need to store the read lines in memory . Also note that a small tradeoff with using a char buffer and fgets vs..

How can I create a Word document using Python?

http://stackoverflow.com/questions/1035183/how-can-i-create-a-word-document-using-python

a proprietary solution that may help resolve this issue NOTE All possible solutions must run on Linux. I believe this eliminates..

What is an efficent way of inserting thousands of records into an SQLite table using Django?

http://stackoverflow.com/questions/1136106/what-is-an-efficent-way-of-inserting-thousands-of-records-into-an-sqlite-table-u

of your model objects and then commit them all at once. NOTE the save method will not be called when using bulk create. Entry.objects.bulk_create..

Python subprocess readlines() hangs

http://stackoverflow.com/questions/12419198/python-subprocess-readlines-hangs

is to stream a ruby file and print out the output. NOTE I don't want to print out everything at once main.py from subprocess.. just use a pipe popen all other answers so far ignore your NOTE I don't want to print out everything at once . pty is Linux..

how to filter duplicate requests based on url in scrapy

http://stackoverflow.com/questions/12553117/how-to-filter-duplicate-requests-based-on-url-in-scrapy

visited http www.abc.com p xyz.html id 1234 refer 4567 NOTE refer is a parameter that doesn't affect the response I get..

Project Euler 17

http://stackoverflow.com/questions/12647254/project-euler-17

were written out in words how many letters would be used NOTE Do not count spaces or hyphens. For example 342 three hundred..

Python string comparison pointing to the result

http://stackoverflow.com/questions/12840451/python-string-comparison-pointing-to-the-result

or IronPython could be a lot slower than with CPython. NOTE With very big strings this method wont scale well since it takes..

Using property() on classmethods

http://stackoverflow.com/questions/128573/using-property-on-classmethods

class that defines __get__ __set__ and __delete__ methods. NOTE The below method doesn't actually work for setters only getters...

Python subprocess.Popen “OSError: [Errno 12] Cannot allocate memory”

http://stackoverflow.com/questions/1367373/python-subprocess-popen-oserror-errno-12-cannot-allocate-memory

effectively controlling your script's memory footprint NOTE that the coding effort may be all for naught if it turns out..

Does Python have a stack/heap and how is memory managed?

http://stackoverflow.com/questions/14546178/does-python-have-a-stack-heap-and-how-is-memory-managed

it when there are no more references refering to it. NOTE Please keep in mind that this information is CPython specific...

Building lxml for Python 2.7 on Windows

http://stackoverflow.com/questions/3047542/building-lxml-for-python-2-7-on-windows

setup.py bdist_wininst static Building lxml version 2.2.6. NOTE Trying to build without Cython pre generated 'src lxml lxml.etree.c'..

How are Python's Built In Dictionaries Implemented

http://stackoverflow.com/questions/327311/how-are-pythons-built-in-dictionaries-implemented

This avoids slowing down lookups. see dictobject.h 64 65 NOTE I did the research on Python Dict implementation in response..

How does Django Know the Order to Render Form Fields?

http://stackoverflow.com/questions/350799/how-does-django-know-the-order-to-render-form-fields

django forms contacts share improve this question NOTE this answer is now somewhat outdated please see the discussion..

How to convert a python utc datetime to a local datetime using only python standard library?

http://stackoverflow.com/questions/4563272/how-to-convert-a-python-utc-datetime-to-a-local-datetime-using-only-python-stand

'Europe Moscow' # use your local timezone name here # NOTE pytz.reference.LocalTimezone would produce wrong result here..

How to install PIL on Mac OSX 10.5.8 for Google App Engine?

http://stackoverflow.com/questions/4868185/how-to-install-pil-on-mac-osx-10-5-8-for-google-app-engine

2.5 to install. I have Python 2.5.x on this machine. NOTE Added a bounty. I am in real need of a way to test the image..

Load module from string in python

http://stackoverflow.com/questions/5362771/load-module-from-string-in-python

I wrap a StringIO in a file without writing to disk UPDATE NOTE This issue is also a problem in python3. The code I'm trying..

How can I use C++ class in Python?

http://stackoverflow.com/questions/602580/how-can-i-use-c-class-in-python

T1.setInt 32 T1.getInt 32 Please suggest.How can I do this NOTE I would like to know manual way to do that. I don't want any..

Python dictionary from an object's fields

http://stackoverflow.com/questions/61517/python-dictionary-from-an-objects-fields

baz 'world' ... f Foo props f 'bar' 'hello' 'baz' 'world' NOTE It should not include methods. Only fields. Thanks python dictionary..

Python scipy needs BLAS?

http://stackoverflow.com/questions/7496547/python-scipy-needs-blas

www.netlib.org blas blas.tgz tar xzf blas.tgz cd BLAS ## NOTE The selected fortran compiler must be consistent for BLAS LAPACK..

Best way to remove duplicate characters from a string?

http://stackoverflow.com/questions/9841303/best-way-to-remove-duplicate-characters-from-a-string

a string foo 'mppmt' How can I make the string foo 'mpt' NOTE Order is not important python share improve this question..