473,554 Members | 2,318 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python Forum

Python programming language - Ask questions about python interpreter, control flow, data structures, modules errors, classes, standard library, gui, databases, unit testing, object oriented, structured programming and more.
67
6,246
thread by: Philippe Martin | last post Aug 3 '06 by: bryanjugglercryptographer
Hi, I'm looking for an algo that would convert a list such as: I'm using python to prototype the algo: this will move to C in an embedded system where an int has 16 bits - I do not wish to use any python library. l1 = #represents the decimal number 12345678 l2 = func (l1) # l2 = #represents 0x12D687
67
2,253
thread by: Lawrence D'Oliveiro | last post Sep 29 '06 by: Duncan Booth
Why doesn't MySQLdb provide a function like this: def QuoteSQL(Str, DoWild) : """returns a MySQL string literal which evaluates to Str. Needed for those times when MySQLdb's automatic quoting isn't good enough.""" Result = for Ch in str(Str) : if Ch == "\0" : Ch = "\\0" elif Ch == "\010" :
67
4,741
thread by: James Harris | last post Jul 12 '07 by: Lew
I have a requirement to store timestamps in a database. Simple enough you might think but finding a suitably general format is not easy. The specifics are 1) subsecond resolution - milliseconds or, preferably, more detailed 2) not bounded by Unix timestamp 2038 limit 3) readable in Java 4) writable portably in Perl which seems to mean that...
67
2,186
thread by: notbob | last post Jun 27 '08 by: Diez B. Roggisch
I'm not posting this just to initiate some religious flame war, though it's the perfect subject to do so. No, I actaully want some serious advice about these two languages and since I think usenet is the best arena to find it, here ya' go. So, here's my delimna: I want to start a blog. Yeah, who doesn't. Yet, I want learn the guts of it...
68
4,300
thread by: Marco Bubke | last post Jul 18 '05 by: Stephen Horne
Hi I have read some mail on the dev mailing list about PEP 318 and find the new Syntax really ugly. def foo(x, y): pass I call this foo(1, 2), this isn't really intuitive to me! Also I don't like the brackets.
68
3,710
thread by: Grant Edwards | last post Jul 18 '05 by: Andrea Griffini
Let's say I use a GPL'd python module (e.g. something installed in site-packages) in an application. Let's also say I use py2exe to package and distribute said application. Is what I'm distributing a "derived work" of the GPL'd python? Or is py2exe's packaging of the module's .pyc file and my application code's .pyc files a "mere...
68
5,800
thread by: Lad | last post Jul 19 '05 by: Christos TZOTZIOY Georgiou
Is anyone capable of providing Python advantages over PHP if there are any? Cheers, L.
68
2,675
thread by: Santiago Romero | last post Feb 14 '08 by: Bjoern Schliessmann
( Surely if this question has been asked for a zillion of times... ) ( and sorry for my english! ) I'm impressed with python. I'm very happy with the language and I find Python+Pygame a very powerful and productive way of writing 2D games. I'm not, at this moment, worried about execution speed of the small game I'm working on (it runs at...
69
3,201
thread by: Edward K Ream | last post Mar 4 '07 by: Jay Tee
The pros and cons of making 'print' a function in Python 3.x are well discussed at: http://mail.python.org/pipermail/python-dev/2005-September/056154.html Alas, it appears that the effect of this pep would be to make it impossible to use the name 'print' in a backward compatible manner. Indeed, if a program is to compile in both Python...
70
4,041
thread by: Michael Hoffman | last post Aug 1 '05 by: qvx
Many of you are familiar with Jason Orendorff's path module <http://www.jorendorff.com/articles/python/path/>, which is frequently recommended here on c.l.p. I submitted an RFE to add it to the Python standard library, and Reinhold Birkenfeld started a discussion on it in python-dev...
70
3,992
thread by: py | last post Nov 23 '05 by: Roy Smith
I have function which takes an argument. My code needs that argument to be an iterable (something i can loop over)...so I dont care if its a list, tuple, etc. So I need a way to make sure that the argument is an iterable before using it. I know I could do... def foo(inputVal): if isinstance(inputVal, (list, tuple)): for val in inputVal:...
70
27,340
thread by: jojoba | last post Sep 9 '06 by: MonkeeSage
Hello! Does anyone know how to find the name of a python data type. Conside a dictionary: Banana = {} Then, how do i ask python for a string representing the name of the above dictionary (i.e. 'Banana')?
70
2,602
thread by: TheFlyingDutchman | last post Sep 21 '07 by: Ron Adam
Python user and advocate Bruce Eckel is disappointed with the additions (or lack of additions) in Python 3: http://www.artima.com/weblogs/viewpost.jsp?thread=214112
71
3,247
thread by: Jack | last post Dec 14 '07 by: Bruno Desthuilliers
I understand that the standard Python distribution is considered the C-Python. Howerver, the current C-Python is really a combination of C and Python implementation. There are about 2000 Python files included in the Windows version of Python distribution. I'm not sure how much of the C-Python is implemented in C but I think the more modules...
72
4,354
thread by: Raymond Hettinger | last post Jul 18 '05 by: Magnus Lie Hetland
Peter Norvig's creative thinking triggered renewed interest in PEP 289. That led to a number of contributors helping to re-work the pep details into a form that has been well received on the python-dev list: http://www.python.org/peps/pep-0289.html In brief, the PEP proposes a list comprehension style syntax for creating fast, memory...
72
5,500
thread by: Gregory Petrosyan | last post Jan 24 '06 by: Bengt Richter
Please visit http://www.python.org/peps/pep-0204.html first. As you can see, PEP 204 was rejected, mostly because of not-so-obvious syntax. But IMO the idea behind this pep is very nice. So, maybe there's a reason to adopt slightly modified Haskell's syntax? Something like --> (1,3..10) --> same values as above, but return...
73
4,560
thread by: Claudio Grondi | last post Jan 21 '06 by: Tim Peters
In the process of learning about some deeper details of Python I am curious if it is possible to write a 'prefix' code assigning to a and b something special, so, that Python gets trapped in an endless loop in a line with: if a==b: print 'OK' I mean, it would be of much help to me on my way to understanding Python to know how such prefix...
73
3,163
thread by: cesco | last post Mar 14 '07 by: Anton Vredegoor
I have to generate a list of N random numbers (integer) whose sum is equal to M. If, for example, I have to generate 5 random numbers whose sum is 50 a possible solution could be . Is there a simple pattern or function in Python to accomplish that? Thanks and regards Francesco
75
6,120
thread by: Howard Nease | last post Jul 18 '05 by: Christos TZOTZIOY Georgiou
Hello, everyone. I would appreciate any advice that someone could give me on my future career path. Here is my situation: I am a bright Junior in a very well-respected private high school, taking almost all AP and accelerated classes. I am HIGHLY interested in technology, more specifically the field of Computer Science and software...
75
3,831
thread by: David MacQuigg | last post Jul 18 '05 by: Cameron Laird
Seems like we need a simple way to extend Python syntax that doesn't break existing syntax or clash with any other syntax in Python, is easy to type, easy to read, and is clearly distinct from the "base" syntax. Seems like we could put the @ symbol to good use in these situations. Examples: print @(separator = None) x, y, z ...
75
3,403
thread by: projecktzero | last post Jul 18 '05 by: Christos TZOTZIOY Georgiou
I know this might not be the correct group to post this, but I thought I'd start here. A co-worker considers himself "old school" in that he hasn't seen the light of OOP.(It might be because he's in love with Perl...but that's another story.) He thinks that OOP has more overhead and is slower than programs written the procedural way. I...
75
4,605
thread by: Xah Lee | last post Jul 19 '05 by: John Bokma
http://python.org/doc/2.4.1/lib/module-re.html http://python.org/doc/2.4.1/lib/node114.html --------- QUOTE The module defines several functions, constants, and an exception. Some of the functions are simplified versions of the full featured methods for compiled regular expressions. Most non-trivial applications always use the compiled...
75
5,298
thread by: Greg McIntyre | last post Aug 26 '05 by: Antoon Pardon
I have a Python snippet: f = open("blah.txt", "r") while True: c = f.read(1) if c == '': break # EOF # ... work on c Is some way to make this code more compact and simple? It's a bit spaghetti.
76
3,705
thread by: Nick Coghlan | last post Jul 18 '05 by: Jeff Shannon
GvR has commented that he want to get rid of the lambda keyword for Python 3.0. Getting rid of lambda seems like a worthy goal, but I'd prefer to see it dropped in favour of a different syntax, rather than completely losing the ability to have anonymous functions. Anyway, I'm looking for feedback on a def-based syntax that came up in a...
77
5,212
thread by: Gerrit Holl | last post Jul 18 '05 by: Floyd Davidson
Hi, the <> inequality test operator has been deprecated for a loooooong time. Is there a reason that it doesn't trigger a DeprecationWarning? $ python2.2 -Wall -c "print 0 <> 0" 0 $ python2.3 -Wall -c "print 0 <> 0" False

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.