Re: [Tutor] About the vertical bar input

2009-06-29 Thread Mark Tolonen
"hyou" wrote in message news:blu143-ds478a37dc2b1db050e5b96c4...@phx.gbl... Hello, I'm trying to write a script that simply execute a command line like: C:\...(path)..\Devenv solution /build "Debug|Win32" However, in Python the "|" symbol is reserved thus I just can't make the command line

Re: [Tutor] does python have something like "#include" in C?

2009-06-29 Thread Robert Lummis
Thanks very much for all your responses. It's pretty clear now that what I thought I could somehow do is not "pythonic" and for good reason. Kent Johnson says it well: "Module dependencies should be one-way" I can buy that. On Mon, Jun 29, 2009 at 2:47 PM, Kent Johnson wrote: > On Mon, Jun 29, 20

Re: [Tutor] [Pythonmac-SIG] GASP on OSX 10.5.6

2009-06-29 Thread Chris Rebert
On Mon, Jun 29, 2009 at 3:59 PM, Daniel Sato wrote: > Hi, > > I am a complete python beginner.  I have been going through How to Think > Like A Computer Scientist 2nd edition online and have come across installing > GASP in chapter 4.  Unfortunately, I can't seem to find much documentation > on how

[Tutor] GASP on OSX 10.5.6

2009-06-29 Thread Daniel Sato
Hi, I am a complete python beginner. I have been going through How to Think Like A Computer Scientist 2nd edition online and have come across installing GASP in chapter 4. Unfortunately, I can't seem to find much documentation on how to install GASP when running OSX and Python 2.6.2. Any help w

Re: [Tutor] About the vertical bar input

2009-06-29 Thread Dave Angel
"hyou" wrote: Hello, I'm trying to write a script that simply execute a command line like: C:\...(path)..\Devenv solution /build "Debug|Win32" However, in Python the "|" symbol is reserved thus I just can't make the command line above working once I added the "|" sign in it. How

Re: [Tutor] does python have something like "#include" in C?

2009-06-29 Thread wesley chun
>> from showmodule import show >> >> then everything else will work. > > I don't think so. The exec in show() must be run in the namespace in > which the symbols being displayed are defined. yep, you're right. i didn't see the exec. it will only work if the called function somehow had access to t

Re: [Tutor] About the vertical bar input

2009-06-29 Thread Kent Johnson
On Mon, Jun 29, 2009 at 1:24 PM, hyou wrote: > I’m trying to write a script that simply execute a command line like: > > C:\...(path)..\Devenv solution /build “Debug|Win32” > > > > However, in Python the “|” symbol is reserved thus I just can’t make the > command line above working once I added th

Re: [Tutor] does python have something like "#include" in C?

2009-06-29 Thread Kent Johnson
On Mon, Jun 29, 2009 at 1:46 PM, wesley chun wrote: > take your function definition and store in a file called, say > showmodule.py. then put the remaining code inside something like > foo.py. at the top of foo.py, you'll need: > > from showmodule import show > > then everything else will work. I

Re: [Tutor] does python have something like "#include" in C?

2009-06-29 Thread Kent Johnson
On Mon, Jun 29, 2009 at 1:23 PM, Robert Lummis wrote: > Here's an example that seems not possible in python. I'm probably > missing something so please enlighten me. I only tried doing this as > an exercise to show myself how name references work. I'm not saying > it's needed or that it's good prac

[Tutor] About the vertical bar input

2009-06-29 Thread hyou
Hello, I'm trying to write a script that simply execute a command line like: C:\...(path)..\Devenv solution /build "Debug|Win32" However, in Python the "|" symbol is reserved thus I just can't make the command line above working once I added the "|" sign in it. How can I put the "origi

Re: [Tutor] "Print" on 3.1 for Mac?

2009-06-29 Thread wesley chun
On Mon, Jun 29, 2009 at 3:59 AM, Christian Witts wrote: > l...@ithstech.com wrote: >> >> Have I installed something incorrectly in Python 3.1 for Mac if I get a >> syntax error on >> >> print "hello world" >> >> My Python 2.3.5 executes this just fine.  What have I missed? > > Please take a read th

Re: [Tutor] does python have something like "#include" in C?

2009-06-29 Thread Wayne
On Mon, Jun 29, 2009 at 12:23 PM, Robert Lummis wrote: > Here's an example that seems not possible in python. I'm probably > missing something so please enlighten me. I only tried doing this as > an exercise to show myself how name references work. I'm not saying > it's needed or that it's good pr

Re: [Tutor] does python have something like "#include" in C?

2009-06-29 Thread wesley chun
> However, it seems that I can't put the function definition in a file > and import it because I can't find a way to refer to an object in the > main program file from within a module file. I understand that it's a > good thing to contol which namespaces are referenced by which code but > isn't the

Re: [Tutor] does python have something like "#include" in C?

2009-06-29 Thread Robert Lummis
Here's an example that seems not possible in python. I'm probably missing something so please enlighten me. I only tried doing this as an exercise to show myself how name references work. I'm not saying it's needed or that it's good practice. I can write the following as a single file and it works

Re: [Tutor] does python have something like "#include" in C?

2009-06-29 Thread Alan Gauld
"Robert Lummis" wrote I'm looking for a way to get boiler plate code into the main program file. Of course I could copy and paste it with an editor but I was hoping for something more pythonic. I know about import but that's not the same. Others have already pointed out import. Its also wo

Re: [Tutor] "Print" on 3.1 for Mac?

2009-06-29 Thread Alan Gauld
wrote Have I installed something incorrectly in Python 3.1 for Mac if I get a syntax error on print "hello world" My Python 2.3.5 executes this just fine. What have I missed? The "Whats New" document on V3 V3 is radically different to previous versiions and you need to read the Whats Ne

Re: [Tutor] intefaces in python

2009-06-29 Thread Alan Gauld
"Amit Sethi" wrote I think ideally i want a compile Error just like java .. I think you are trying to make Python act like Java which is always a really bad mistake when using a programming language. As Bjarne Stroustrup used to say (repeatedly) "C++ is not Smalltalk". And Python is not

Re: [Tutor] does python have something like "#include" in C?

2009-06-29 Thread Emile van Sebille
On 6/29/2009 8:03 AM Robert Lummis said... ... or any pre-processing at all? I'm looking for a way to get boiler plate code into the main program file. Of course I could copy and paste it with an editor but I was hoping for something more pythonic. I know about import but that's not the same.

Re: [Tutor] does python have something like "#include" in C?

2009-06-29 Thread A.T.Hofkamp
Robert Lummis wrote: ... or any pre-processing at all? I'm looking for a way to get boiler plate code into the main program file. Of course I could copy and paste it with an editor but I was hoping for something more pythonic. I know about import but that's not the same. Python is very good at

Re: [Tutor] does python have something like "#include" in C?

2009-06-29 Thread Wayne
On Mon, Jun 29, 2009 at 10:03 AM, Robert Lummis wrote: > ... or any pre-processing at all? > > I'm looking for a way to get boiler plate code into the main program > file. Of course I could copy and paste it with an editor but I was > hoping for something more pythonic. I know about import but tha

Re: [Tutor] Tutor Digest, Vol 64, Issue 128

2009-06-29 Thread Dave Angel
Amit Sethi wrote: . On Mon, Jun 29, 2009 at 5:01 PM, Dave Angel wrote: > > Amit Sethi ?wrote: > >> Well I want to implement plug-in like mechanism for an application . I want >> to define some minimum functions that any body writing a plugin has to >> implement. For that i thought an i

[Tutor] does python have something like "#include" in C?

2009-06-29 Thread Robert Lummis
... or any pre-processing at all? I'm looking for a way to get boiler plate code into the main program file. Of course I could copy and paste it with an editor but I was hoping for something more pythonic. I know about import but that's not the same. -- Robert Lummis

Re: [Tutor] intefaces in python

2009-06-29 Thread Amit Sethi
well dir(object) , how would that help . All the functions in base class would automatically be inherited by the objects of plug-in class ... so they would come in the list even if it was not implemented... On Mon, Jun 29, 2009 at 5:58 PM, Luke Paireepinart wrote: > Amit Sethi wrote: >> >> I think

Re: [Tutor] intefaces in python

2009-06-29 Thread Luke Paireepinart
Amit Sethi wrote: I think ideally i want a compile Error just like java .. Why? For developers, so they'll know if their plugin meets the interface requirements? Have you considered just making a unit test that will call all interface functions with appropriate parameters? Then they can just

Re: [Tutor] intefaces in python

2009-06-29 Thread Amit Sethi
wait even in the above example i would have to run all the functions in __init__ that is plain stupid ... i was just brain storming On Mon, Jun 29, 2009 at 5:34 PM, Amit Sethi wrote: > I think ideally i want a compile Error just like java .. but from the > discussion here ... i wrote this litt

Re: [Tutor] intefaces in python

2009-06-29 Thread Amit Sethi
I think ideally i want a compile Error just like java .. but from the discussion here ... i wrote this little example: class a(object):     def __init__(self):         self.query()         try:             if self.query_not_implemented==True:                 raise NotImplementedError         excep

[Tutor] [Fwd: Re: "Print" on 3.1 for Mac?]

2009-06-29 Thread Christian Witts
Forwarding to the list. Original Message Subject:Re: [Tutor] "Print" on 3.1 for Mac? Date: Mon, 29 Jun 2009 12:38:43 +0100 From: andré palma To: Christian Witts References: <4a489e92.2040...@compuscan.co.za> try to find out if is there any space before "

Re: [Tutor] intefaces in python

2009-06-29 Thread Dave Angel
Amit Sethi wrote: Well I want to implement plug-in like mechanism for an application . I want to define some minimum functions that any body writing a plugin has to implement. For that i thought an interface would be best because in a scenario where the function is not implemented some kind of

Re: [Tutor] "Print" on 3.1 for Mac?

2009-06-29 Thread Christian Witts
l...@ithstech.com wrote: Have I installed something incorrectly in Python 3.1 for Mac if I get a syntax error on print "hello world" ? My Python 2.3.5 executes this just fine. What have I missed? Thanks much for anything, Lev ___ Tutor maillist

[Tutor] "Print" on 3.1 for Mac?

2009-06-29 Thread lev
Have I installed something incorrectly in Python 3.1 for Mac if I get a syntax error on print "hello world" ? My Python 2.3.5 executes this just fine. What have I missed? Thanks much for anything, Lev ___ Tutor maillist - Tutor@python.org http:/

Re: [Tutor] intefaces in python

2009-06-29 Thread Alan Gauld
"Amit Sethi" wrote Well I want to implement plug-in like mechanism for an application . I want to define some minimum functions that any body writing a plugin has to implement. For that i thought an interface would be best because in a scenario where the function is not implemented some kind

Re: [Tutor] character counter

2009-06-29 Thread Sander Sweers
2009/6/27 julie : > file = open("/Users/meitalamitai/Documents/Computer > Science/Python/Homework/Lorem_Ipsum.py") > lines = 0 > for line in file: >     lines=lines+1 > print '%r has %r lines' % ("Lorem_Ipsum.py", lines) >    if char >= 1000: >     break You can do something like below (untest

Re: [Tutor] intefaces in python

2009-06-29 Thread Amit Sethi
Well I want to implement plug-in like mechanism for an application . I want to define some minimum functions that any body writing a plugin has to implement. For that i thought an interface would be best because in a scenario where the function is not implemented some kind of error would occur. I w

Re: [Tutor] intefaces in python

2009-06-29 Thread Alan Gauld
"Amit Sethi" wrote class MyInterface(object): doSomething(line): raise NotImplementedError doSomethingElse(line): raise NotImplementedError I think that is exactly the kind of structure i was looking for ... As a matter of interest, why? What do you anticipate using this fo

Re: [Tutor] intefaces in python

2009-06-29 Thread Amit Sethi
class MyInterface(object): doSomething(line): raise NotImplementedError doSomethingElse(line): raise NotImplementedError I think that is exactly the kind of structure i was looking for ... On Mon, Jun 29, 2009 at 12:58 PM, Andre Engels wrote: > On Sun, Jun 28, 2009 at 5:00 P

Re: [Tutor] intefaces in python

2009-06-29 Thread Andre Engels
On Sun, Jun 28, 2009 at 5:00 PM, Amit Sethi wrote: > Hi , I don't suppose python has a concept of interfaces. But can somebody > tell me if their is a way i can  implement something like a java interface > in python. Sure. Interfaces are just Java's compensation for not having multiple inheritance

Re: [Tutor] freeze

2009-06-29 Thread A.T.Hofkamp
col speed wrote: HI Guys, I have a small programme, called shop.py, that I wish to make into a "frozen binary" ( I think that's right - I'm using Linux Ubuntu 9.04 and I want the programme to work on a windows computer that doesn't have Python installed). I used freeze.py from examples/Tools and

Re: [Tutor] Converting a Py2exe Script to a Windows Installer

2009-06-29 Thread Alfred Milgrom
Quite a while ago I had success in using the Inno Installer. Relatively painless and free. Can't remember all the details but you can start at http://www.jrsoftware.org/isinfo.php All the best, Fred Milgrom On Sun, Jun 28, 2009 at 5:40 AM, Paras K. wrote: > I have been writing many scripts usi