What is PyComicsViewer?
===
Is a comics viewer written in python, PyGTK and PIL. I made it as I
didn't fully like any of the existing viewers and I wanted something
that works the same (nice) way on both Linux and Windows.
Because of the way it was implemented, you can also
Title: ANNOUNCE: SiGeFi v0.3
We're proud to announce the 0.3 version of SiGeFi, which you can find
at:
http://sourceforge.net/projects/sigefi
What is SiGeFi?
---
SiGeFi is a Financial Management System, with focus in the needs of
the administration of the money in each
Hi,
this is to inform all of you about the release of eric3 3.6.2. It is a
bug fix release and will work with the latest QScintilla/sip/PyQt.
It is available via http://www.die-offenbachs.de/detlev/eric3.html
What is eric3?
--
Eric3 is a Python IDE written using PyQt and QScintilla.
snacktime wrote:
I need to convert a generator expression to a list expression so it
will work under python 2.3.
I rewrote this:
for c in range(128):
even_odd = (sum(bool(c 1b) for b in range(8))) 1
As this:
for c in range(128):
bo = [bool(c 1b) for b in range(8)]
Mike == Mike Meyer [EMAIL PROTECTED] writes:
Mike IPython's pysh seems a little clumsy for interactive use, as
Mike it requires special characters to distinguish between
Mike commands to be passed to the shell and commands to be passed
Mike to the scripting language. This should
Mike == Mike Meyer [EMAIL PROTECTED] writes:
Mike I've actually done some work on using CORBA as a COM for
Mike Unix (or, as I think of it, an ARexx for Unix). After being
Mike exposed to Plan 9, I've decided that's a better
Mike solution. CORBA has the advantage that you can
Yes, both string and lists have a __getitem__ attribute:
c1 = 'abc'
c2 = ['de', 'fgh', 'ijkl']
hasattr(c1, '__getitem__')
True
hasattr(c2, '__getitem__')
True
In other words you could index elements of either one using [].
Likewise, both a string and list would produce a usable iterator
Joe Francia wrote:
You'll also want to probably look at some of the templating kits, of which
Cheetah and/or
ElementTree work best for me. (Well, ElementTree isn't exactly a templating
kit - it's a
general-purpose XML tookit - but it is easily used for templating.)
if you want
Hi all,
I'm building a PyGTK interface in which I would like that no widget
would be able to get the focus (and so to be activated by pressing the
Return key). For this purpose, for each widget, I do:
widget.set_property(can-focus, gtk.FALSE)
My problem is a TreeView which has a clickable
Hi all,
I'm using PyGTK-2.0.0, when I detach a HandleBox, the resizing of the
newly created window is broken: it can be resized but it's content (the
HandleBox and its child) is not affected at all and is not resized.
Does any one have a solytion to this problem?
Thanks in advance!
Franck
--
Franck Pommereau wrote:
Hi all,
I'm using PyGTK-2.0.0, when I detach a HandleBox, the resizing of the
newly created window is broken: it can be resized but it's content (the
HandleBox and its child) is not affected at all and is not resized.
Does any one have a solytion to this problem?
I'm
Michal Migurski wrote:
The python-based zope application server has session management. Togther
with a built-in user and access rights management.
...
This can be done in zope if you name a variable name:list. That then
will
give you the variable as list regardless of the number of occurences.
Ilias Lazaridis wrote:
Bruno Desthuilliers wrote:
[...]
closing thread
http://groups-beta.google.com/group/comp.lang.python/msg/f2ae9cdbe16676d1
Nope. You are not entitled to close thread. This is irrelevant.
--
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in
Ilias Lazaridis wrote:
Should a professional developer take python serious?
A *professionnal developper*, yes. But this is irrelevant to you.
--
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
--
Hi,
I upgraded from 2.2.2 to 2.4 and all
is well except the output to the IDLE window is now twenty times slower than it
was before, making the window utterly unusable for verbose output. The statement
-- for i in range (100): print i -- now takes about forty-five seconds to complete! Used
Hi all
I don't understand globals between multiple modules in a python program. I
really don't. I've narrowed it down to the following two very simple
programs a.py and b.py. When I run a.py I get the following output:
inc: 2
A: 2
inc: 3
B: 3
C: 1
I don't understand the last line at all.
Michal Migurski wrote:
3) Structured request variables. PHP has a really handy feature where
request variables with name like foo[], foo[bar], or
foo[bar][baz] are automatically structured into nested associative
arrays. I can see that the python cgi module will make a list of
Bart wrote:
I don't understand globals between multiple modules in a python program. I
really don't. I've narrowed it down to the following two very simple
programs a.py and b.py. When I run a.py I get the following output:
inc: 2
A: 2
inc: 3
B: 3
C: 1
I don't understand the last
If you do manage to get mod_python working, I suggest taking a look
at
Vampire as well: http://www.dscpl.com.au/projects/vampire/
I have had good experience with it. Once you start using mod_python
you'll realize you can really go anywhere you want; and that's not
necessarily a good thing.
aurora [EMAIL PROTECTED] wrote:
if you don't know what a and b comes from, how can you be sure that
your program works at all? how can you be sure they're both strings?
a and b are both string.
how do you know that?
if you have unit tests, why don't they include Unicode tests?
How do I
Mike Meyer wrote:
Carl Banks [EMAIL PROTECTED] writes:
Say you have a suite of functions, all of which are called by some
main
function and each other, and all of which need to access a lot of
the
same data. The best, most straightforward way to do it is to have
the
common data be a
A colleague and I have built a Validator object for use with ConfigObj
and other general schema situations. A config file is used to store a
schema that specifies how to test a value that it is valid.
keyword=function(param1, param2)
e.g. you could specify :
size = range(30, 50)
This means that
jfj wrote:
The costly extra feature is this:
###
def foo():
def f():
print x
x=1
f()
x=2
f()
return f
foo()()
#
which prints '1 2 2'
The fractal code runs a little _slower_ because of this ability.
Although the
On Sun, 20 Feb 2005 20:56:52 -0800,
snacktime [EMAIL PROTECTED] wrote:
I need to convert a generator expression to a list expression so it
will work under python 2.3.
I rewrote this:
for c in range(128):
even_odd = (sum(bool(c 1b) for b in range(8))) 1
As this:
for c in range(128):
Op 2005-02-18, Steven Bethard schreef [EMAIL PROTECTED]:
Paddy McCarthy wrote:
x=lambda : A B
y=lambda : C+6 = 7
[snip]
Z=lambda : (AB) and (C+6=7)
See Inappropriate use of Lambda in
http://www.python.org/moin/DubiousPython
Perhaps your real example is different, but notice that
What I can't easily see is any way of passing named keyword arguments
to the function. Suppose we wanted to pass keyword=param to a function
- is there any way of doing this ... obviously passing in
'keyword=param' as text has entirely the wrong result..
Im not sure if I understand you
Sorry if this is a duplicate - I use the google interface and sometiems
it screws up (not showing stuff you've posted *or* not posting it).
Before you ask it's because at work I have no NNTP and *heavily*
restricted http.
A colleague and I have built a Validator object for use with ConfigObj
and
On 17 Feb 2005 04:48:19 -0800, Tonino [EMAIL PROTECTED] wrote:
thanks - am already involved in a process to modify winguiauto.py -
this is a GREAT start but we need more control and better handleing ;)
Can you be more specific?
Thanks for the WATSUP site - will check on this as well ;)
Op 2005-02-19, jfj schreef [EMAIL PROTECTED]:
Carl Banks wrote:
Ted Lilley wrote:
Unfortunately, it doesn't work. It seems the closure keeps track of
the variable fed to it dynamically - if the variable changes after
[...]
At least, that's the explanation I'm deducing from this behavior.
Sorry if this is a duplicate - I use the google interface and sometiems
it screws up (not showing stuff you've posted *or* not posting it).
Before you ask it's because at work I have no NNTP and *heavily*
restricted http.
It is - so I requote my answer :)
Im not sure if I understand you
Hans Nowak wrote:
[EMAIL PROTECTED] wrote:
Hi,
I'm new to python. Given a class, how can I get know what
attributes/functins in it without dig into the source?
Use the dir function:
from smtplib import SMTP
dir(SMTP)
['__doc__', '__init__', '__module__', 'close', 'connect', 'data',
Another method is to build two sets of sets, one for E1 and one for E2,
then make the intersection of these sets
- with Python 2.3
E1=[('a','g'),('r','s')]
E2=[('g','a'),('r','q'),('f','h')]
from sets import Set,ImmutableSet
f=Set([ImmutableSet(s) for s in E1]) Set([ImmutableSet(s) for s in
Antoon Pardon wrote:
Op 2005-02-19, jfj schreef [EMAIL PROTECTED]:
once foo() returns there is no way to modify 'x'!
It becomes a kind of constant.
In this particular case yes. But not in general, what about
this:
def F():
... l = []
... def pop():
... return l.pop()
... def push(e):
Michele Simionato wrote:
The problem is a problem of standardization, indeed. There plenty of
recipes to
do the same job, I just would like to use a blessed one (I am teaching
a Python
course and I do not know what to recommend to my students).
Why not teach your students to use a template system?
Op 2005-02-21, jfj schreef [EMAIL PROTECTED]:
Antoon Pardon wrote:
Op 2005-02-19, jfj schreef [EMAIL PROTECTED]:
once foo() returns there is no way to modify 'x'!
It becomes a kind of constant.
In this particular case yes. But not in general, what about
this:
def F():
... l = []
But I'll get back at what seems you actually wanted to say:
That there is no way to rebind 'x' or in my case 'l' and
with that I have to agree although I personnaly find that
a lack in python
It's not only that way in python, but in java too. So it seems that there is
a fundamental principle
Antoon Pardon wrote:
But I'll get back at what seems you actually wanted to say:
That there is no way to rebind 'x' or in my case 'l' and
with that I have to agree although I personnaly find that
a lack in python
'no way' is a bit strong. You can use hacks such as the one I posted a
couple
Does anyone know of a widget or sample code for viewing huge (ie bigger than
RAM) images in python? The usual way of doing this is to read part of the
image into memory as a set of tiles and then zoom and pan the tiles.
The sort of thing I'm trying to achive is at
On 21 Feb 2005 06:48:19 -0500, rumours say that Dan Sommers [EMAIL PROTECTED]
might have written:
[snip: snacktime posts code to count bits]
Seems to work, is there a better way to do this?
[Dan]
for c in range( 128 ):
even_odd = 0
print '%3d' % c,
while c:
c = c - 1
Fredrik Lundh wrote:
Greg Chapman wrote:
Your callback function needs to hold the Python GIL (and have a
vaild threadstate) before it calls any Python C-API functions.
Change the last part of it to:
PyGILState_STATE state;
/* ... */
/* Time to call the callback */
I have just installed BLT: I effectively had some problems - the same you had.
I found this:
Python GUI Setup
Here is the procedure I used to get Fourier working on Windows and Linux.
I wanted to use BLT for xy-plotting, partly because we used it with tcl in the
sss project, and partly because
Op 2005-02-21, Diez B. Roggisch schreef [EMAIL PROTECTED]:
But I'll get back at what seems you actually wanted to say:
That there is no way to rebind 'x' or in my case 'l' and
with that I have to agree although I personnaly find that
a lack in python
It's not only that way in python, but in
Hello All,
I am trying to clean up some polish bugs with the Shanghai game I am
working on and I am currently stuck on trying to get the right event
for detecting when the user has changed the desktop resolution.
I have tried trapping the following events:
1) SDL_ACTIVEEVENT
2) SDL_VIDEOEXPOSE
Diez B. Roggisch [EMAIL PROTECTED] writes:
It's not only that way in python, but in java too. So it seems that there is
a fundamental principle behind it: In a language that allows sideeffects,
these will actually happen.
Can you even have nested functions in Java? Algol-60 did things the
way
On Mon, 2005-02-21 at 07:36 -0500, Kent Johnson wrote:
Michele Simionato wrote:
The problem is a problem of standardization, indeed. There plenty of
recipes to
do the same job, I just would like to use a blessed one (I am teaching
a Python
course and I do not know what to recommend to
Hi
On redhat you can use a libuser module that provides some highlevel
system tasks.
redhat-tools use this module all the time.. look at some sources
Gustavo
morphex wrote:
Hi there,
does anyone here know of a script that enables adding of users on UNIX
platforms via python?
Thanks,
Morten
--
Paul Rubin wrote:
Diez B. Roggisch [EMAIL PROTECTED] writes:
It's not only that way in python, but in java too. So it seems that there
is a fundamental principle behind it: In a language that allows
sideeffects, these will actually happen.
Can you even have nested functions in Java?
On 2005-02-21, Mike Meyer [EMAIL PROTECTED] wrote:
you just need to know what techniques to use to create a
'friendly', 'relaxing', energy pattern.
I find that playing back Python code over multi-stranded copper
produces the best results.
Only if you color the edges with a green
On 2005-02-20, Nick Vargish [EMAIL PROTECTED] wrote:
BrainDead [EMAIL PROTECTED] writes:
I believe that you are wasting your time. Looking at your email
address, this may well be relevant.
[ 4-line URL snipped ]
Thanks for the historical reference. Please consider a visit to
tinyurl.com
On Sun, 20 Feb 2005 14:57:14 +, rumours say that Michael Hoffman
[EMAIL PROTECTED] might have written:
[snip: use 'open' in preference to 'file']
To be honest I doubt open will be extended in this manner. I can see
the Pythoneers adding, say, a keyword argument to open to allow a URL
Nick Vargish wrote:
Ilias Lazaridis [EMAIL PROTECTED] writes:
Now it's really time to close this thread.
I suspect this will fall of deaf ears, but I have to mention that you
do not get to close threads on Usenet.
this is obvious.
You can excuse yourself from this one and stop replying to
Carl Banks wrote:
transformations gets rebound, so you'd need a reference to it.
That certainly is an application. I guess it depends on one's
programming background.
I'd only use nested (function, class) definition to accomplish
such a feature:
def genclass(x,y):
I've never understood the problem with long URLs. Many
newsreaders let you click on them. If not, you just cut/paste
it into a browser (with a shellscript a couple lines long, you
can start firefox with the URL on the X clipboard with a single
command).
Some break the urls - so copy and
gargonx [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Even if i put it in exactly the way you did:
import re
charmatcher = re.compile(r' [A-Z] [\d]?')
ext = dict(D=V1, O=M1, G=S1)
std = dict(S=H)
decode_replacements ={}
decode_replacements.update([(std[key], key) for
Christos TZOTZIOY Georgiou wrote:
On 21 Feb 2005 06:48:19 -0500, rumours say that Dan Sommers [EMAIL PROTECTED]
might have written:
[snip: snacktime posts code to count bits]
Seems to work, is there a better way to do this?
[Dan]
for c in range( 128 ):
even_odd = 0
print '%3d' % c,
while
kim kubik wrote:
This sure seems like it would have been
brought up but I checked Google Groups
(the dejanews replacement) and saw
nothing: I installed Python2.4 in Win98
and IDLE doesn't work (neither does the
online manual even tho a 3.6KB Python24.chm
is there, but that's a story for
I have a class with a read-only attribute, and I want to add a unit
test to ensure that it really *is* read-only. I can do this as
def test_readonly(self):
Value and multiplier must be readonly
try:
self.combat.value = 1
self.fail(Value is not read
In article [EMAIL PROTECTED], Paul Moore [EMAIL PROTECTED]
wrote:
I have a class with a read-only attribute, and I want to add a unit
test to ensure that it really *is* read-only. I can do this as
def test_readonly(self):
Value and multiplier must be readonly
try:
Hi !
On windows, and PyWin, this script give the H/V current resolution :
import win32com.client
oWMI = win32com.client.Dispatch(WbemScripting.SWbemLocator)
owbem = oWMI.ConnectServer(.,root\cimv2)
collec = owbem.ExecQuery(Select * from Win32_PrinterConfiguration)
print
Roy Smith wrote:
You want something like
self.assertRaises(AttributeError, lambda: self.combat.value = 1)
Or, combining the two responses and avoiding the lambda:
self.assertRaises(AttributeError, setattr, self.combat, 'value', 1)
Hmm... this might be a case where the lambda form is actually the
Peter Hansen [EMAIL PROTECTED] writes:
You want something like
self.assertRaises(AttributeError, lambda: self.combat.value = 1)
Or, combining the two responses and avoiding the lambda:
self.assertRaises(AttributeError, setattr, self.combat, 'value', 1)
Hmm... this might be a case
Ilias Lazaridis [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
Nick Vargish wrote:
You can excuse yourself from this one and stop replying to comments,
but you don't get to unilaterally declare a discussion over.
[...]
The discussion is over.
At least the in-topic one.
Kent Johnson:
I've written web pages this way (using a pretty nice Java HTML
generation package) and I don't
recommend it. In my experience, this approach has several drawbacks:
- as soon as the web page gets at all complex, the conceptual shift
from HTML to code and back is
difficult.
- It is
Peter Hansen [EMAIL PROTECTED] writes:
Roy Smith wrote:
You want something like
self.assertRaises(AttributeError, lambda: self.combat.value = 1)
Or, combining the two responses and avoiding the lambda:
self.assertRaises(AttributeError, setattr, self.combat, 'value', 1)
Hmm... this might
John Machin wrote:
Reinhold Birkenfeld wrote:
Reinhold Birkenfeld wrote:
My solution (which may not be the fastest or most effective, but
till
now is the shortest wink and it works):
[snip RB]
A recursive solution (around twice as fast as the above, though very
slow still...)
[snip
Paul Rubin wrote:
Peter Hansen [EMAIL PROTECTED] writes:
You want something like
self.assertRaises(AttributeError, lambda: self.combat.value = 1)
Or, combining the two responses and avoiding the lambda:
self.assertRaises(AttributeError, setattr, self.combat, 'value', 1)
Hmm...
Duncan Booth wrote:
An assignment expression, if such a thing existed wouldn't help here.
Although of course it would help if still inside a lambda.
--
http://mail.python.org/mailman/listinfo/python-list
Duncan Booth wrote:
The difference between the original reset the rightmost '1' bit, and your
interpretation: reset the rightmost bit is the '1'.
The rightmost bit that is set is reset. So 0x10 - 0, and 0x1010 - 0x1000.
If you want to extract the least significant set bit from a number 'x' you
Duncan Booth [EMAIL PROTECTED] writes:
An assignment expression, if such a thing existed wouldn't help here.
The point being that the expression must be evaluated inside the exception
handler in assertRaises, so you either need to delay the evaluation with a
lambda, or by passing the
Paul Rubin http://[EMAIL PROTECTED] wrote:
The example I quoted used an assignment expression inside a
lambda. The person who posted it,
That was me.
and the person who followed it up
with the setattr alternative, both didn't notice that the assignment
expression wasn't valid Python.
Michele Simionato wrote:
The problem is a problem of standardization, indeed.
There are plenty of recipes to do the same job, I just
would like to use a blessed one (I am teaching a Python
course and I do not know what to recommend to my students).
Wouldn't we *all* like all of our problems
Kent Johnson wrote:
Michele Simionato wrote:
The problem is a problem of standardization, indeed. There plenty
of
recipes to
do the same job, I just would like to use a blessed one (I am
teaching
a Python
course and I do not know what to recommend to my students).
Why not teach your
Title: ANNOUNCE: SiGeFi v0.3
We're proud to announce the 0.3 version of SiGeFi, which you can find
at:
http://sourceforge.net/projects/sigefi
What is SiGeFi?
---
SiGeFi is a Financial Management System, with focus in the needs of
the administration of the money in each
Steven Bethard wrote:
Right. str and unicode objects support iteration through the old
__getitem__ protocol, not the __iter__ protocol. If you want to use
something as an iterable, just use it and catch the exception:
try:
itr = iter(a)
except TypeError:
# 'a' is not iterable
else:
Antoon Pardon wrote:
def F():
... l = []
... def pop():
... return l.pop()
... def push(e):
... l.append(e)
... return pop, push
...
Just a side note to point out that another way of writing this is:
py def F():
... l = []
... return l.pop, l.append
...
You'll get the same
Testing for the '__iter__' (or even '__getitem__') attribute doesn't
really address the problem, nor does trying to execute the statement
'itr = iter(a)'.
To use EAPF and answer the OP's original question, which was
So how can I test if a variable 'a' is either a single character
string or a
Fredrik Lundh [EMAIL PROTECTED] writes on Sat, 19 Feb 2005 18:44:27 +0100:
aurora [EMAIL PROTECTED] wrote:
I don't want to mix them. But how could I find them? How do I know this
statement can be
potential problem
if a==b:
where a and b can be instantiated individually far
Nick Coghlan wrote:
anton muhin wrote:
anton muhin wrote:
Correction:
Of course, I can imagine some metaclasses magic that would allow to
code:
class MyClass(WithOverloading):
@overloadMethod(A)
def someMetod(self, _): ...
But it would rather convoluted: the best idea I have so far is to
You can find some screenshot in the Stam's original paper.
I didn't do any serious benchmark. I compared the speed
of C version with the Python one. It seems enough good.
I advice you to download from Stam's site paper and C code,
compile the C code and verify yourself the results.
I think the
Martin Miller broke the order of reading again by top-posting:
However, to handle the more general problem of allow *any* argument to
be either a single item or a list seems to require a combination of
both EAPF and LBYL. This is the best solution I've been able to come up
with so far:
def
hello,
my script selects a comment saved as VARCHAR in MySQL and displays it
inside an html page.
the problem is, that the comment contains several special characters, as
mysterious utf-8 hyphens, german umlauts, etc.
i could write a function to parse the comment and substitute special
chars
Grant Edwards [EMAIL PROTECTED] writes:
I've never understood the problem with long URLs. Many
newsreaders let you click on them. If not, you just cut/paste
it into a browser (with a shellscript a couple lines long, you
can start firefox with the URL on the X clipboard with a single
Phil Thompson napisa(a):
Riverbank Computing is pleased to announce the release of PyQt v3.14 available
from http://www.riverbankcomputing.co.uk/.
Classes generated by puyic 3.13 are not compatible with PyQt 3.14 (some
method signature incompatibilities). I cann't provide more details, as I
Steven Bethard [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I don't like this idea much because it depends on str and unicode _not_
having a particular function. I haven't seen any guarantee anywhere that
str or unicode won't ever grow an __iter__ method. So this code seems
Just for the hell of it, I've been going through the old Scheme-based
textbook Structure and Interpretation of Computer Programs and seeing
what I can and can't do with python. I'm trying to create a function
that returns the function (not the results of the function, but a
function object) that
On Sun, 20 Feb 2005, Steven Bethard wrote:
Erik Max Francis wrote:
Roman Suzi wrote:
I think that if any object (from standard library at least) doesn't support
iteration, it should clearly state so.
My guess is that 'for' causes the use of 'm[0]', which is (rightfully) an
error...
Can this
John Machin wrote:
Steve M wrote:
Hello,
I'm trying to figure out the index position of a tuple
member.
I know the member name, but I need to know the members index
position.
Tuples, like lists, don't have members in the sense that they can be
named like t.foo. The only way
markscottwright [EMAIL PROTECTED] writes:
But when I try to do it iteratively, it just hangs when I try to
evaluate the results (for count 1):
def repeated2(f, count):
newfun = f
for i in range(count-1):
newfun = lambda x: newfun(f(x))
return newfun
For the life of
markscottwright wrote:
Just for the hell of it, I've been going through the old Scheme-based
textbook Structure and Interpretation of Computer Programs and seeing
what I can and can't do with python. I'm trying to create a function
that returns the function (not the results of the function, but a
On Mon, Feb 21, 2005 at 01:14:00PM -0800, Paul Rubin wrote:
markscottwright [EMAIL PROTECTED] writes:
But when I try to do it iteratively, it just hangs when I try to
evaluate the results (for count 1):
def repeated2(f, count):
newfun = f
for i in range(count-1):
I actually find it strange that tuples don't have an index function,
since finding the index doesn't involve any mutation. Anyone know why
Python doesn't allow a statement like t.index('foo')?
In any case, you can use the index method of list objects if you
convert your tuple to a list first:
Steve M wrote:
I guess I explained my problem incorrectly. Let me try again.
tuple = (fred, barney, foo)
I know that foo is an element of tuple, but what I need to know is what
the index of foo is, tuple[?].
Larry Bates's solution is probably the best way to go here:
py t = (fred, barney, foo)
py
Michael Hartl wrote:
I actually find it strange that tuples don't have an index function,
since finding the index doesn't involve any mutation. Anyone know why
Python doesn't allow a statement like t.index('foo')?
Tuples aren't really intended for this kind of use. See:
I was interested in playing around with Decimal and
subclassing it. For example, if I wanted a special
class to permit floats to be automatically converted
to strings.
from decimal import Decimal
class MyDecimal(Decimal):
def __init__(self, value):
if
Steven Bethard wrote:
Steve M wrote:
I guess I explained my problem incorrectly. Let me try again.
tuple = (fred, barney, foo)
I know that foo is an element of tuple, but what I need to know is what
the index of foo is, tuple[?].
Larry Bates's solution is probably the best way to go
Michael Hartl wrote:
I actually find it strange that tuples don't have an index function,
since finding the index doesn't involve any mutation. Anyone know why
Python doesn't allow a statement like t.index('foo')?
In any case, you can use the index method of list objects if you
convert
Christos TZOTZIOY Georgiou [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
On 21 Feb 2005 06:48:19 -0500, rumours say that Dan Sommers
[EMAIL PROTECTED]
for c in range( 128 ):
even_odd = 0
print '%3d' % c,
while c:
c = c - 1
even_odd = not even_odd
Steve M wrote:
I'm actually doing this as part of an exercise from a book. What the
program
is supposed to do is be a word guessing game. The program automaticly
randomly selects a word from a tuple.
Care to tell us which book is using a tuple for this, but hasn't got to
lists yet?
Cheers,
Steve M wrote:
I'm actually doing this as part of an exercise from a book. What the program
is supposed to do is be a word guessing game. The program automaticly
randomly selects a word from a tuple. You then have the oportunity to ask
for a hint. I created another tuple of hints, where the order
Hi,
I need a function returning a time value with a higher resolution that the
standard 1sec unix timestamp. I found the clock() function in the time
module, but that seems to return the same value (in the Python shell) each
time I call it (Debian Linux speaking here).
Any ideas?
Thanks,
Uwe
1 - 100 of 147 matches
Mail list logo