473,549 Members | 2,222 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.
77
3,998
thread by: Hunn E. Balsiche | last post Jul 18 '05 by: Martin Maney
in term of its OO features, syntax consistencies, ease of use, and their development progress. I have not use python but heard about it quite often; and ruby, is it mature enough to be use for developing serious application, e.g web application as it has not many features in it yet. I've given up on Perl for its ugly syntax and it is not the...
77
2,546
thread by: Michael Chermside | last post Jul 18 '05 by: Donn Cave
Elaine Jackson writes: > All tuple methods are also list methods, and most list methods are also tuple > methods; among those that are NOT also tuple methods, there are exactly two > ('count' and 'index') that do not involve mutation. Is there any special reason > why they AREN'T also tuple methods? Yes. Both make sense only if you...
77
3,890
thread by: Ben Finney | last post Mar 3 '06 by: Christos Georgiou
Howdy all, PEP 354: Enumerations in Python has been accepted as a draft PEP. The current version can be viewed online: <URL:http://www.python.org/peps/pep-0354.html> Here is the reStructuredText source as it is today. Please discuss it here so I can see what issues people may have.
77
16,973
thread by: Ville Vainio | last post Apr 15 '06 by: Fredrik Lundh
I tried to clear a list today (which I do rather rarely, considering that just doing l = works most of the time) and was shocked, SHOCKED to notice that there is no clear() method. Dicts have it, sets have it, why do lists have to be second class citizens?
77
4,371
thread by: Nick Maclaren | last post Dec 22 '06 by: Hendrik van Rooyen
Why doesn't the tuple type have an index method? It seems such a bizarre restriction that there must be some reason for it. Yes, I know it's a fairly rare requirement. Regards, Nick Maclaren.
78
4,560
thread by: wkehowski | last post Mar 28 '06 by: funkyj
The python code below generates a cartesian product subject to any logical combination of wildcard exclusions. For example, suppose I want to generate a cartesian product S^n, n>=3, of that excludes '*a*b*' and '*c*d*a*'. See below for details. CHALLENGE: generate an equivalent in ruby, lisp, haskell, ocaml, or in a CAS like maple or...
78
4,899
thread by: Josiah Manson | last post Aug 10 '06 by: Gabriel Genellina
I found that I was repeating the same couple of lines over and over in a function and decided to split those lines into a nested function after copying one too many minor changes all over. The only problem is that my little helper function doesn't work! It claims that a variable doesn't exist. If I move the variable declaration, it finds the...
79
5,210
thread by: pinkfloydhomer | last post Nov 2 '05 by: David Rasmussen
I want to scan a file byte for byte for occurences of the the four byte pattern 0x00000100. I've tried with this: # start import sys numChars = 0 startCode = 0 count = 0
81
4,637
thread by: julio | last post Jul 18 '05 by: Alex Martelli
Sorry but there is no another way, c# .net and mono are going to rip python, not because python is a bad lenguage, but because is to darn old and it refuses to innovate things, to fix wrong things, just because retarded backwards compatibility and because the python comunity and developers refuses to consider tools as being almost as important...
81
3,554
thread by: BlueJ774 | last post Jun 5 '07 by: Steve Holden
Can someone please explain to me the difference between the "is" keyword and the == boolean operator. I can't figure it out on my own and I can't find any documentation on it. I can't understand why this works: if text is None: and why this always returns false:
81
2,746
thread by: Russ | last post Sep 2 '07 by: Aahz
I just stumbled onto PEP 316: Programming by Contract for Python (http://www.python.org/dev/peps/pep-0316/). This would be a great addition to Python, but I see that it was submitted way back in 2003, and its status is "deferred." I did a quick search on comp.lang.python, but I don't seem to see much on it. Does anyone know what the real...
82
3,336
thread by: Neuruss | last post Jul 18 '05 by: Neuruss
IronPython is currently at a pre-alpha stage suitable for experimentation but not for serious development work. http://www.ironpython.com
82
4,376
thread by: Edward Elliott | last post May 24 '06 by: H J van Rooyen
This is just anecdotal, but I still find it interesting. Take it for what it's worth. I'm interested in hearing others' perspectives, just please don't turn this into a pissing contest. I'm in the process of converting some old perl programs to python. These programs use some network code and do a lot of list/dict data processing. The...
83
3,384
thread by: kartik | last post Jul 18 '05 by: Andrew Dalke
there seems to be a serious problem with allowing numbers to grow in a nearly unbounded manner, as int/long unification does: it hides bugs. most of the time, i expect my numbers to be small. 2**31 is good enough for most uses of variables, and when more is needed, 2**63 should do most of the time. granted, unification allows code to work...
83
6,439
thread by: Alexander Zatvornitskiy | last post Jul 18 '05 by: Serge Orlov
Hello All! I'am novice in python, and I find one very bad thing (from my point of view) in language. There is no keyword or syntax to declare variable, like 'var' in Pascal, or special syntax in C. It can cause very ugly errors,like this: epsilon=0 S=0 while epsilon<10: S=S+epsilon
83
3,581
thread by: Licheng Fang | last post Aug 27 '06 by: andrei.zavidei
Hi, I'm learning STL and I wrote some simple code to compare the efficiency of python and STL. //C++ #include <iostream> #include <string> #include <vector> #include <set> #include <algorithm> using namespace std;
84
6,470
thread by: John Perks and Sarah Mount | last post Nov 30 '05 by: Paul Rubin
we have some Python code we're planning to GPL. However, bits of it were cut&pasted from some wxPython-licenced code to use as a starting point for implementation. It is possible that some fragments of this code remains unchanged at the end. How should we refer to this in terms of copyright statements and bundled Licence files? Is there,...
84
7,148
thread by: braver | last post Nov 28 '07 by: Bruno Desthuilliers
Is there any trick to get rid of having to type the annoying, character-eating "self." prefix everywhere in a class? Sometimes I avoid OO just not to deal with its verbosity. In fact, I try to use Ruby anywhere speed is not crucial especially for @ prefix is better- looking than self. But things grow -- is there any metaprogramming tricks...
85
4,239
thread by: Russ | last post Dec 10 '06 by: Roberto Bonvallet
Every Python programmer gets this message occasionally: IndexError: list index out of range The message tells you where the error occurred, but it doesn't tell you what the range and the offending index are. Why does it force you to determine that information for yourself when it could save you a step and just tell you? This seems like a...
86
4,029
thread by: Matthias Kaeppler | last post Dec 16 '05 by: Steve Horsley
Hi, sorry for my ignorance, but after reading the Python tutorial on python.org, I'm sort of, well surprised about the lack of OOP capabilities in python. Honestly, I don't even see the point at all of how OO actually works in Python. For one, is there any good reason why I should ever inherit from a class? ^^ There is no functionality...
86
2,682
thread by: PTY | last post Jul 25 '06 by: Gerhard Fiedler
Which is better? lst = while lst: lst.pop() OR while len(lst) 0:
89
5,040
thread by: Radioactive Man | last post Jul 18 '05 by: Richard Hanson
In python 2.3 (IDLE 1.0.3) running under windows 95, I get the following types of errors whenever I do simple arithmetic: 1st example: >>> 12.10 + 8.30 20.399999999999999 >>> 1.1 - 0.2 0.90000000000000013
90
3,927
thread by: Mark Hahn | last post Jul 18 '05 by: Mark Hahn
"Michael Geary" <Mike@Geary.com> wrote ... >Does anyone have some sample code where obj$func() would be used? > (Apologies if I missed it.) There have been so many messages about delegation and binding since Greg originally posted his meowing cat message that it's hard to remember what the original problem was that Greg pointed out. At...
90
4,333
thread by: Ben Finney | last post Dec 2 '05 by: Mike Meyer
Howdy all, How can a (user-defined) class ensure that its instances are immutable, like an int or a tuple, without inheriting from those types? What caveats should be observed in making immutable instances? -- \ "Love is the triumph of imagination over intelligence." -- |
90
10,729
thread by: Christoph Zwerschke | last post Nov 29 '05 by: Mike Meyer
Ok, the answer is easy: For historical reasons - built-in sets exist only since Python 2.4. Anyway, I was thinking about whether it would be possible and desirable to change the old behavior in future Python versions and let dict.keys() and dict.values() both return sets instead of lists. If d is a dict, code like: for x in d.keys():

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.