self.theiter = i
> ... def next(self):
> ... return [self.theiter.next()]
> ...
> >>> i2 = iter(stuff)
> >>> x = LW(i2)
> >>> x.next()
> ['a']
> >>> x.next()
> ['b']
> >>> x.next()
>
alf wrote:
> Simon Forman wrote:
>
> >>>>>class LW(object): # ListWrapper
> >>... def __init__(self, i):
> >>... self.theiter = i
> >>... def next(self):
> >>... return [self.theiter.next()]
>
>
> I
alf wrote:
> Simon Forman wrote:
> >>
> >>>|>> I = ([n] for n in i)
> >>
> >>This is nice but I am iterating thru hude objects (like MBs) so you know ...
> >>
> >
> > No, I don't know... :-)
>
> potentially my sourc
cat -p 54321 -l
hellohi there
how are you
I'm fine thanks
[EMAIL PROTECTED]:~ $
# on the client side:
[EMAIL PROTECTED]:~ $ python delme.py
'hi there\n'
'how are you\n'
"I'm fine thanks\n"
[EMAIL PROTECTED]:~ $
So I'm guessing it's something wrong in your java server.
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
statements, etc.., in your
posted code, it's hard to understand exactly what your problem is.
> How can you
> do 2 or more replaces in one line of code?
In any event, there is a neat method of "single-pass multiple string
substitution using a dictionary" here:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81330 It uses
a regular expression, so I'd guess it wouldn't be to hard to get it to
work in multiline mode.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
t's an easy solution?
>
> Anton
Why are you trying to do this? Usually you would just say obj =
pickle.load(f) and be done with it (you could manipulate obj after it's
created, of course.) Why do you want to do obj = Obj() but have the
obj come from "obj.dat"?
Just curious.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Simon Forman wrote:
> f pemberton wrote:
> > Marc 'BlackJack' Rintsch wrote:
> > > In <[EMAIL PROTECTED]>, f pemberton
> > > wrote:
> > >
> > > > I've tried using replace but its not working for me.
> > &
AndrewTK wrote:
> Simon Forman wrote:
> > So I'm guessing it's something wrong in your java server.
>
> Thanks then. I'll keep testing then... Although I don't seem to have
> netcat on my unit...
>
> I'm using a uni computer so I can't install
s problem ?
On this page http://www.amk.ca/python/howto/unicode , there is a brief
section near the bottom on "Unicode filenames". If your problem is
related to Unicode, this may help you, but I'm not sure.
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
t have had this problem
before me" kind of situations. Google on "python combination" and you
should be well rewarded. :-)
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
stoopid_way(1, 5):
print s
# ..or print one big string, joined by newlines.
print '\n'.join(stoopid_way(1, 5))
I originally meant this as a joke and was going to say not to use it.
But on my old, slow computer it only takes about a second or two. If
that's fast enough for you then it won't do any harm to use it. (Just
don't mention my name ;-) )
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
rce the module to be reloaded use the reload
function: "reload(cabel)"
os.system() docs: http://docs.python.org/lib/os-process.html#l2h-1692
(But see the subprocess module too:
http://docs.python.org/lib/module-subprocess.html)
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
ks
>
> Keith
Ah, yes. The docstring for a function (or at least its first
triple-quote) must be indented to the same degree as its statements.
(If you're using IDLE it should have indented it for you when you hit
return after the def statement.)
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
7;s bash script echos your package names
to the /path/to/manual_install.log file (">>" in bash means "append the
output of the command to the left to the file on the right",) then it
calls aptitude with those same package names.
It's simple, short, and to-the-point. The equivalent python script
would be much longer, for no appreciable gain. I write most of my tiny
little helper scripts in python, but in this case, bash is the clear
winnar. (And on *nix. man pages are your best friend. Plus you get to
feel all l33t when you grok them. lol)
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
John Salerno wrote:
> Simon Forman wrote:
>
> > It's simple, short, and to-the-point. The equivalent python script
> > would be much longer, for no appreciable gain. I write most of my tiny
> > little helper scripts in python, but in this case, bash is the clear
&
but it's easy enough:
new_list = [0 for notused in xrange(100)]
or if you already have a list:
my_list.extend(0 for notused in xrange(100))
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
roups.google.ca/group/comp.lang.python/browse_frm/thread/b4e08adec2d835f5/af340f17faec4055
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
l objects that play a very restricted role in python,
rather like the Ellipsis.
Workarounds are possible, I think, but really you almost certainly
don't need to do this.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
; my obj class and actually modeling my slice concept by a slice object,
> specially since i'm going to 3D and 4D grid, and its somewhat annoying
> to carry so many indices in my class definition.
>
> Simon Forman wrote:
> > Alexandre Guimond wrote:
> > > Hi all,
&g
Duncan Booth wrote:
> Simon Forman wrote:
>
> > Why would you want to [deep]copy a slice object?
>
> I would guess the original poster actually wanted to copy a data structure
> which includes a slice object somewhere within it. That is a perfectly
> reasonable albeit s
cga2000 wrote:
> On Tue, Aug 08, 2006 at 12:22:42PM EDT, Simon Forman wrote:
> > John Salerno wrote:
> > > [EMAIL PROTECTED] wrote:
> > > > John> Aside from the normal commands you can use, I was wondering if
> > > > John> it's po
[EMAIL PROTECTED] wrote:
> | would use a recursive approach for this - given that you have a sort
> of recursive datastructure:
>
> py> def SetNewDataParam2(Data, NewData):
> ... if type(Data[Data.keys()[0]]) == type(dict()):
Note:
|>> type(dict()) is dict
True
"dict" *is* a type...
--
ht
ory(True)
|>> foo
<__main__.f instance at 0xb7dd944c>
|>> foo = f_factory(False)
|>> foo
|>> print foo
None
There might be a way using __new__(), but I don't know what or how.
Also, "del" is a statement, not a function. You don't need to use
()'s.
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Kairo Matthias wrote:
> How can i encode with yEnc?
What's yEnc? :-)
Seriously though, did you try googling for "yEnc python"?
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
stdout. IIRC, the least inconvenient
way (without replacing stdout) was rewriting it not to use print
statements...
http://groups.google.ca/group/comp.lang.python/browse_frm/thread/70aca5068c18384f/d19e9119b7ca1af2
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
(1, 101)
for N in grouper(5, R, ''):
print ' '.join(str(n) for n in N)
If your iterable is not a multiple of n (of course not the case for 100
and 5), and you don't want the extra spaces at the end of your last
line, you could join the lines with '\n' and stick a call to rstrip()
in there:
G = grouper(5, R, '')
print '\n'.join(' '.join(str(n) for n in N) for N in G).rstrip()
but then you're back to ugly. lol.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
items2(sequence, count=5):
> """Print count items of sequence per line."""
> for pos in range(0, len(sequence), count):
> for item in sequence[pos:pos+count]:
> print item,
> print
>
> Cheers,
> John
Very nice.
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
und in module __builtin__:
round(...)
round(number[, ndigits]) -> floating point number
Round a number to a given precision in decimal digits (default 0
digits).
This always returns a floating point number. Precision may be
negative.
HTH,
~Simon
BTW, '+value+' ..? Huh?
--
http://mail.python.org/mailman/listinfo/python-list
an a dozen, or no,
changes to move between windows and *nix. YMMV
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
urn value of
> manager.getStatus(), it's a very straight forward call to it and return it.
>
> Thank you.
> --
> Pupeno <[EMAIL PROTECTED]> (http://pupeno.com)
The code you posted doesn't match the output you posted. Try coding
the smallest version of what you're trying to do and post its output.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Sybren Stuvel wrote:
> Dan Bishop enlightened us with:
> a = b = 1e1000 / 1e1000
> a is b
> > True
> a == b
> > False
>
> If "a is b" then they refer to the same object, hence a == b. It
> cannot be otherwise, unless Python starts to defy logic. I copied your
> code and got the expec
Alexandre Guimond wrote:
> thx for all the help simon. good ideas i can work with.
>
> thx again.
>
> alex.
>
You're very welcome, a pleasure. ;-)
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
John Machin wrote:
> Simon Forman wrote:
>
> >
> > |>> class f:
> > ... def __init__(self):
> > ... del self
>
> Of course nothing happens. Args are local variables. 'self' is is a
> vanilla arg of a vanilla function.
I k
info in the doc. Any links will be
> helpful.
>
> Thank you,
> hj
"The following list of functions are also defined as methods of string
and Unicode objects; see ``String Methods'' (section 2.3.6) for more
information on those."
i.e. string.lower() => &
ntruct the object?
> What am I missing?
>
> a = typeA()
> b = typeB()
> c = baseClass(a)
a = typeA()
b = typeB()
You're done. Stop there.
You can't "select which class baseClass really is"-- it really is
baseClass. You "select" which class your object is by choosing which
class to use to construct the object.
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
* from account")
> 3L
> >>> k.fetchall()
> ((1L, 'test', -1L), (2L, 'Test', -1L), (3L, 'Test2', -1L))
>
>
> -j
k.description
See also http://www.python.org/dev/peps/pep-0249/
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
On 16 Aug 2006 12:53:12 -0700, KraftDiner <[EMAIL PROTECTED]> wrote:
> I can see that this might work...
> c = [a, b]
> for c in [a,b]:
>c.getName()
>
> but when does baseClass ever get used?
> Why did i even have to define it?
Well, quite.
--
Cheers,
Simon
ls.parseaddr() fit the bill?
http://docs.python.org/lib/module-email.Utils.html#l2h-3944
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
John Salerno wrote:
> Ok, I know it's been asked a million times, but I have a more specific
> question so hopefully this won't be just the same old post. I've tried a
> few different editors, and I really like UltraEdit, but it's
> Windows-only and I'm working more on Linux nowadays.
>
> Here are
Paul Rubin wrote:
> "Simon Forman" <[EMAIL PROTECTED]> writes:
> > Have you tried IDLE? It ships with python, meets your 5 criteria(*),
> > can be customized (highlighting colors and command keys and more), and
> > includes a usable GUI debugger. It'
ent call last):
File "", line 2, in -toplevel-
print random.randrange(6),
KeyboardInterrupt
If not, try putting "print random_list" *inside* your while loop.
HTH,
~Simon
P.S. Take a look at the random.shuffle() function... :-)
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> Hello.
> I'm writing a proxy class, i.e: a class whose methods mostly delegate
> their functionality to other class object. Most of the methods (which
> are quite a lot) defined in the class would end up being:
>
> def thisIsTheMethodName(self):
> self._handlerClass.
her on one line like this you must separate them with
";". I.e. "import sys; sys.argv". Note that this will still not do
what (I'm guessing) you want because this code is not being executed
interactively. It will simply "get" the value of sys.argv and then
throw it away. Try "import sys; print sys.argv", if you want to print
the value of sys.argv.
Happy coding,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
append(fname)
break
But see the next point:
5) Since you have a list of things you're matching (excluding actually)
this part:
> for item in self.flist:
> if item == fname[:-4]:
> pass
> else:
> self.matches.append(fname)
could become:
if fname[:-4] not in self.flist: self.matches.append(fname)
6) Why are you using #~ for comments?
Also, check out os.path.splitext()
http://docs.python.org/lib/module-os.path.html#l2h-1761
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
;
>
> is there a way to validate that it was entered that way?
>
> Any help would be appreciated
Yes.
Please read this: http://www.catb.org/~esr/faqs/smart-questions.html
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
endianness, I smell a faster way using struct.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
> Or you can use the has_key() and test it first. For example
>
> if foo.has_key('bar'):
> print 'we have it'
> else :
> print 'we don't have bar.'
>
Nowadays you can also say:
if 'bar' in foo:
# do something
--
http://mail.python.org/mailman/listinfo/python-list
o use for the feature. It's a price not worth paying.
--
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonline.net/simon/blog/
--
http://mail.python.org/mailman/listinfo/python-list
gugan.com
Forgive me if this is stupid, but python's written in C.. couldn't you
use python itself or parts of it as a library?
I know you said you're not "looking to interface C++ with Python in any
way", but why emulate if you could include? (Again, if this is stupid,
sorry! :) )
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
ing is:cond((abs(c,a,b)
>
> Can anyone help me with the regular expression? Is this even the best
> approach to take? Anyone have any thoughts?
>
> Thanks for your time!
You're gonna want a parser for this. pyparsing or spark would suffice.
However, sinc
Jason Jiang wrote:
> Hi,
>
> I have two modules: a.py and b.py. In a.py, I have a function called
> aFunc(). I'm calling aFunc() from b.py (of course I import module a first).
> The question is how to directly set a breakpoint in aFunc().
>
> The way I'm doing now is to set a breakpoint in b.py at
Jason Jiang wrote:
> "Simon Forman" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Jason Jiang wrote:
> >> Hi,
> >>
> >> I have two modules: a.py and b.py. In a.py, I have a function called
> >> aFunc(). I
rom the use of 2's complement
binary arithmetic.
Peace,
~Simon
P.S. ints and longs are becoming unified soon.
--
http://mail.python.org/mailman/listinfo/python-list
msg
> #indent is 1 tab + 4 spaces
> token=DEDENT, line_number=8, indent_lvl=1
> token=DEDENT, line_number=8, indent_lvl=0
>
> $ ./sample.py tabspacing_8B.py
> token=INDENT, line_number=3, indent_lvl=1 """triple quote"""
> #indent is 1 tab
> token=INDENT, line_number=5, indent_lvl=2 self.msg = msg
> #indent is 1 tab + 4 spaces
> token=DEDENT, line_number=8, indent_lvl=1
> token=DEDENT, line_number=8, indent_lvl=0
Well, the simple answer is "Don't mix tabs and spaces." But if that's
unhelpful ;-) , check out the tabnanny script (now in the standard
library) and also the expandtabs() method of strings.
http://docs.python.org/lib/module-tabnanny.html
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
ou just want the script and not the full path
>
> print os.path.basename(sys.argv[0])
>
> -Larry Bates
Also, check out:
http://groups.google.ca/group/comp.lang.python/browse_frm/thread/712572b3c2f2cb13
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Jason Jiang wrote:
> Great! It's working now. Thank you so much.
>
> Jason
You're welcome, it's a pleasure! :-D
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
8938 appears to be the date in days since 1/1/1900. I'm sure someone
> can help you figure out how to convert that to a more useful value.
>>> excel_date = 38938.0
>>> python_date = datetime.date(1900, 1, 1) +
datetime.timedelta(days=excel_date)
>>> python_date
On 10/5/06, Simon Brunning <[EMAIL PROTECTED]> wrote:
> On 5 Oct 2006 10:25:37 -0700, Matimus <[EMAIL PROTECTED]> wrote:
> > > the date( 8/9/2006 ) in Excel file, i am getting the value as 38938.0,
> > > which I get when I convert date values to general format
On 5 Oct 2006 12:49:53 -0700, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> Actually was about to post same solution and got same results. (BTW
> Simon, the OP date is Aug 9th, 2006). Scratched head and googled for
> excel date calculations... found this bug where it treats 1900
Hi,
I'm having trouble with the following code. The problem is that the value
read by getch() when I hit the up or down keys doesn't match curses.KEY_UP
or curses.KEY_DOWN respectively. Other keys, such as 'z' in my example
code, work fine.
I only seem to have this problem when dealing with newly
On Sat, 07 Oct 2006 13:12:33 +, Simon Morgan wrote:
> import curses
>
> def main(scr):
> status = curses.newwin(1, curses.COLS, 0, 0) status.bkgd('0')
> status.refresh()
>
> list = curses.newwin(curses.LINES, curses.COLS, 1, 0) list.bkgd(
On 10/16/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> You're at the mercy of the comparison machinery implemented by individual
> classes.
Plus, if you put a wildcard object into a set (or use it as a
dictionary key) you'll confuse yourself horribly.
I know I di
t(cmp)
>
> print a
> [1,4,7,10, 2,5,8, 3,6,9]
>
> So withouth making this into an IQ test.
> Its more like
> 1 4 7 10
> 2 5 8
> 3 6 9
>>> a = [1,2,3,4,5,6,7,8,9,10]
>>> a.sort(key=lambda item: (((item-1) %3), item))
>>> a
[1, 4, 7, 10, 2, 5, 8,
On 10/16/06, Simon Brunning <[EMAIL PROTECTED]> wrote:
> >>> a = [1,2,3,4,5,6,7,8,9,10]
> >>> a.sort(key=lambda item: (((item-1) %3), item))
> >>> a
> [1, 4, 7, 10, 2, 5, 8, 3, 6, 9]
Re-reading the OP's post, perhaps sorting isn't what'
#x27;central_african_republic_province.txt'
>>> spam.split('.')[0].rsplit('_', 1)[-1]
'province'
--
Cheers,
Simon B
[EMAIL PROTECTED]
http://www.brunningonline.net/simon/blog/
--
http://mail.python.org/mailman/listinfo/python-list
On 10/17/06, Alexander Eisenhuth <[EMAIL PROTECTED]> wrote:
> Hello,
>
> is there a assignement operator, that i can overwrite?
Soirry, no, assignment is a statement, not an operator, and can't be overridden.
--
Cheers,
Simon B
[EMAIL PROTECTED]
http://www.brunningo
On 18 Oct 2006 08:24:27 -0700, Lad <[EMAIL PROTECTED]> wrote:
> How can I add two dictionaries into one?
> E.g.
> a={'a:1}
> b={'b':2}
>
> I need
>
> the result {'a':1,'b':2}.
>>> a={'a':1}
>>>
n build it yourself
quickly and easily, and a lot of other functions as well.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
andard library
+1 QOTW
--
Cheers,
Simon B
[EMAIL PROTECTED]
http://www.brunningonline.net/simon/blog/
--
http://mail.python.org/mailman/listinfo/python-list
a functional approach is better, Python does that.
--
Cheers,
Simon B
[EMAIL PROTECTED]
http://www.brunningonline.net/simon/blog/
--
http://mail.python.org/mailman/listinfo/python-list
On 10/20/06, tom arnall <[EMAIL PROTECTED]> wrote:
> Is there a cross-linked version of the python documentation available? Is
> anyone interested in starting a project for such?
What do you mean by cross-linked?
--
Cheers,
Simon B
[EMAIL PROTECTED]
http://www.brunningonline.ne
code that tells python not to bother even opening a window. of
How do you know this?
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
g
Python ships with two utility scripts, crlf.py and lfcr.py, that
"Replace CRLF with LF in argument files" and "Replace LF with CRLF in
argument files", respectively.
Look in examples/Tools/scripts of your python dist.
Even if you don't want to use the scripts
steve wrote:
> I thought that when read Guido van Rossum' Python tutorial.What can we
> think that?
What?
--
http://mail.python.org/mailman/listinfo/python-list
Dustan wrote:
> Can I make enumerate(myObject) act differently?
>
> class A(object):
> def __getitem__(self, item):
> if item > 0:
> return self.sequence[item-1]
> elif item < 0:
> return self.sequence[item]
> elif
simply cast an int (or pointer to int, which is
what you say dat is declared as, unless my C is /really/ rusty) to
PyObject*.
I think you need to do something like Py_BuildValue("i", 123), but see
http://docs.python.org/ext/buildValue.html for more info.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
n
files.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
I want to build a Python2.5 interpreter for an embedded system. I only
have 4MB of RAM to play with, so I want to really minimise the python
binary.
Things I can think of removing safely are:
- Unicode
- Long numbers
- Complex number
- Compiler / Parser
- Thread support
- OS specific stuff
> http://www.python.org/dev/summary/2006-09-16_2006-09-30/#shrinking-python
Excellent, just what I was hoping for. Thanks!
-Sw.
--
http://mail.python.org/mailman/listinfo/python-list
our_name
else:
print "You smell lovely, ", your_name
After running it a couple of times, she dove in and changed the 2nd line to:
if your_name.lower() == "daddy or ella":
(Ella is my other daughter's name.) That's pretty close to correct,
I'd say - but you don
this purpose:
> >
> > http://del.icio.us/tag/pythonfud
>
> now at:
>
> http://del.icio.us/tag/python-fud
>
>
Hey, Fredrik, you have your own tag!
<http://del.icio.us/tag/fredrik-lundh-troll> I wish *I* had my own
tag. ;-)
I notice that, as you pred
Actually, you're wrong on all levels.
First: It's perfectly simple in Java to create a binary sort that sorts
all arrays that contain objects; so wrong there.
Secondly: The bug has nothing to do with static typing (I'm guessing
that's what you meant. Both Python and Java are strongly typed). The
Ilias Lazaridis wrote:
> [posted publicly to comp.lang.python, with email notification to 6
> recipients relevant to the topic]
>
> I have implemented a simple schema evolution support for django, due to
> a need for a personal project. Additionally, I've provided an Audit:
>
> http://case.lazaridi
atterns that they support are
less powerful and flexible than regex patters, but much simpler, and
specifically designed with filename matching in mind.
--
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonline.net/simon/blog/
--
http://mail.python.org/mailman/listinfo/python-list
Bryan wrote:
> hi,
>
> what is the difference among numeric, numpy and numarray? i'm going to start
> using matplotlib soon and i'm not sure which one i should use.
>
>
> this page says, "Numarray is a re-implementation of an older Python array
> module
> called Numeric"
> http://www.stsci.edu/r
ype . How can i change these types so i
> can join the columns together as string?
"|".join(str(column) for column in result)
--
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonline.net/simon/blog/
--
http://mail.python.org/mailman/listinfo/python-list
On 14 Jun 2006 10:33:21 -0700, Sébastien Boisgérault
<[EMAIL PROTECTED]> wrote:
> Jeez, 12 posts in this IEEE 754 thread, and still
> no message from uncle timmy ? ;)
Somebody reboot the timbot, please. Seems to have hung.
--
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunni
defined below them because
the function objects haven't been created yet. That's why you get a
NameError, the name 'b' won't been bound to anything until after the
def statement has been interpreted.
You can, of course, put your functions in another module.
Hope that helps,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
;s simpler.
L = [3, 3, 3, 1, 3, 3]
print min((n, i) for i, n in enumerate(L))[1] # prints 3
Hope this helps
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
proc.stdout.read()
# Check for errors.
err = proc.stderr.read()
if err: raise Exception(err)
It worked nicely for me, YMMV.
Hope that helps,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
iteritems(): combo.Append(k, v)
>From the manual link that Iain King posted
(http://wxwidgets.org/manuals/2.6.3/wx_wxcontrolwithitems.html#wxcontrolwithitems)
it appears that you might be able to pass a list of strings to the
Append() method. However, it also appears that you wouldn't be able to
associate any "clientData" with the strings.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Sheldon wrote:
> Hi,
>
> I have a written a script that will check to see if the divisor is zero
> before executing but python will not allow this:
>
> if statistic_array[0:4] > 0.0:
> statistic_array[0,0:4] =
> int(multiply(divide(statistic_array[0,0:4],statistic_array \
> [0,4]),1.0))/100.0
raceback.print_exc()
return False
else:
pass
#The rest of the program
It's generally very difficult to figure out what's going wrong without
the traceback in front of you.
Also, try an empty string (i.e. "") as your hostname, it's shorthand
for 'localhost'.
Hope this helps,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Bruno Desthuilliers wrote:
> Simon Forman wrote:
> > rodmc wrote:
...
> > except:
> > print "A database connection error has occurred"
>
> How can you assert it is a database connection error ?
assert "database connection" in error
(just kid
e instead. Check out
http://docs.python.org/lib/module-CGIHTTPServer.html
Then you'd just write one or more cgi scripts (they can be in python
IIRC) to run the commands you want.
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
spohle wrote:
> hi
>
> how can i modify multiple widgets with one scrollbar ?
>
> thanks in advance
>
> sven
If you're using Tkinter check out:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52266
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
placid wrote:
> Simon Forman wrote:
> >
...
> > For what you're asking about you'd probably want to use the
> > CGIHTTPRequestHandler from the CGIHTTPServer module instead. Check out
> > http://docs.python.org/lib/module-CGIHTTPServer.html
>
> T
placid wrote:
> Simon Forman wrote:
...
>
> The file was named test.cgi. I changed it too test.py and it worked
>
Awesome! Glad to hear it.
...
>
> Thanks for the help. I got it to work now.
>
You're welcome. I'm glad I could help you. :-D
Peace,
~Si
[EMAIL PROTECTED] wrote:
> What are the reason one would get this error: TypeError: Cannot create
> a consistent method resolution order (MRO) for bases object ??
>
> I can provide the code if needed
Yes, do that.
That's an amazing error.
~Simon
--
http://mail.python.org
yournum, mynum
while yournum != mynum:
if yournum < mynum:
print "Nope. Too low"
elif yournum > mynum:
print "Oh, you're too high"
again()
print "Wow! You got it!"
def again():
global yournum
yournum = input("guess again: ")
loop()
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
701 - 800 of 1585 matches
Mail list logo