What is the best aproach when it comes to import??, is allways better to
make all the import calls in the global scope, making the overall
runtime of the program better because the program is not going to import
something everytime a function is called, or is better to make specific
import's in
> On Fri, Aug 28, 2009 at 3:00 PM, Marc wrote:
> > Hello,
> >
> >
> >
> > I am trying to code an email alert and am running into the following
> error:
> >
> > s = smtplib.SMTP('smtp.marcd.org')
> >
> > AttributeError: 'module' object has no attribute 'SMTP'
>
> Your file 'email.py' is hiding
Hi,
Thanks for the confirmation. IM50re.txt is a plain text corpus. Let us say
that we want to count the words in this corpus. In the NLTK book, there is an
example.
>>> import nltk
>>> nltk.corpus.gutenberg.fileids()
['austen-emma.txt', 'austen-persuasion.txt', 'austen-sense.txt',
'bible-k
On Fri, Aug 28, 2009 at 7:29 PM, Ishan Puri wrote:
> Hi,
from nltk.corpus import PlaintextCorpusReader
corpus_root='C:\Users\Ishan\Documents'
wordlists = PlaintextCorpusReader(corpus_root, 'IM50re.txt')
wordlists.fileids()
> ['IM50re.txt']
>
> This is the result I get.
That see
On Fri, Aug 28, 2009 at 3:00 PM, Marc wrote:
> Hello,
>
>
>
> I am trying to code an email alert and am running into the following error:
>
> Connecting to server
>
> Traceback (most recent call last):
>
> File "C:\Users\Marc1\Documents\Python\email test\email.py", line 1, in
>
>
> import sm
"Damon Timm" wrote
Anyhow, I would like to have a tuple defined at the beginning of my
code that includes classes *before* they are defined ... as such (this
is on-the-fly-hack-code just for demonstrating my question):
See another recent thread - you can't do it.
What you could do is put y
On Fri, Aug 28, 2009 at 5:21 PM, Damon Timm wrote:
> Sorry for the double post! Went off by mistake before I was done ...
>
> Anyhow, I would like to have a tuple defined at the beginning of my
> code that includes classes *before* they are defined ... as such (this
> is on-the-fly-hack-code just
Hi,
>>> from nltk.corpus import PlaintextCorpusReader
>>> corpus_root='C:\Users\Ishan\Documents'
>>> wordlists = PlaintextCorpusReader(corpus_root, 'IM50re.txt')
>>> wordlists.fileids()
['IM50re.txt']
This is the result I get. I was wondering how I can use the packages on
IM50re.txt? I followed s
On Fri, Aug 28, 2009 at 6:09 PM, Ishan Puri wrote:
> Hi,
> Thanks for your response. I tried this and got to the 3rd line. However,
> when I type in the fourth:
>
wordlists.fileids()
>
> a blank comes as a result. When I try the len() function it only counts the
> letters in title of the
>
class A:
> instances = {}
> def __new__(self,ID):
> if ID in self.instances:
> return self.instances[ID]
> else:
> self.instances[ID] = self
> return self
> def __init__(self, ID):
> if ID not in self.instances:
> print("unregistered instance!")
> def __del__(self):
> del(self.instances[self.I
Hi,
Thanks for your response. I tried this and got to the 3rd line. However,
when I type in the fourth:
>>> wordlists.fileids()
a blank comes as a result. When I try the len() function it only counts the
letters in title of the
text document IM50re.txt. How do I get it to open and analyze
"Eduardo Vieira" wrote
Hello, list. Sorry, for this basic question. But why in Windows (XP)
command prompt I get this message if, for example I type "python
myscript.py"? But it works if I simply type myscript.py?
In the latter case Windows usees a registry setting to pick up what
program
"Dirk Wangsadirdja" wrote
Is it possible if I run two applications at once?
Yes, you just run two instances of the python interpreter.
They will happuily run independantly of one another or communicate
with each other as you wish. Its exactly the same as with Java or
Visual Basic or any ot
Hello,
I am trying to code an email alert and am running into the following error:
Connecting to server
Traceback (most recent call last):
File "C:\Users\Marc1\Documents\Python\email test\email.py", line 1, in
import smtplib
File "C:\Python26\lib\smtplib.py", line 46, in
imp
hi,
I'm new to python, and I'm starting with Python 3.1 directly. I have
been learning python for about 2 weeks now. And I have few questions.
Is it possible if I run two applications at once?
For example, if I make a clock/timer application with alarm etc, then I
want exercise with my pytho
Sorry for the double post! Went off by mistake before I was done ...
Anyhow, I would like to have a tuple defined at the beginning of my
code that includes classes *before* they are defined ... as such (this
is on-the-fly-hack-code just for demonstrating my question):
VIDEO_TYPES = (
(SyncYo
Hi -
I would like to have a tuple that holds information, as such:
VIDEO_TYPES = (
(SyncYoutube,
re.compile(r'([^(]|^)http://www\.youtube\.com/watch\?\S*v=(?P[A-Za-z0-9_-]+)\S*'),),
)
___
Tutor maillist - Tutor@python.org
http://mail.python.org/m
hi,
I'm new to python, and I'm starting with Python 3.1 directly. I have
been learning python for about 2 weeks now. And I have few questions.
Is it possible if I run two applications at once?
For example, if I make a clock/timer application with alarm etc, then I
want exercise with my python,
Hello, list. Sorry, for this basic question. But why in Windows (XP)
command prompt I get this message if, for example I type "python
myscript.py"? But it works if I simply type myscript.py? Maybe by
getting an answer for this question I could know how to make commands
"grep, diff" work from any fo
I was able to resolve the error by explicitly naming the class in the
dictionary lookup inside __new__:
if candid in CandidateAuto.instances:
return candid
I'm curious why this is necessary though. From our earlier dicussions
(and from other reading), I thought that by declari
On Fri, Aug 28, 2009 at 10:28 AM, kevin parks wrote:
> Interestingly changing:
> out_list.append(ll)
>
> to
>
> out_list.append(list(ll))
>
>
> seems to work. The part of my brain that understood why that is must have
> sleeping.
Because it makes a new list instead of
On Fri, Aug 28, 2009 at 11:20 AM, vince spicer wrote:
> Or even cleaner with list comprehension
>
> def pack(foo):
> return [x for x in enumerate(foo, 1)]
Or just list(enumerate(foo, 1))
For Python 2.5 use
[ [i+1, x] for i, x in enumerate(foo) ]
Kent
On Aug 29, 2009, at 12:23 AM, Michael M Mason wrote:
i wrote:
def pack(in_seq):
out_list=[]
x = 1
ll=[1, 1]
for each in in_seq:
ll[0] = x
ll[1] = each
out_list.append(ll)
#print ll
x
Interestingly changing:
out_list.append(ll)
to
out_list.append(list(ll))
seems to work. The part of my brain that understood why that is must
have sleeping.
-k
On Aug 28, 2009, at 11:05 PM, i wrote:
Back to python after a long long layoff. So i am running
hello,
I've been working on threads and queues and I think I have it working well. The
problem seems to be that when I run a thread via the IDLE it crashes. if I
simply double click the file it appears to run ok. I'm not sure if I'm doing
something incorrectly or not. it seems pretty straight fo
kevin parks wrote:
Back to
python after a long long layoff. So i am running into some beginner's
confusion...
I am trying to plot a list of numbers in gnuplot.py. To do that I am
trying to pack the list with an index by iterating over the list so i
can get something like:
foo = [12, 11, 9,
"Serdar Tumgoren" wrote
Given those requirements, is the Mixin approach the way to go? Either
way, have I implemented these correctly?
I haven't looked at your code but you could use a mixin here
however I find using mixins for insantiation can bend your brain.
I tend to use them for instan
I think this is b/c I am running 2.5. I also have 2.6 but i am using
2.5 for gnupoly and an older audio lib i have.
I ran the listcom below on 2.6 and it worked, so i just have to figure
out how that can be written for 2.5. I guess
2.6 has an update to enumerate.
-k
On Aug 29, 2009, at 2:2
"Kristina Ambert" wrote
inventory, it's my internship project for the semester. My boss asked me
to
break down each form (e.g. product information entry, store inventory
list)
into separate small applications. I'm having a hard time understanding
what
she means by this. Does it mean each for
Kristina Ambert wrote:
Hi,
I'm new to python and frankly new to programming. This is my first question
post, so I hope everyone could bear with me.
I'm working on a small database application which basically handles a store
inventory, it's my internship project for the semester. My boss asked me
"Mac Ryan" wrote
I am not sure I understood the difference between staticmethod end
classmethod, though, even if I can guess it has to do with subclassing,
I think it is mainly historical. staticmethod came first (I think) and
classmethod
was an improvement a couple of versions later. I th
On Fri, Aug 28, 2009 at 10:49 AM, kevin parks wrote:
>
> Thanks for the replies. Though the list comprehension does not work:
>
> TypeError: enumerate() takes exactly 1 argument (2 given)
>
>
> On Aug 29, 2009, at 12:20 AM, vince spicer wrote:
>
>
>>
>> #print foohough I didn't test your co
Thanks for the replies. Though the list comprehension does not work:
TypeError: enumerate() takes exactly 1 argument (2 given)
On Aug 29, 2009, at 12:20 AM, vince spicer wrote:
#print foohough I didn't test your code, I think what you are
trying to accomplish can be done using enu
Jramak wrote:
Thanks everyone for your excellent insights. I think I understand the
callback concept better.
So, it is like passing a function as an argument to another function.
I am interested in learning more about how callbacks can be applied in
GUIs, using wxPython as an example. Would appr
Mac Ryan wrote:
On Fri, 2009-08-28 at 08:55 -0400, Dave Angel wrote:
Mac Ryan wrote:
On Wed, 2009-08-26 at 21:32 -0400, Dave Angel wrote:
Now there are a couple of decorators that are in the standard library
that everyone should know about:classmethod() and staticmethod(
Hi everyone,
Based on some earlier list advice, I went back to the drawing board
and started testing various approaches to adding the "flyweight"
pattern to my classes.
To recap, I have a bunch of campaign finance-related classes and
subclasses (Committee, HouseCommittee, PresidentialCommittee,
C
Kevin Parks wrote:
> def pack(in_seq):
> out_list=[]
> x = 1
> ll=[1, 1]
> for each in in_seq:
> ll[0] = x
> ll[1] = each
> out_list.append(ll)
> #print ll
> x = x + 1
> print out_list
Variable out
On Fri, Aug 28, 2009 at 9:18 AM, vince spicer wrote:
>
>
> On Fri, Aug 28, 2009 at 8:05 AM, kevin parks wrote:
>
>> Back to python after a long long layoff. So i am running into some
>> beginner's confusion...
>>
>> I am trying to plot a list of numbers in gnuplot.py. To do that I am
>> trying t
On Fri, Aug 28, 2009 at 8:05 AM, kevin parks wrote:
> Back to python after a long long layoff. So i am running into some
> beginner's confusion...
>
> I am trying to plot a list of numbers in gnuplot.py. To do that I am trying
> to pack the list with an index by iterating over the list so i can g
On Fri, 2009-08-28 at 08:55 -0400, Dave Angel wrote:
> Mac Ryan wrote:
> > On Wed, 2009-08-26 at 21:32 -0400, Dave Angel wrote:
> >
> >
> >> Now there are a couple of decorators that are in the standard library
> >> that everyone should know about:classmethod() and staticmethod().
> >> Th
Back to python after a long long layoff. So i am running into some
beginner's confusion...
I am trying to plot a list of numbers in gnuplot.py. To do that I am
trying to pack the list with an index by iterating over the list so i
can get something like:
foo = [12, 11, 9, 6, 2, 9, 3, 8, 12
Hi,
I'm new to python and frankly new to programming. This is my first question
post, so I hope everyone could bear with me.
I'm working on a small database application which basically handles a store
inventory, it's my internship project for the semester. My boss asked me to
break down each form
Mac Ryan wrote:
On Wed, 2009-08-26 at 21:32 -0400, Dave Angel wrote:
Now there are a couple of decorators that are in the standard library
that everyone should know about:classmethod() and staticmethod().
They wrap a method in a new one (which ends up having the same name),
such that
On Fri, Aug 28, 2009 at 3:14 AM, Ishan Puri wrote:
> Hello,
> I have successfully downloaded NLTK and the toy grammars. I want to run
> a few of the packages that come with NLTK on corpora that I have. How do I
> do this? What commands would I use? The corpora are text files; should I put
> the
On Wed, 2009-08-26 at 21:32 -0400, Dave Angel wrote:
> Now there are a couple of decorators that are in the standard library
> that everyone should know about:classmethod() and staticmethod().
> They wrap a method in a new one (which ends up having the same name),
> such that the first arg
Hello,
I have successfully downloaded NLTK and the toy grammars. I want to run a
few of the packages that come with NLTK on corpora that I have. How do I do
this? What commands would I use? The corpora are text files; should I put them
in the Python25 folder (is that the so called same direc
46 matches
Mail list logo