473,554 Members | 2,815 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.
33
25,625
thread by: Steven Bethard | last post Jul 18 '05 by: Steven Bethard
Is there a good way to determine if an object is a numeric type? Generally, I avoid type-checks in favor of try/except blocks, but I'm not sure what to do in this case: def f(i): ... if x < i: ... The problem is, no error will be thrown if 'i' is, say, a string:
33
1,980
thread by: Maurice LING | last post Jul 19 '05 by: Mike Meyer
Hi, I've been using Python for about 2 years now, for my honours project and now my postgrad project. I must say that I am loving it more and more now. From my knowledge, Python bytecodes are not back-compatible. I must say that my technical background isn't strong enough but is there any good reason for not being back-compatible in...
33
1,948
thread by: Will McGugan | last post Jul 19 '05 by: Magnus Lycka
Hi, I'd like to write a windows app that accesses a locally stored database. There are a number of tables, the largest of which has 455,905 records. Can anyone recommend a database that runs on Windows, is fast / efficient and can be shipped without restrictions or extra downloads? I have googled and found plenty of information on...
33
3,924
thread by: n00m | last post Sep 9 '05 by: Bryan Olson
import socket, thread host, port = '192.168.0.3', 1434 s1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s2 = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s2.connect((host, 1433)) s1.bind((host, port)) s1.listen(1) cn, addr = s1.accept() def VB_SCRIPT():
33
5,578
thread by: Joerg Schuster | last post Oct 27 '05 by: Tim Peters
Hello, Python regular expressions must not have more than 100 capturing groups. The source code responsible for this reads as follows: # XXX: <fl> get rid of this limitation! if p.pattern.groups > 100: raise AssertionError( "sorry, but this version only supports 100 named groups"
33
2,263
thread by: Gregory Petrosyan | last post Feb 23 '06 by: bearophileHUGS
Buenos dias, amigos! I have to write _simple_ gui library, for embedding into game. My first attempt was to use XML: isn't it cute to describe ui in such a way: <window> <title>Hello World!</title> <image text="nice picture here" pos=... src=... /> <text opts=...> (some text here)
33
2,410
thread by: Nick Maclaren | last post Jun 15 '06 by: Grant Edwards
The numerical robustness of Python is very poor - this is not its fault, but that of IEEE 754 and (even more) C99. In particular, erroneous numerical operations often create apparently valid numbers, and the NaN state can be lost without an exception being raised. For example, try int(float("nan")). Don't even ASK about complex, unless...
33
1,487
thread by: SpreadTooThin | last post Oct 13 '06 by: Bruno Desthuilliers
Can these operators be overloaded? If so. How?
33
2,110
thread by: NicolasG | last post Aug 2 '07 by: Alex Popescu
Hi, I want to be a professional python programmer, unfortunately I'm working on technical support and don't have the time/patience to start making projects my self. I tried to apply to some Python positions but unfortunately sometimes to work as a programmer is really hard in this world, every employee requires professional experience and...
33
2,529
thread by: Stef Mientki | last post Aug 6 '07 by: Bruno Desthuilliers
hello, I discovered that boolean evaluation in Python is done "fast" (as soon as the condition is ok, the rest of the expression is ignored). Is this standard behavior or is there a compiler switch to turn it on/off ? thanks, Stef Mientki
33
3,681
thread by: llothar | last post Sep 20 '07 by: Bruno Desthuilliers
I'm afraid that the GIL is killing the usefullness of python for some types of applications now where 4,8 oder 64 threads on a chip are here or comming soon. What is the status about that for the future of python? I know that at the moment allmost nobody in the scripting world has solved this problem, but it bites and it bites hard. Only...
33
56,406
thread by: christophertidy | last post Sep 5 '07 by: Bruno Desthuilliers
Hi I am new to Python and have recieved this error message when trying to instantiate an object from a class from another file within the same directory and wondered what I have done wrong. I have a Step.py class: class Step(object) def __init__(self, sName): "Initialise a new Step instance"
33
2,784
thread by: cesco | last post Jan 12 '08 by: Paddy
Hi, say I have a string like the following: s1 = 'hi_cat_bye_dog' and I want to replace the even '_' with ':' and the odd '_' with ',' so that I get a new string like the following: s2 = 'hi:cat,bye:dog' Is there a common recipe to accomplish that? I can't come up with any solution...
33
1,438
thread by: Aaron Watters | last post Jun 27 '08 by: Hrvoje Niksic
Why is the migration to py3k a concern? For example I have libraries which use string%dictionary substitution where the dictionary is actually an object which emulates a dictionary. The __getitem__ for the object can be very expensive and is only called when needed by the string substitution. In py3k string%dictionary is going away. Why?...
33
1,692
thread by: John Salerno | last post Jun 27 '08 by: Mensanator
Is it possible to write a list comprehension for this so as to produce a list of two-item tuples? base_scores = range(8, 19) score_costs = print zip(base_scores, score_costs) I can't think of how the structure of the list comprehension would work in this case, because it seems to require iteration over two separate sequences to produce...
33
2,040
thread by: bearophileHUGS | last post Sep 9 '08 by: glen stark
I have just re-read the list of changes in Python 2.6, it's huge, there are tons of changes and improvements, I'm really impressed: http://docs.python.org/dev/whatsnew/2.6.html I'll need many days to learn all those changes! I can see it fixes several of the missing things/problems I have found in Python in the past, like the lack of...
33
1,222
thread by: castironpi | last post Sep 13 '08 by: Paul Boddie
I am concerned by the lack of follow-through on some responses to recent ideas I have described. Do I merely have a wrong understanding of group policy? Is it a good policy (defined with respect to the future of Python and the welfare of humans at large) if so? Is there a serious lack of diligence, or should I merely take more initiative,...
34
5,091
thread by: Brandon J. Van Every | last post Jul 18 '05 by: Robin Munn
What do you think of this Python logo? http://pythonology.org/logos Good, bad, indifferent, love it, hate it? -- Cheers, www.indiegamedesign.com Brandon Van Every Seattle, WA Brandon's Law (after Godwin's Law): "As a Usenet discussion grows longer, the probability of
34
2,440
thread by: Jacek Generowicz | last post Jul 18 '05 by: Jacek Generowicz
I have a program in which I make very good use of a memoizer: def memoize(callable): cache = {} def proxy(*args): try: return cache except KeyError: return cache.setdefault(args, callable(*args)) return proxy which, is functionally equivalent to
34
3,610
thread by: Erik Johnson | last post Jul 18 '05 by: Giles Brown
This is somewhat a NEWBIE question... My company maintains a small RDBS driven website. We currently generate HTML using PHP. I've hacked a bit in Python, and generally think it is a rather cool language. I've done Perl and like it, there are a few features of PHP I like but overall am not too excited about it. I have found PHP's...
34
2,651
thread by: nobody | last post Jul 18 '05 by: Stephen Horne
This article is posted at the request of C.W. Yang who asked me to detail my opinion of Lisp, and for the benefit of people like him, who may find themselves intrigued by this language. The opinions expressed herein are my personal ones, coming from several years of experience with Lisp. I did plenty of AI programming back in the day, ...
34
2,158
thread by: Peter MacKenzie | last post Jul 18 '05 by: Peter MacKenzie
Hello, I'm Peter, and I'm very much a newbie. New in the sense of being a novice at everything to do with programming, rather than just new to Python, so please be very explicit in your replies (should you deem me worth of such attention). I've long had a passing interest in programming from a macro-conceptual level, but only very recently...
34
4,721
thread by: SeeBelow | last post Jul 18 '05 by: Cameron Laird
I see the value of a class when two or more instances will be created, but Python programmers regularly use a class when there will only be one instance. What is the benefit of this? It has a disadvantage of a whole lot of "self." being required everywhere, making the code less readable. Also, since a strength of Python is rapid...
34
3,262
thread by: jblazi | last post Jul 18 '05 by: Alex Martelli
Let us assume I have a list like and would like to transoform it into the string '{1,2},{7,8},{12,13}' Which is the simplest way of achiebing this? (The list is in fact much longer and I may have to cut the resulting strings into chunks of 100 or
34
4,890
thread by: Fred | last post Jul 18 '05 by: simo
Hi, I'm currently checking out Python as an alternative to VB.Net to moving from VB, but can't find a GUI designer that is as good as VB. I tried wxDesigner and wxGlade, but neither lets me move the widgets around. I also tried Dialogblocks, but it seems to only handle C++ or XRC, not Python.

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.