Sean Steeg wrote at 11:22 4/7/2005:
So we're requesting that anyone with
one-offs, snippets, mini-apps, full-fledged apps and the like make a
submission to the new and improved UselessPython. The code doesn't
have to be pretty, but it does have to work.
I'm a newbie, but would this qualify as a co
Hi all,
I must apologize for the length of the post. I have explained my
problem as tersely as able, and have done my level-best to produce the
minimum code snippet illustrative of my difficulties. But, as (I hope)
will become clear, any substantial attempts to further cull it made
the problem
> > Foo: What's it good for?
>
> Foo and Bar are popular names used in examples. They don't mean
> anything. For example to show how to define a function I might write
>
> def foo():
>print 'Hello'
>
> I just use foo to avoid having to think of a meaningful name.
Hi Joseph,
I sometimes get l
On Apr 9, 2005, at 1:54 PM, [EMAIL PROTECTED] wrote:
Message: 8
Date: Sat, 09 Apr 2005 20:58:49 +0200
From: "Logesh Pillay" <[EMAIL PROTECTED]>
Subject: [Tutor] quicksort using list comprehension
To: "Discussion for learning programming with Python"
Message-ID: <[EMAIL PROTECTED]>
Content-
On Apr 9, 2005, at 21:50, Kent Johnson wrote:
I think you have to return a value when len(t) <= 1. You don't return
anything which means you return None which can't be added to a list.
Kent
Yup. Here's a quicksort I did, adapting an example from the Wikipedia
article on Haskell:
def qsort(toSo
Alberto Troiano wrote:
Hey dudes
This code worked fine
The one you gave me worked as well but when I wanteed to store it in the
database it says that the packet was too large
Whit this code it doesn't complain but now I don't know how to retrieve
the image
I retrieve it like this:
db=MySQLdb.c
Joseph Quigley wrote:
class Message:
def init(self, p = 'Hello world'):
self.text = p
def sayIt(self):
print self.text
m = Message()
m.init()
m.sayIt()
m.init('Hiya fred!')
m.sayIt()
This is OK but a more conventional usage is to write an __init__() method. This is sometimes called
a
I think you have to return a value when len(t) <= 1. You don't return anything which means you
return None which can't be added to a list.
Kent
Logesh Pillay wrote:
I'm trying to program quicksort using list comprehension.
The following gives me a type mismatch error for "+".
def qsort (t):
i
hey,
I wrote a small class that does some ftp work for me:
#myftpclass.py
class myftp:
def __init__(self, ...):
...
def connect_and_login(self):
...
def do_foo(self):
...
def do_bar(self):
...
#here comes the interesting part for me
def goodbye(self):
Although I was not the questioner, I must admit this was a brief but
efficient answer. Reminds me to try something like the last part out
some time...
-Shane
On Apr 7, 2005 4:40 PM, Danny Yoo <[EMAIL PROTECTED]> wrote:
>
>
> On Thu, 7 Apr 2005, Luke Jordan wrote:
>
> > I am looking for a litt
I'm trying to program quicksort using list comprehension.
The following gives me a type mismatch error for "+".
def qsort (t):
if len (t) > 1:
return qsort([x for x in t[1:] if x <= t[0]]) + [t[0]] + qsort([x
for x in t[1:] if x > t[0]])
I know this sounds strange but I have and idea
Joseph Quigley wrote on Fri, 08 Apr 2005 16:58:37 -0600:
> import is handy. But my questions are:
> is there a type of unimport or something to unload a module?
Things which are not used are cleaned up automatically at some point. What
would you like to do do that this mechanism doesn't provide?
Joseph Quigley wrote on Fri, 08 Apr 2005 16:46:33 -0600:
> Now what are dictionaries and the __name__ really used for? A byte of
> python never got that through my thick skull.
Dictionaries associate a value with a certain key, sort of like a real
world dictionary where you can take a word and l
Kevin wrote:
Is there a way to get line numbers to show in python IDLE? I looked at
all the preferances but nothing?
Thanks
Kevin
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Not that I am aware of, although when y
I replied earlier from a digest entry (which starts a new thread) so you might
have missed that reply.
I included a URL for the mssql package which included the compile instructions
for using freetds.
Here is the link. Just follow the instructions and you should be able to
compile cleanly.
http
Is there a way to get line numbers to show in python IDLE? I looked at
all the preferances but nothing?
Thanks
Kevin
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Joseph Quigley wrote:
I don't think I have said it already, but I'll say it again just incase
:-), I'm new to python. I started Feb. this year.
import is handy. But my questions are:
is there a type of unimport or something to unload a module?
This is not normally needed.
Foo: What's
it good for
Go to the address at the bottom of this email. Unsubscribe. When you return,
re-subscribe.
Kent
John Carmona wrote:
I am off to sunny Spain for the next 2 weeks and I would like to suspend
the emailing from Python.tutor for that period. Could someone put me in
the right direction on how to do th
Alberto Troiano wrote:
Sorry to bother you that much. I know I have a lot to learn yet but I
hope you can teach me.
I see that someone posted something about running functions with a
timer. How can I do this???
You can use the timeit module, see my recent post for an example.
You can also use ti
Hey Joseph
Why do you want to unload a module?
I don't understand why you need to "unimport" but I do know that every module has a constructor and a deconstructor
maybe you can start from there but I will need an example or more info about why you need to do this
Regards
Alberto>From: Josep
class Message:
def init(self, p = 'Hello world'):
self.text = p
def sayIt(self):
print self.text
m = Message()
m.init()
m.sayIt()
m.init('Hiya fred!')
m.sayIt()
> Well this OOP stuff is realy hard for me as I have never even
> programmed it took me a while just to understand defs.
Th
I don't think I have said it already, but I'll say it again just incase
:-), I'm new to python. I started Feb. this year.
import is handy. But my questions are:
is there a type of unimport or something to unload a module? Foo: What's it
good for?
___
I am off to sunny Spain for the next 2 weeks and I would like to suspend the
emailing from Python.tutor for that period. Could someone put me in the
right direction on how to do that, thanks.
Regards
JC
___
Tutor maillist - Tutor@python.org
http://ma
Sorry to bother you that much. I know I have a lot to learn yet but I hope you can teach me.
I see that someone posted something about running functions with a timer. How can I do this???
I tried to emulate this with the function time.sleep(sec) but all widgets gets locked and they don't refresh th
Hey dudes
This code worked fine
The one you gave me worked as well but when I wanteed to store it in the database it says that the packet was too large
Whit this code it doesn't complain but now I don't know how to retrieve the image
This is what I'm doing:
import MySQLdb
import Image
import Image
Hi all,
Just working on some validators for text fields, and I started getting unusual errors -
File "C:\Python23\lib\site-packages\PythonCard\components\textfield.py", line 338, in _dispatch
widget.Widget._dispatch(self, aWxEvent)
File "C:\Python23\lib\site-packages\PythonCard\widget.p
[EMAIL PROTECTED] wrote:
I was glad to see your post showing how to run a list of functions
through the timer. That's a nice way to do it! You better slip some
square brackets into your definition of d though:
d = dict( [((i,i,i), i) for i in range(1000)])
In Python 2.4 they are not nee
On Apr 9, 2005, at 10:36, Danny Yoo wrote:
-- Forwarded message --
Date: Fri, 8 Apr 2005 22:03:58 EDT
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: newb problem running the translator
I will try to make this quick. I am a newb to python, and
programming at
that, but i
>I had the same question. The best I found is this:
>http://www.object-craft.com.au/projects/mssql/
>but that has a lot of strong language saying "this isn't ready for use".
>
>I found it perfectly usable for simply running queries, but haven't tried
>to do anything more complicated with it. Not
Kent Johnson wrote:
Marilyn Davis wrote:> Is there a reason to prefer one over the
other? Is one faster? I > compiled my regular _expression_ to make it
quicker. The only way to know which is faster is to time
them both. The timeit module makes it pretty easy to do
this.Here is a simple example
-- Forwarded message --
Date: Fri, 8 Apr 2005 22:03:58 EDT
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: newb problem running the translator
I will try to make this quick. I am a newb to python, and programming at
that, but i am realy interested. I have been looking
31 matches
Mail list logo