> I thought that the '.py ' in this import statement would make the
> interpreter think that newline was a package and therefore try to
recognize
> py as a module in the newline package.
>
> from newline.py import newline
Quite right it should have been
from newline import mnewline!
oops, sorry
> I need to know how to run another module through one what is the
command do
> I have to include a path name and if there is any special way I have
to save
> the file
See my tutor for more info on modules and functions.
The short answer is that if you create a module
(ie a python file) and put
> I've written a class, with some methods. I then want to be able to
call
> the class repeatedly, to create some objects. The number of objects,
and
> some of their initialisation parameters need to be specified later
(i.e.
> at run-time).
Not quite sure what you mean by the last bit but I'll com
> Although I have never done so, I believe you can also
> store/manipulate objects in a database.
You can but its a lot slower than memory - but a lot more
scaleale too!
> Has anyone ever worked this option?
Yes, lots of times. In fact most large scale projects will
need to save objects to so
Have you looked at the ConfigParser module that was mentioned earlier
today?
Your file fits its format exactly...
But regular expressions can be used, try the intro in my tutorial,
or the excellent HowTo on the Python web site...
Alan G.
- Original Message -
From: "kumar s" <[EMAIL PRO
> I'm having trouble understanding the difference between eval and
exec.
eval evaluates an *expression* - that is something that returns a
value.
exec executes a piece of code, it need not return a value.
eval is slightly safer than exec (but not much).
Some examples:
print 'hello' # use exe
> I have some common data directories, like
>
> /home/dave/mygg/gg1.3/logs
> /home/dave/mygg/gg1.3/data
> /home/dave/mygg/gg1.3/datacore
> /home/dave/mygg/gg1.3/arch_data
>
> which increasing numbers of scripts are accessing.
have you considered making the root directory an environment variable?
T
> I am new to programming and so don't know "anything" much, yet.
> I am having problem with implementing a simple RPN calculator
> in python.
I'm not surprised. While an RPN vcalculator is one of the easier
calculators to build its not exactly trivial. It sounds like the
kind of thing an ambitiou
> then retrieve the data when run again. Basically, I'm trying to
simulate
> a simple address book (well not really for the datas are just names
for
> now)
I use an address book as an example program in the early stages of
my tutorial. The finished(well sort of) program is in the modules
& functio
> >myvars.value2 = 'Alan'
> >
> >
> >
> Never thought of setting 'myvars.value2 = 'Alan'' I guess this
would
> just set the variable in the myvars namespace since it could not
change
> myvars.py itself.
Absolutely correct and why I put the example in - but I forgot
to point out the hidden gotcha!
> This is continuation to my previous email with
> sugject line "Python regular expression". My text
> file although, looks like .ini file, but it is not. It
> is a chip definition file from Gene chip. it is a
> huge file with over 340,000 lines.
Thats big but by no means outragous, I have proc
> (and yes, there are some versions of cron for Windows -- I don't
know
> where they can be found, but I used one called nnCron Lite at my job
> this summer)
And on XP/Win2K you can use the 'at' command to schedule jobs.
The only case for sleep() is if you need to maintain context in
memory (maybe
> It must be cummulative error over 10s of thousands of seconds.
Just so, and depends on howm many other processes are running,
how busy the CPU is etc.
> bodge (& cron or at are better) but I suppose I could calculate
seconds
> to 8:05 sleep(seconds*0.95), re calculate secs to 8:05
sleep(seconds
> > And finally doesn't RPN put the operators first? Or is it me thats
> > getting confused fromtoo much Lisping recently?...
>
> Nope, RPN calculators (such as the HP48GX, IMHO the best calculator
> ever made) require you to input the operands first, then the
operators.
Yeah, you are right. I had
> dictionary of database instances, dbtables, keyed on table name,
> and I want a general way of creating variables with the name of
> the table so I'm not accessing the dictionary. Would something
> like this work:
>
> # dbtables is already built
> for table in dbtables.keys():
> exec("%s = dbta
> I was trying to eval("import %s" % something).
>
> exec("import %s" % something) works just fine and now I understand
why.
But much better to use the __import__() function for doing that
if possible... Or simply importing all the modules you might need
at the beginning, its not a big overhead...
> send more than 5 mails pr minute (spams) and if so, get Python to
send a
> warningmail to the mailmaster.
>
> How would I in the best way read the log?
Using the standard file methods...
> To open the file and close it
> every second sounds like a bad idea?
It would be but you don't need to, y
> Is there any function where I can specify to python
> buit-in function to select specific line (such as
> starting from segment: page 22 TO the next new line)
> instead of the whole lines until EOF.
> e.g.:
> a = readlines (From , TO )
Not quite, but you can do:
readlines()[from:to]
With the
> And I can't see the security problem, unless there's a security
> problem already, like if I allowed incoming email to dictate the
> parameters that I send through the socket. The email provides data
> for argv[1:] but argv[0] is hard-coded.
>
> And I don't see how web traffic can get there at a
> And how can __import__ be safer?
Safer because it is limited in what it can do, import a file.
The file must exist in the python path, so its much harder for
the user to do something bad - they have to create a new file
with malicious code in it and insert it into the python path
and then get th
> > - MS allows Outlook to run scripts when mail is open, if
> > those scripts are harmful we have a virus!
That is (was, they've improved it a lot) the number one cause
of script kiddie virii. Simply viewing a mail message in the
preview pane was enough to trigger a script. They have
improved s
> def selection_sort(lst,start,end):
> """sort the lst from selection start to end"""
> if len(lst)==1:
> return lst
> elif lst=="":
> return ""
> else:
> return lst[:start]+selection_sort(lst,start+1,end)
This doesn't appear to do any actual sorting?
And th
> the 2.3 line. It's *possible* that volunteers for 2.3.6 will
appear.
> That would be unprecedented, but not impossible ...
> end TP's post
>
> I ask here because I'm sure it's a newbie question. It's got me
wondering
> if Microsoft is still working on Windows 3.1.. ;
> Has anyone ever tried to send commands to a running interactive
python
> session from, say, the command line or another app?
This isn't too hard if you use stdin/stdout. But it does depend on
what you mean by send commands from the command line. If the process
is a daemon for example and it isn'
> I would like to create a python script that would function as
follows.
>
> ./script.py intpy
>
> Where the scipt setsup the comminication to 'intpy' which would be
an
> interactive python sessions (or some other interactive program).
OK, two steps back here I think.
Can you show us an imaginary
> I know I am wrong here because I do not know how to
> search and remove an element in a list. Can any one
> please help me.
This is what the filter function is for...
But you can use list comprehensions too:
[element for element in list if element not foo]
so in your case:
lst = f.readlines(
CC'd back to tutor list.
- Original Message -
From: "Vincent Nijs" <[EMAIL PROTECTED]>
To: "Alan Gauld" <[EMAIL PROTECTED]>
Sent: Tuesday, December 07, 2004 10:56 PM
Subject: Re: [Tutor] Connecting to interactive program
> Alan,
>
> So
> I'm trying to do this with the re module - the two tags looks like:
>
>
> ...
> a bunch of text (~1500 lines)
> ...
>
>
> I need to identify the first tag, and the second, and
unconditionally
> strip out everything in between those two tags, making it look like:
>
>
>
A very simp
> Note that SOME languages use () for call. There are other call
constructs,
> such as:
>
> DO function WITH parameters (FoxPro, similar in COBOL)
>
> function parameter or parameter1 function parameter2 (APL)
And in Smalltalk:
object message: parameter1 : parameter2 :
parameter3
Or as an ex
> Traceback:
>
> Line 39: seg=codeSt[element:endInd+len(endStr]
> MemoryError
>
> Hehe. Helpful, no?
Sometimes seeing the whole traceback gives clues as
to whats throwing the wobbly, without the full stack
its hard to tell.
However before worrying about that I'd add a print
statement to pri
> >>> out = open('sa_int_2.txt','w')
> >>> for ele1 in range(len(spot_cor)):
> x = spot_cor[ele1]
replace this with
for x in spot_cor:
> for ele2 in range(len(spot_int)):
> cols = split(spot_int[ele2],'\t')
and this with
for item in spot_int:
cols = split(item,'\t')
> y = (cols[0]+'\t'+col
> My trusty $10 Casio calculator tells me that the 3 cube roots of 1
are:
> 1, (-.5 +0.866025403j), and (-.5 -0.866025403j), or thereabouts. Is
there
> a way to do this in Python?
Sorry the power operation in Python will only return 1+0j
You need to dig out the math books and write a function
to
> When I run the script from my bash shell it creates the videodb
> database file, but when I run it from the browser it doesn't
> create no file whatsoever.
This is usually due to wrong file permissions.
The script runs under the web server and this usually
has restricted access for security rea
> Here is my code:
> >>> spot_cor=[]
> >>> for m in cor:
> ... cols = split(cor,'\t')
You are splitting the list not the item
cols = split(m, '\t')
Better to use a meaningful name too:
for line in cor:
would probably have made the mistake more obvious.
> However, when I trie
> Personally I am getting weary of a lot of requests that to me seem
to come
> from a lack of understanding of Python..
To be fair that is what the tutor list is for - learning Python.
> Would you be willing to take a good tutorial so you understand
> basic Python concepts and apply them to your
> I have a closed-source application which creates log files. I'd like
to
> capture this logfile data as it is crated, and do clever things with
it!
>
> Is this possible? I guess it must be, because there are "tail" type
> utilities for Windows...
Depends on whether the output goes to stdout or st
> Hey there. Does anyone know of a way to output PDFs with python? I
have some
> data that I have processed from a series of textfiles that I would
like to
> provide PDF format reports for..
I can't recall what its called but a couple of years ago I found a
module on the Parnassus site for proces
> I am trying to get the maximum value in a 2-D array. I can use max
but it
> returns the 1-D array that the max value is in and I then I need to
do max
> again on that array to get the single max value.
>
> There has to be a more straightforward way...I have just not found
it.
> I could also flat
> Are these "numerical approximation methods" pythonically possible?
>
Yes and that's how they are normally found - not necessarily with
Python,
but by applying computer simulations of the equations. Generally you
calculate values in ever decreasing increments until you get enough
accuracy. eg you
> I know how to limit google search results to a single site, but is
it
> possible to google just one section of a site?
Can't speak for Google but...
> I'd like to be able to search just the 2.4 tutorial,
> http://www.python.org/doc/2.4/tut/tut.html
> Possible? And if so, how to?
Have you trie
> def combination(items)
> list = []
> for i in range(0,len(items)):
>for j in range(0,len(items)):
for i in items:
for j in items:
Is both shorter and faster - no len() function calls.
Or if you want to use indices:
size = len(items) # only calculate once, it won
> everything was global, how you guys handle a modern structured
> language
Don't worry this is one of the hardest bad habits to break.
You are not alone. The easiest way is to just pass the data
from function to function in the function parameters. Its not
at all unusual for functions to have
> I far prefer the Brian's version, because it lets me set a single
> breakpoint while I'm debugging, and I can look at the return value
> before returning it,
In most debiggers(including Pythons) you can still do that
with a boolean condition provided the condition does not
itself contain a
> Having written this email, it has put my thoughts in order, though
it
> seems a bit cheaty, wouldn't defining all modules that have to
remember
> their internal state as classes be the best bet ?
Its one solution certainly, creeate objects and the objects carry
their state with them. But the pro
Are there any Polish speakers on the tutor list who would like
to check a new version of my tutorial? There are no formal links
to it yet as there are only a few pages but it can be found at:
http://www.freenetpages.co.uk/hp/alan.gauld/polish/
And any feedback can be sent to me and I'll forward
> For what it's worth, it seems to me to be perfectly normal to have
> classes that are only ever intended to have a single instance. For
> example, you're never likely to need more than one HTML parser, and
> yet htmllib.HTMLParser is a class...
That's true but the argument for a class in that c
> >1) batch oriented - each step of the process produces its own
> >output file or data structure and this gets picked up by the
> >next stage. Tis usually involved processing data in chunks
> >- writing the first dump after every 10th set of input say.
> >
> I see your point, like a static chain,
> I got some Tkinter related questions for a project that I'm making:
> 1. How to add an image to a button ?
I find the easiest way is to create an PhotoImage object attach
the graphic file(jpg,bmp,gif) to that and assign the PhotoImage
object to the Button.image property. You can "animate" the im
> That is, filename globbing doesn't seem to work. Looks like I'll
have to
> use map/filter to do this. Is there a better way?
It does if you use the glob module :-)
Python, with batteries included.
But sometimes finding the right battery can be challenging...
Alan G.
>
> Thanks,
> N
>
> --
>
> def getjlistrenderer(opname):
> def listrender():
> # use opname, eg ops=getlist(opname)
> # or set local fn variable
> return renderer;
> return listrender;
> #?or f=listrender(); return f;
>
> Is it really as simple as this?
Assuming your indentation is actually OK then yes, it is
as easy as
"Tim Goddard" wrote
I also figured out how to configure Eclipse IDE to recognize modules.
Apparently in the preferences for each 'project' is a separate
PYTHONPATH.. which is not to be confused with sys.path. Adding the
appropriate folders to the preferences allows the user to browse
through
ox.askyesno('a dialog','Add a directory?')
print(addDirectory)
print(theDirectory)
And the same here?
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
;the', 'time']
And if it's not separated by whitespace you can supply the
separator, eg a colon:
line.split(':')
For more sophisticated functionality use the re module or a
specialised parser.
--
Alan Gauld
Author of the Learn to Program web site
http:
parsing packages for
specific purposes such as XML/HTML, csv, configfile etc - or pyparsing
for more general purpose work. I did not mean to write a specialised parser
from scratch, although occasionally that may be needed but usually not.
--
Alan Gauld
Author of the Learn to Program we
"Make Twilight" wrote
I am confuse on the text above:
"If you use the 'from import' system, changes made to attrs of the
imported module /won't/ be seen by any other module that imported it.
If you do just an 'import' on a module (or 'import ... as ...'), then
changes made to attrs on the impor
y you could use -1 except of course -1 refers to the 'e'...
Its a slight anomoly due to the use of negative indexing. You
can do:
'abcde'[0:5]
and get the same as [0:]
But you cannot put any valid value for x in
'abcde[4 : x :-1]
that gets you the full string. You n
o as many chunks as start with
a line containing 'NEW'...
data = open().read()
for chunk in data.split('NEW'):
for line in chunk.split('\n'): # create lines out of the chunks - you
may not need this
# process lines till done
Just a thought.
"spir" wrote
But a third option is to use a split and apply it to the whole file as
a string thereby breaking the file into as many chunks as start with
a line containing 'NEW'...
Why not simply a regex pattern starting with "NEW" and ending with '\n'?
Because I understood the OP had to e
"Guilherme P. de Freitas" wrote
Here is my problem. I have two classes, 'Body' and 'Member', and some
attributes of 'Body' can be of type 'Member', but some may not. The
precise attributes that 'Body' has depend from instance to instance,
and they can be added or deleted. I need any instance o
"maxwell hansen" wrote
I have a decent amount of knowledge with QBASIC and am looking
for a tutor who can help me learn the pythonic equivalent of QBASIC
features and commands
The original version of my tutor was based on QBASIC and Python(v1.5!)
It might still be useful for comparisons. The
"Luhmann" wrote
I have only started using python after Py3 was released, so this is is
the only version I know. I have tried to make my code work in
Python 2 so I could use PIL,
This is one of the biggest barriers to adopting Python 3. Until PIL
gets ported it's a non starter for many fol
"Robert" wrote
I have read quite a bit in the past 2 months, ( I have also looked at
codes)
At this point, I think I understand well what __init__() is and does -
But, I have yet to see this *specifically* spelled out about the the
__init__ method for a Class;
It is OPTIONAL, correct ?
Yes
he answer is yes.
Where they would be different is if you were not in the same folder
as the module. Then the -m option would search the PYTHONPATH
whereas without -m I think it would not search for the module, you
would need to specify the location.
I think...
--
Alan Gauld
Author of the
'__ne__', '__new__',
'__reduce__', '__reduce_ex__', '__repr__', '__setattr__',
'__sizeof__', '__str__', '__subclasshook__', '__weakref__']
class Old: pass
dir(Old)
['__class__', '__d
"Robert" wrote
I have been wondering about this "New-style Class" subject along this
line:
so, *theoretically speaking*, in EXISTING, pre-P3K code,
if one changes everywhere where it's coded "class someClass()" to
"class someClass(object)",
it should not break the programs, right ?
More co
to run the
program multiple times to keep adding data.
out_file.write("name: ")
out_file.write(name)
out_file.write("\n")
You should join the strings together and write a full line out at once.
It will be more efficient and possibly more resilient too.
--
"Magnus Kriel" wrote
It might be that when you create a file for the first time with 'a', that
it
will through an exception. So you will have to try with 'w', and if there
is
an exception, you know the file does not exist and you will have to
create
the file for the first time with 'w'.
T
wrote
order to create an efficient and productive Python programming
workspace: IDE and Version Control.
Both important, although an IDE is perhaps a generous
description of vim! :-)
Obviously, no tool can think for you. The real programming work of
course is going on in your brain. I am c
"Matthew Lee" wrote
I usually just use NetBeans or the Python IDLE.
I prefer to use NetBeans because it's easier to change and modify code
and
test. And also because I like to use Jython.
Anything wrong with my setup?
If it works for you then its fine.
IDEs, editors etc are all very perso
"Kent Johnson" wrote
I use plain old RCS for version control because its just me working on
the
code.
hg init # create a repository
md RCS in rcs
hg st # show what will be checked in
hg add # mark new files as to be added
Don't need any of that stuff
hg ci -m "Initial checkin" # the
> >>> I use plain old RCS for version control because its just me working
>> I prefer RCS - two commands is all you need (ci/co) :-)
>
> Certainly, OTOH, you get only file based commits, no upgrade path
> should you ever decide that you need to go multiuser
> (and multiuser can be just you wit
r problem is we might be able to offer
a suggestion.
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
"katrin schmid" wrote
if the resulting .pyd is plattform dependent?
If i create one on windows would linux user need another one?
A Windows DLL will not work on Linux and a Linux library
will not work on Windows. You need one per OS.
Alan G.
__
"katrin schmid" wrote
and there is no portable way of distributing it?
I could tranlate the cpp code to python but its really lame
Native code is native code I'm afraid. You have to rebuild it for
every platform. Thats one reason interpreted languages are
becoming more popular because
"David Hutto" wrote
This is my first post to the list, so tell me if I'm posting incorrectly.
You are doing fine. Welcome.
My problem is when the results are printed, I get this:
>>>
('Variable 2,', 490.0, 'is greater than', 'Variable 2,', 8.0, '.')
The parentheses, as well as the apos
"Hugo Arts" wrote
print "this is {0}".format("formatted")
this is formatted
Caveat:
this style only works in Python 3.0 upwards (or maybe in 2.6/2.7?)
Alan G.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription option
program.
Since you are inside an infinite loop you should only break if you get an
uncaught exception which will generate a stack trace anyhow
That seems fair enough to me...
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
___
"Lie Ryan" wrote
and used print, I thought they would be considered the same whether as
a variable, or as a direct line, guess not.
what is equivalent:
print (a, b, c)
and
x = a, b, c
print x
both construct a tuple and prints a,b,c as tuple
Not quite:
a = 1
b = 2
c = 3
x = a,b,c
print
d of course any errors
you see - there will almost certainly be a few!
The direct link is
http://www.alan-g.me.uk/l2p/tutclass.htm
Regards,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
___
Tutor maillist - Tuto
a or a above c, because I get the error that the
value of the other is not known when I try to run the script.
Correct, you must find a way to order them such that the
dependencies are sorted out before assignment.
Take a look at the sections on variables and collections,
especially tuples, in
"spir" wrote
Lie's example actually was:
a,b,c = 1,2,3
print (a,b,c) # here parenthesized
(1, 2, 3)
Oops, I've been using Python 3 too much, I mentally blanked
out the parens!
Sorry about that.
Alan G.
___
Tutor maillist - Tutor@python.or
es.
words = get_word()
jumble = words[0]
originalword = words[1]
OR, use the neat Python trick of unpacking into two variables at
once, like this:
jumble,original_word = get_word()
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.al
"Neven Gorsic" wrote
Since May of 2009 there has not been any update and now web page is not
available any more ...
I'll be very surprised if the whole project is dead - its probably the
second
most used GUI for Python - but the web site does seem to be down.
FWIW The wxPython mailing list
socket has been read in the general
case.
I don;t know if you are using either a file read() or urlib.read()
but that may be the cause of the problem?
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_
>> set to a "reasonable" size. If you try to read more than that it
>> will be truncated. This is explained in the read() documentation
>> for files.
>
> ?? files have a buffer size that sets how much is read from the disk
> at once; I don't think it affects how much is read by file.read(). The
> d
e font could be backed with a different
file name)
It has nothing to do with the file name, the font size is all to do with
the
presentation application and any format data stored within the file.
eg in HTML it will be in a style attribute of the text
HTH,
--
Alan Gauld
Author of the Learn to P
tructures, logic coupling, cohesion, concurrency etc
These things do not change.
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.py
Forwarding since I assume this was meant to go
to either the list or the OP, rather than
just me...
Alan Gauld
Author of the Learn To Program website
http://www.alan-g.me.uk/
>
>- Forwarded Message
>From: Samuel de Champlain
>To: Alan Gauld
>Sent: Sunday, 31 Janu
"Ken G." wrote
In using Geany, I have the ability to complied a Python program. For
example, I can complied "program.py" to program.pyc."
You compile (note spelling) a python script everytime you import it
(if it has not already been compiled).
If you compile a new(or changed) script Python
ine.
(Only in the v2 tutor so far)
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
sing an error always send the full error message so that
we can read the stack trace etc. And post the code if possible too - at
the very least the function where the error occurs!
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
print search, ",", c,"Of your search was found"
else: print item, "was not found"
It might give you clues as to what you really want.
But using multiple lines is usually a good idea,
especially when trying to get it working. Its much easier to
see where t
lder
so that when I install a new Python and delete the old I
don't lose my code... And the PYTHONPATH variable
works with the new Python.
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
___
Tutor maillis
e ways,
but I don't see how your list of colon separated pairs is any better?
You still have the same issues to deal with - I think?
However, if you do want to pursue that route it would be better to save
the pairs as tuples rather than as x:y strings.
HTH,
--
Alan Gauld
Author of the Lear
"Serdar Tumgoren" wrote
was hoping that you all could help me "crowdsource" the issue. If you
have the time and inclination, could you look at the code and tell me
if and where I've gone wrong?
Not sure about the reported bugs but some comments:
What happens if
if value % 100/10 <> 1is fal
eyboard etc and builds a usabletext editor by the end.
Some of the very early Peter Norton books are good too, aimed at DOS
and the original IBM PC.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
___
Tutor maillist
"ssiverling" wrote
thing I was reading is that alot of the tutorials assume prior
programming
I just checked and Amazon have the Soul of CP/M still available second
hand for less than a dollar!
Gotta be a bargain!
OH, yes, If you want a free PC assembler you can use DOS debug.
Its still th
turn float(result_slope)
Or just
return float(y2-y1/x2-x1)
You might want to use a try/except to catch a zero division error too?
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
___
Tutor maillist - Tutor@pyt
Or just
return float(y2-y1/x2-x1)
>>
>>
>Alan why are you suggesting this, surely this will cause the decimal values to
>be truncated? Or does this somehow work differently in Python 3?
>
It would work different in v3 because / is no longer interger division.
However, I just
"Sander Sweers" wrote
On vr, 2010-02-05 at 20:39 +0000, ALAN GAULD wrote:
return float(x1-y1)/(x2-y2)
Does not work properly in version 2. Example is the 3rd doc test:
float((3-2)/(3-1)) gives 0.0 instead of 0.5.
That's what I did wrong dfirst time round, I had the pa
1 - 100 of 9948 matches
Mail list logo