FAQ

Search Discussions

266 discussions - 1,892 posts

  • This is a follow-up discussion on my earlier PEP-suggestion. Ive integrated the insights collected during the previous discussion, and tried to regroup my arguments for a second round of feedback. ...
    EelcoEelco
    Dec 17, 2011 at 2:38 pm
    Jan 3, 2012 at 11:21 am
  • Throwing an idea for a PEP out there: It strikes me that the def func(*args, **kwargs) syntax is rather unpytonic. It certainly did not have that 'for line in file' pythonic obviousness for me as a ...
    Eelco HoogendoornEelco Hoogendoorn
    Dec 11, 2011 at 10:49 am
    Dec 17, 2011 at 8:02 pm
  • Do you use IDLE when teaching Python? If not, what is the tool of choice? Students may not be experienced with the command-line and may be running Windows, Linux, or Macs. Ideally, the tool or IDE ...
    Raymond HettingerRaymond Hettinger
    Dec 20, 2011 at 3:51 am
    Jan 4, 2012 at 1:30 am
  • Is it true that if I want to create an array or arbitrary size such as: for a in range(n): x.append(<some function... ) I must do this instead? x=[] for a in range(n): x.append(<some function... ) ...
    EricEric
    Dec 21, 2011 at 10:25 pm
    Dec 25, 2011 at 1:16 pm
  • Elementwise provides a proxy object for iterables which supports chained method calls, as well as elementwise expressions and some built-in functions. Example: class ...
    Nathan RiceNathan Rice
    Dec 20, 2011 at 7:45 pm
    Dec 22, 2011 at 9:22 pm
  • Hello everyone, I just have a quick question about .format and %r %s %d. Should we always be using .format() for formatting strings or %? Example a = 'apples' print "I love {0}.".format(a) If I ...
    DavidfxDavidfx
    Dec 31, 2011 at 6:19 pm
    Jan 5, 2012 at 1:41 am
  • I've got a code pattern I use a lot. In each module, I create a logger for the entire module and log to it all over: logger = logging.getLogger('my.module.name') class Foo: def function(self): ...
    Roy SmithRoy Smith
    Dec 10, 2011 at 8:47 pm
    Dec 15, 2011 at 8:42 pm
  • I just spent a while beating my head against this one. # Python 2.6 Traceback (most recent call last): File "<stdin ", line 1, in <module ValueError: too many values to unpack The real problem is ...
    Roy SmithRoy Smith
    Dec 8, 2011 at 2:23 pm
    Dec 10, 2011 at 11:41 pm
  • I use the @ decorator to behave exactly like a c macro that does have fewer side effects. I am wondering is there other interesting methods to do the jobs in Python? A lot people complained that no ...
    88888 Dihedral88888 Dihedral
    Dec 8, 2011 at 7:18 am
    Dec 13, 2011 at 12:46 am
  • I'm trying to restore Python 2.5.2 on an old XP PC for a particular application from 4-5 years ago that uses it . According to the latest manual on it, the following should be installed. ...
    W. eWatsonW. eWatson
    Dec 27, 2011 at 4:03 pm
    Dec 29, 2011 at 7:31 pm
  • I'm using Python 3.2.2, and the following program gives me an error that I don't understand: class Foo: pass foo = Foo() foo.name = "Steve" def add_goodbye_function(obj): def goodbye(): ...
    Steve HowellSteve Howell
    Dec 14, 2011 at 5:42 am
    Dec 18, 2011 at 2:09 am
  • Hi everyone, in my script I have a dictionary whose items are couples in the form (string, integer values), say D = {'a':1, 'b':2, 'c':3} This dictionary is passed to a function as a parameter, e.g. ...
    MassiMassi
    Dec 7, 2011 at 5:09 pm
    Dec 13, 2011 at 2:21 pm
  • Hello when i try to visit my webpage i get the error it displays. Iam not posting it since you can see it by visiting my webpage at http://superhost.gr Please if you can tell me what might be wrong.
    Νικόλαος ΚούραςΝικόλαος Κούρας
    Dec 22, 2011 at 2:40 pm
    Jan 10, 2012 at 7:29 am
  • Hi, I run into a weird problem. I have a piece of code that looks like the following: f(...., a=None, c=None): assert (a==None)==(c==None) The problem is that == is not implemented sometimes for ...
    GZGZ
    Dec 25, 2011 at 7:09 am
    Dec 26, 2011 at 5:14 pm
  • I'm in the process of learning Python. I already can code objet-oriented programs with the language. I have in my hands the O'Reilly book by Mark Lutz, Programming Python, in two versions: the 2nd ...
    Antti J YlikoskiAntti J Ylikoski
    Dec 3, 2011 at 3:54 am
    Dec 10, 2011 at 11:49 am
  • Hello folks, In a recent thread i stumbled upon an epiphany of sorts concerning Python string literals, with implications that trickle down to all forms of string literals used in general ...
    Rick JohnsonRick Johnson
    Dec 28, 2011 at 3:49 am
    Dec 29, 2011 at 11:24 pm
  • I want to create a string of 20 random digits (I'm OK with leading zeros). The best I came up with is: ''.join(str(random.randint(0, 9)) for i in range(20)) Is there something better?
    Roy SmithRoy Smith
    Dec 25, 2011 at 1:30 pm
    Dec 26, 2011 at 4:26 am
  • Hi All, What's the general consensus on supporting Python 2.5 nowadays? Do people still have to use this in commercial environments or is everyone on 2.6+ nowadays? I'm finally getting some ...
    Chris WithersChris Withers
    Dec 21, 2011 at 7:15 am
    Dec 22, 2011 at 6:24 pm
  • I want to test for equality between two lists. For example, if I have two lists that are equal in content but not in order, I want a return of 'equal' -- dont care if they are not in the same order. ...
    NoydbNoydb
    Dec 15, 2011 at 4:36 pm
    Dec 16, 2011 at 7:32 am
  • i don't like python, and i prefer emacs lisp. The primary reason is that python is not functional, especially with python 3. The python community is full of fanatics with their drivels. In that ...
    Xah LeeXah Lee
    Dec 6, 2011 at 4:36 am
    Dec 8, 2011 at 8:23 pm
  • I need to try a bunch of names in sequence until I find one that works (definition of "works" is unimportant). The algorithm is: 1) Given a base name, "foo", first see if just plain "foo" works. 2) ...
    Roy SmithRoy Smith
    Dec 1, 2011 at 3:15 am
    Dec 6, 2011 at 7:19 pm
  • I'm writing a geometry package, with Points and Lines and Circles and so on, and eventually I want to be able to draw these things on the screen. I have two options so far for how to accomplish this, ...
    Spencer PearsonSpencer Pearson
    Dec 22, 2011 at 8:21 am
    Jan 5, 2012 at 7:56 am
  • Would anybody care to recommend online C++ resources for a long time C and Python user? (I'm also familiar with Smalltalk, Scheme, FORTRAN, bash, Javascript, and a variety of assembly languages.) I ...
    Grant EdwardsGrant Edwards
    Dec 20, 2011 at 5:40 pm
    Dec 22, 2011 at 1:19 pm
  • Hi, I'm just starting to learn Python, so please bear with me. I have in my program an object (recs) which is a list of tuples (returned as such by a database query). My question is doubtless a very ...
    HoneyMonsterHoneyMonster
    Dec 18, 2011 at 7:41 pm
    Dec 20, 2011 at 3:53 am
  • According to the documentation on re.sub(), it replaces the leftmost matching pattern. However, I want to replace the *longest* matching pattern, which is not necessarily the leftmost match. Any ...
    John GordonJohn Gordon
    Dec 16, 2011 at 4:49 pm
    Dec 20, 2011 at 2:58 am
  • I use xml.dom.minidom for XML canonization and convertion: doc = xml.dom.minidom.parse( io.BytesIO( data0 ) ) encoding = forceEncoding or doc.encoding or str( 'UTF-8' ) writer = io.BytesIO() writer = ...
    Serhiy StorchakaSerhiy Storchaka
    Dec 13, 2011 at 12:17 pm
    Dec 14, 2011 at 9:38 am
  • Consider the following django snippet. Song(id) raises DoesNotExist if the id is unknown. try: songs = [Song(id) for id in song_ids] except Song.DoesNotExist: print "unknown song id (%d)" % id Is id ...
    Roy SmithRoy Smith
    Dec 5, 2011 at 5:04 pm
    Dec 6, 2011 at 10:38 am
  • After a little searching, I've not been able to come up with what I'd consider canonical examples of consider calling an external editor/pager on a file and reading the results back in. (most of my ...
    Tim ChaseTim Chase
    Dec 23, 2011 at 4:16 am
    Dec 24, 2011 at 2:41 am
  • I realize this has been discussed in the past, I hope that I am presenting a slightly different take on the subject that will prove interesting. This is primarily motivated by my annoyance with using ...
    Nathan RiceNathan Rice
    Dec 16, 2011 at 5:48 pm
    Dec 19, 2011 at 3:56 pm
  • (Warning: this question obviously reflects the fact that I am more accustomed to using Java than Python.) Suppose I'm creating a class that represents a bearing or azimuth, created either from a ...
    Adam FunkAdam Funk
    Dec 30, 2011 at 8:40 pm
    Dec 31, 2011 at 8:59 pm
  • I'm confused about the following. The idea here is that the set of instances of some class are small and finite, so I'd like to create them at class creation time, then hijack __new__ to simply ...
    K. Richard PixleyK. Richard Pixley
    Dec 27, 2011 at 4:28 am
    Dec 27, 2011 at 10:43 pm
  • Hey guys, I have a C++ function that I'd like to replicate (as closely as possible) in Python. Here's an example: 107 void increment_counter( unsigned int& counter ) 108 { 109 ...
    Brad TilleyBrad Tilley
    Dec 16, 2011 at 1:21 pm
    Dec 19, 2011 at 11:56 pm
  • Hello, Can someone help me with the following: I am using metaclasses to make classes and these classes to make instances. Now I want to use multiprocessing, which needs to pickle these instances. ...
    Lars van gemerdenLars van gemerden
    Dec 29, 2011 at 9:55 am
    Jan 3, 2012 at 6:04 pm
  • Hi there, I am about to learn python with "how to think like a computer scientist". This book is just available for python 2.4. Does it matter for programming? Greetz
    KimmaKimma
    Dec 20, 2011 at 6:31 pm
    Dec 21, 2011 at 5:42 pm
  • I'm trying to calculate the difference in seconds between two timestamps, but I'm totally stuck: date1="Dec-13-09:47:12" date2="Dec-13-09:47:39" Traceback (most recent call last): File "<stdin ", ...
    NukeymusicNukeymusic
    Dec 17, 2011 at 10:19 am
    Dec 18, 2011 at 3:22 pm
  • I have a function which reads characters from stdin and writes stars to stdout, but backspacing does not erase the stars as I expected. Tested in Python 2.6 on Linux. This will almost certainly not ...
    Steven D'ApranoSteven D'Aprano
    Dec 5, 2011 at 4:09 pm
    Dec 6, 2011 at 3:24 pm
  • Hi, Sorry if this is a FAQ, but I have googled and didn't find any satisfatory answer. Is there a simple way, preferably multiplataform (or linux), of generating sinusoidal/square waves sound in ...
    Paulo da SilvaPaulo da Silva
    Dec 30, 2011 at 7:17 am
    Jan 2, 2012 at 6:09 pm
  • This doesn't cause a crash, but rather incorrect results. self.wordList = ["The", "quick", "brown", "fox", "carefully", "jumps", "over", "the", "lazy", "dog", "as", "it", "stealthily", "wends", ...
    Charles HixsonCharles Hixson
    Dec 26, 2011 at 10:23 pm
    Dec 28, 2011 at 5:54 pm
  • I've got a list, ['a', 'b', 'c', 'd']. I want to generate the string, "a, b, c, and d" (I'll settle for no comma after 'c'). Is there some standard way to do this, handling all the special cases? [] ...
    Roy SmithRoy Smith
    Dec 15, 2011 at 4:48 pm
    Dec 16, 2011 at 5:26 am
  • Hi, folks, Back in 2002, I got back into programming after a nine-year hiatus. I needed a new programming language, was guided to Python 2.2, and was off to the races. I chose the SciTE program ...
    John LadaskyJohn Ladasky
    Dec 6, 2011 at 7:13 pm
    Dec 9, 2011 at 9:10 am
  • In IPython: 16 This doesn't make sense to me. Can anyone explain?
    Glen RiceGlen Rice
    Dec 4, 2011 at 2:25 pm
    Dec 6, 2011 at 8:55 am
  • Hi! I'm working on a script utilizing os.makedirs to make directories to which I'm then trying to write files created by exe's spawned w/ subprocess.call; I'm developing in Stani's Python Editor, ...
    OlyDLGOlyDLG
    Dec 31, 2011 at 10:13 pm
    Jan 3, 2012 at 3:17 pm
  • I'm upgrading from python 2.5 to python 2.7 and then I'm starting to get this error: InvalidResponseError: headers must be str I think it is because somewhere my HTTP headers are cast to unicode ...
    Niklas RosencrantzNiklas Rosencrantz
    Dec 31, 2011 at 4:58 am
    Jan 2, 2012 at 6:18 pm
  • Given a module's name, how do I get the file path without importing it? Searched all over, can't find any such info. Is it possible to ask if a named module exists before attempting an import? Or are ...
    GnarlodiousGnarlodious
    Dec 23, 2011 at 4:01 pm
    Dec 23, 2011 at 10:39 pm
  • Hi; If I write a python page to print to the web with Spanish accents all is well. However, if I read the data from a text file it prints diamonds with question marks wherever there are accented ...
    Stan IversonStan Iverson
    Dec 22, 2011 at 2:55 pm
    Dec 22, 2011 at 11:14 pm
  • I'm using this decorator to implement singleton class in python: http://stackoverflow.com/posts/7346105/revisions The strategy described above works if and only if the Singleton is declared and ...
    Saqib AliSaqib Ali
    Dec 22, 2011 at 8:53 pm
    Dec 22, 2011 at 10:33 pm
  • Hello Everyone, I'm looking for a tool, which can add a trusted timestamp to an existing PDF file (and can sign - but currently only have to add TS). Could anybody help? Thanks: a.
    Hegedüs, ErvinHegedüs, Ervin
    Dec 7, 2011 at 7:41 pm
    Dec 8, 2011 at 11:02 am
  • In the multiprocessing module, on a Process p, by just doing p.daemon=1 before p.start(), we can make the child die when the parent exits. However, the child does not die if the parent gets killed. ...
    Mihai BadoiuMihai Badoiu
    Dec 2, 2011 at 3:05 pm
    Dec 7, 2011 at 7:53 pm
  • Hi I am trying to change "@HWI-ST115:568:B08LLABXX:1:1105:6465:151103 1:N: 0:" to "@HWI-ST115:568:B08LLABXX:1:1105:6465:151103/1". Can anyone help me with the regular expressions needed? Thanks in ...
    MauricelingMauriceling
    Dec 26, 2011 at 11:45 pm
    Dec 28, 2011 at 7:05 am
  • Hi! I'm trying to create a struct_time that is e.g. one year ahead or a month back in order to test some parsing/formatting code with different dates. Now, the straightforward approach is t = ...
    Ulrich EckhardtUlrich Eckhardt
    Dec 16, 2011 at 9:45 am
    Dec 24, 2011 at 7:13 am
Group Navigation
period‹ prev | Dec 2011 | next ›
Group Overview
grouppython-list @
categoriespython
discussions266
posts1,892
users342
websitepython.org

342 users for December 2011

Chris Angelico: 150 posts Steven D'Aprano: 134 posts Eelco Hoogendoorn: 83 posts Ian Kelly: 80 posts Roy Smith: 62 posts Terry Reedy: 53 posts 88888 Dihedral: 43 posts Lie Ryan: 43 posts Alex23: 41 posts Rick Johnson: 41 posts Ethan Furman: 29 posts Joshua Landau: 27 posts Andrea Crotti: 25 posts Andrew Berg: 25 posts Arnaud Delobelle: 25 posts Nathan Rice: 25 posts Peter Otten: 25 posts MRAB: 23 posts Robert Kern: 22 posts W. eWatson: 22 posts
show more
Archives