Alan Gauld wrote:
This is a bad choice of class. It is a verb which is indicative
that its not an object. Objects are nearly always nouns.
You could use GuessableNumber.
Then it would have a number attribute which is the number
to guess. It could have a generate() ,method which produces
a new
spir wrote:
> Le Fri, 12 Jun 2009 22:37:17 +1000,
> Lie Ryan s'exprima ainsi:
>
> Right, thank you. I continued my trials and ended with seemingly working
> code, close to yours.
>
> # case pattern is Klass: yield String instead
> if isinstance(pattern,Klass):
>
"Jacob Mansfield" wrote
does anyone know how to replace the C comands inp() and outb() these are
used for parallel port communication
These are non standard C functions and will depend on
your compiler, OS and hardware. You might be able to
access them from Python via the ctypes module,
"csarita bhandari" wrote
I have download python version 3.0.1 windows installer, but problem
occur during installing it. And the problem is " Your Administration
don't permit to install this program".
Thats a windows problem not Python. You need to get an account
with Admin access.
Wh
On Fri, Jun 12, 2009 at 10:03 AM, spir wrote:
> Don't you have a comment in the 'if' case, too? Namely that __init__ is not
> invoked explicitely, while the docs clearly state:
>
> << f __new__() returns an instance of cls, then the new instance’s __init__()
> method will be invoked like __init__
Le Fri, 12 Jun 2009 09:05:35 -0400,
Kent Johnson s'exprima ainsi:
> On Fri, Jun 12, 2009 at 8:37 AM, Lie Ryan wrote:
> class Normal(object):
> > ... def __new__(cls, arg):
> > ... if arg:
> > ... return Special(arg)
> > ... else:
> > ... ret = supe
On Fri, Jun 12, 2009 at 9:48 AM, spir wrote:
> Right, thank you. I continued my trials and ended with seemingly working
> code, close to yours.
>
> # case pattern is Klass: yield String instead
> if isinstance(pattern,Klass):
> self = String(pat
does anyone know how to replace the C comands inp() and outb() these are
used for parallel port communication
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Le Fri, 12 Jun 2009 22:37:17 +1000,
Lie Ryan s'exprima ainsi:
> >>> class Normal(object):
> ... def __new__(cls, arg):
> ... if arg:
> ... return Special(arg)
> ... else:
> ... ret = super(Normal, cls).__new__(cls)
> ... ret.__init__(arg)
Le Fri, 12 Jun 2009 22:37:17 +1000,
Lie Ryan s'exprima ainsi:
> spir wrote:
> > Hello,
> >
> > I have (again) some issue using __new__.
> > What I need is basically to catch an object creation and yield an object
> > of an alternate type, when a condition is met.
> >
> > Basically, the outline
Le Fri, 12 Jun 2009 14:20:24 +0200,
"A.T.Hofkamp" s'exprima ainsi:
> spir wrote:
> > Hello,
> >
> > I have (again) some issue using __new__.
> > What I need is basically to catch an object creation and yield an object
> > of an alternate type, when a condition is met.
> >
> > Basically, the out
On Fri, Jun 12, 2009 at 8:37 AM, Lie Ryan wrote:
class Normal(object):
> ... def __new__(cls, arg):
> ... if arg:
> ... return Special(arg)
> ... else:
> ... ret = super(Normal, cls).__new__(cls)
> ... ret.__init__(arg)
> ...
spir wrote:
> Hello,
>
> I have (again) some issue using __new__.
> What I need is basically to catch an object creation and yield an object of
> an alternate type, when a condition is met.
>
> Basically, the outline looks like:
>
> class Normal(object):
> def __new__(cls, arg):
> i
On Fri, Jun 12, 2009 at 2:49 AM, eShopping
wrote:
>
> Hm .does this mean we are snookered on Win XP?
Well, strictly using python anyway. I'm not sure precisely how the ctypes
module works, but it's a fairly simple amount of code in assembly to push
characters into the keyboard buffer. I pre
spir wrote:
Hello,
I have (again) some issue using __new__.
What I need is basically to catch an object creation and yield an object of an
alternate type, when a condition is met.
Basically, the outline looks like:
class Normal(object):
def __new__(cls, arg):
if cond(arg):
On Fri, Jun 12, 2009 at 2:48 AM, csarita bhandari <
csaritabhandari...@hotmail.com> wrote:
> Dear sir/madam,
>
> I have download python version 3.0.1 windows installer, but problem occur
> during installing it. And the problem is " Your Administration don't permit
> to install this program". Wha
Hello,
I have (again) some issue using __new__.
What I need is basically to catch an object creation and yield an object of an
alternate type, when a condition is met.
Basically, the outline looks like:
class Normal(object):
def __new__(cls, arg):
if cond(arg):
#
On Thu, Jun 11, 2009 at 9:00 PM, Randy Trahan wrote:
> Also Programming Lanquage Question:
> I have studied and an fairly proficient at XHTML and CSS, I tried Javascript
> but just didn't like it for some reason..so I am trying Python which so far
> fits my personality, needs, whatever that part i
Dear sir/madam,
I have download python version 3.0.1 windows installer, but problem occur
during installing it. And the problem is " Your Administration don't permit to
install this program". What should i do? I am new in python.
thank you!
_
"David" wrote
have been attempting to learn about classes, this is my version,
comments, suggestions always welcome.
-david
#!/usr/bin/python
from random import randrange
from sys import exit
class GuessNumber:
def __init__(self):
self.number = randrange(100)+1
self.coun
"eShopping" wrote
Or use the Python wrapper around expect - pyexpect???
Alan G
Installed pexpect and rewrote the code to look like this:
Now I get these errors:
Traceback (most recent call last):
File "C:\Projects\Active\Alun\US_DOE_EOR\test_poly.py", line 1,
in -toplevel-
import p
"Randy Trahan" wrote
Attached is an error I cannot get to work, I was doing a print
concatenation
but it won't let me get past "+ "ibly impressive. " \
(then to next line)
You don;t appear to have a quote in front of the string - immediately
after the print statement?
BTW While that is OK a
"Tino Dai" wrote
>
>I know that this is a python group but you might want to try the open
> source utility called Expect. It does what you need it to do without
> having
> having to go through this trial and error process with subprocess.
> http://expect.nist.gov/
Or use the Python wrappe
23 matches
Mail list logo