While pdftk is awesome
http://www.accesspdf.com/pdftk/
I am looking for a Python solution.
Just for PDF page extraction.
Any hope?
Thanks,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
What's the standard replacement for the obsolete grep module?
Thanks,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
"hrh1818" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> There is a module named pymat avvailable from
> http://sourceforge.net/projects/pymat that provides a limited set of
> functions for intertfacing Python to Matlab.
I think that pymat was superceded by mlabwrap
http://mlabwrap
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote::
def grep(pattern, *files):
search = re.compile(pattern).search
for file in files:
for index, line in enumerate(open(file)):
if search(line):
print ":".join((file, str(index+1), line[:-1])
What's the good way to produce a cumulative sum?
E.g., given the list x,
cumx = x[:]
for i in range(1,len(x)):
cumx[i] = cumx[i]+cumx[i-1]
What's the better way?
Thanks,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> He seems to want scanl
Yes. But it's not in Python, right?
(I know about Keller's version.)
Robert Kern wrote:
> Define better. More accurate? Less code?
Good point.
As Bonono (?) suggested: I'd most like a solution that
relies on a
> Alan Isaac wrote:
>> Like SciPy's cumsum.
"Colin J. Williams" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Doesn't numarray handle this?
Sure.
One might say that numarray is in the process of becoming scipy.
But I was looking for a solution when these are available.
Something
"Duncan Booth" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> >>> aList = ['a', 1, 'b', 2, 'c', 3]
> >>> it = iter(aList)
> >>> zip(it, it)
> [('a', 1), ('b', 2), ('c', 3)]
That behavior is currently an accident.
http://sourceforge.net/tracker/?group_id=5470&atid=105470&func=detail
> Michael Spencer wrote:
> > This can be written more concisely as a generator:
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> If iterable has no elements, I believe the behaviour should be [init],
> there is also the case of init=None that needs to be handled.
Right. So it is "
"Michael Spencer" <[EMAIL PROTECTED]> wrote in message
news:mailman.1054.1132707811.18701.python-> This can be written more
concisely as a generator:
>
> >>> import operator
> >>> def ireduce(func, iterable, init):
> ... for i in iterable:
> ... init = func(init, i)
> ...
"Peter Otten" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> - allows arbitrary iterables, not sequences only
> - smaller memory footprint if sequential access to the items is sufficient
Sure; I meant aside from that.
> - fewer special cases, therefore
> - less error prone, e. g.
"Peter Otten" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Of course nothing can beat a plain old for loop in terms of readability
and
> -- most likely -- speed.
Here are two versions, meant to be comparable.
Thanks,
Alan Isaac
def cumreduce(func, seq, init = None):
cr = seq
"Peter Otten" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> You are in for a surprise here:
You got that right!
> >>> def empty():
> ... for item in []:
> ... yield item
> ...
> >>> bool(empty())
> True
Ouch.
> >>> bool(iter([]))
> True # python 2.3 and probably
"Peter Otten" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'd rather have a second look whether the test is really needed.
That's too obscure of a hint.
Can you be a bit more explicit?
Here's an example (below).
You're saying I think that most of it is unnecessary.
Thanks,
Alan
"Carl Waldbieser" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Does anyone know of any good examples for writing client side code to
upload
> files over a secure FTP connection?
http://trevp.net/tlslite/
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
"Peter Otten" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I think that the test for an empty iterator makes ireduce() unintuitive.
OK.
I misunderstood you point.
But that is needed to match the behavior of reduce.
>>> reduce(operator.add,[],42)
42
Thanks,
Alan
--
http://mail.
"Peter Otten" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> sufficiently similar
I think I understand your points now.
But I wanted to match these cases:
>>> import operator
>>> reduce(operator.add,[],42)
42
>>> reduce(operator.add,[1],42)
43
The idea is that the i-th yield of i
"Cameron Laird" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Jibes against the lambda-clingers lead eventually to serious
> questions of style in regard to variable namespacing,
> lifespan, cleanup, and so on:
>
http://groups.google.com/group/comp.lang.python/browse_th
>>> Jibes against the lambda-clingers lead eventually to serious
>>> questions of style in regard to variable namespacing,
>>> lifespan, cleanup, and so on:
>>>
http://groups.google.com/group/comp.lang.python/browse_thread/thread/ad0e15cb6b8f2c32/
Alan Isaac <[EMAIL PROTECTED]> wrote:
Yun Mao wrote:
>a[ [1,0], [0,1] ] , which should give me
>[[4, 5], [1,2]]
Numeric:
take(take(a,[1,0]),[0,1],1)
fwiw,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
I'm looking for Python code to extract files
from MS-TNEF attachments. (I'm aware
of the C code at http://tnef.sourceforge.net/ )
Thanks,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
Why don't tuples support an index method?
It seems natural enough ...
Thanks,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
"Ric Deez" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have a list:
> L1 = [1,1,1,2,2,3]
> How can I easily turn this into a list of tuples where the first element
> is the list element and the second is the number of times it occurs in
> the list (I think that this is referred
"niXin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Can anyone direct me to where I can find free software to do the
following:
> Document Management Software
> ---
> 1. Written in PHP or Python
> 2. scanning feature - where I can scan a document
http://
Newbie question:
I have been generally open to the proposal that list comprehensions
should replace 'map', but I ran into a need for something like
map(None,x,y)
when len(x)>len(y). I cannot it seems use 'zip' because I'll lose
info from x. How do I do this as a list comprehension? (Or,
more gen
Why is a MultiFile object not an iterator?
For example if
mfp = multifile.MultiFile(fp)I cannot dofor line in mfp:
do_somethingRelated:MultiFile.next seems badly named.(Something like
next_section would be better.)Is this just historical accident or am I
missing the point?Thanks,Alan Isaac
--
ht
I am looking for a pure Python secure ftp solution.
Does it exist?
I would have thought that the existence of OpenSSL
would imply "yes" but I cannot find anything.
ftplib does not seem to provide any secure services.
I know about fptutil
http://codespeak.net/mailman/listinfo/ftputil
but that doe
"Eric Nieuwland" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Do you want SFTP or FTP/S?
The latter.
> I'm having a look at FTP/S right now. That's a little
> more complicated, but it seems doable.
> If I succeed, I guess I'll donate the stuff as an extension to ftplib.
Great!
> David Isaac wrote:
> > I am looking for a pure Python secure ftp solution.
> > Does it exist?
"Andrew MacIntyre" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I recall coming across an extension package (pretty sure it wasn't pure
> Pyt
"Alan Isaac" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> http://www.lag.net/paramiko/
> However it requires the PyCrypto module.
> http://www.amk.ca/python/code/crypto
>
> Can you briefly outline how to use this as a client
> to upload and down files from a server using SFTP?
OK
"Talin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I wanted to share
> this: a generator which returns all permutations of a list:
Try this instead:
def permuteg(lst): return ([lst[i]]+x
for i in range(len(lst))
for x in permute(lst[:i]+lst[i+1:])) \
or [[]
"Casey Hawthorne" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> It's hard to make "complete" permutation generators, Knuth has a whole
> fascicle on it - "The Art of Computer Programming - Volume 4 Fascicle
> 2 - Generating All Tuples and Permutations" - 2005
Can you elaborate a
"Eric Nieuwland" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm having a look at FTP/S right now. That's a little
> more complicated, but it seems doable.
> If I succeed, I guess I'll donate the stuff as an extension to ftplib.
Just found this:
http://trevp.net/tlslite/
I haven
> > http://www.lag.net/paramiko/
"Alan Isaac" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> sock.settimeout(20)
> sock.connect((hostname, port))
> my_t = paramiko.Transport(sock)
> my_t.connect(hostkey=None ,username=userna
"Nick Coghlan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Using zip(*[iter(l)]*N) or zip(*(iter(l),)*N) simply extends the above to
the
> general case.
Clearly true.
But can you please go into much more detail for a newbie?
I see that [iter(l)]*N produces an N element list with
> Alan Isaac wrote:
> > I see that [iter(l)]*N produces an N element list with each element
being
> > the same iterator object, but after that
> > http://www.python.org/doc/2.3.5/lib/built-in-funcs.html
> > just didn't get me there.
"Nick Coghlan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL P
"Scott David Daniels" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]:
> Numarray is the future, Numeric is the "past",
This statement is not obviously true.
See the recent discussion on the developer lists.
(Search for Numeric3.)
Alan Isaac
--
http://mail.python.org/mailman/listin
"Nick Coghlan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> A bug report on Sourceforge would help in getting the problem fixed for
the 2.5
> docs
Done.
> For the 'left-to-right' evaluation thing, that's technically an
implementation
> artifact of the CPython implementation, si
I'd like to try personal financial management using Python.
I just found PyCheckbook, but it does not support check printing.
Is there a Python check printing application kicking around?
Thanks,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
"Alan Isaac" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'd like to try personal financial management using Python.
> I just found PyCheckbook, but it does not support check printing.
> Is there a Python check printing application kicking around?
OK, I'll assume silence means "
"Alan Isaac" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'd like to try personal financial management using Python.
> I just found PyCheckbook, but it does not support check printing.
> Is there a Python check printing application kicking around?
OK, I'll assume silence means "
> Alan Isaac wrote:
> > What is the current best practice for cross platform printing of
PostScript
> > files from Python?
"Warren Postma" <[EMAIL PROTECTED]> wrote in
message news:[EMAIL PROTECTED]
> Well since printing postscript files on most Unix systems (probably
> including Mac OSX although
I'm looking for a Python script to repair the mbx header
for a mail file where only the header is corrupted.
Thanks,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
"Donn Cave" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> All mbx files start with a 2048 byte
> header, and a valid header can be copied to another
> file and still be valid. For example, if the damaged
> file still has 2048 bytes of header,
>
>1. Find or create another mbx
"phil" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Using Tkinter Canvas to teach High School Geometry
> with A LOT of success.
Can you post a link to your code.
I'd like to see what you are doing.
Thx,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
I'm looking for the Python equivalent of the perl script and module
described at
http://comments.gmane.org/gmane.mail.imap.uw.c-client/707
Any hope?
Thanks,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
> Alan Isaac wrote:
> >>> #evaluate polynomial (coefs) at x using Horner's rule
> >>> def horner(coefs,x): return reduce(lambda a1,a2: a1*x+a2,coefs)
> > It just cannot get simpler or more expressive.
"Peter Otten" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> But is it correct?
"Chris Mellon" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> As someone who does a tremendous amount of event-driven GUI
> programming, I'd like to take a moment to speak out against people
> using us as a testament to the virtues of lamda. Event handlers are
> the most important
Suppose I have inherited the structure
PackageFolder/
__init__.py
mod1.py
mod2.py
SubPackageFolder/
__init__.py
mod3.py
and mod3.py should really use a function in mod2.py.
*Prior* to Python 2.5, what is the best way to access that?
(Please assu
Simon Forman wrote:
> I would assume (but I haven't checked) that this should work as long as
> delmepy (in your case PackageFolder) was somewhere on sys.path.
Sorry that was not clear:
I do not want to make any assumptions about
this particular package being on sys.path.
(I want a relative import
Alan wrote:
> I do not want to make any assumptions about
> this particular package being on sys.path.
> (I want a relative import, but cannot assume 2.5.)
I should mention that to get around this I have
been using
sys.path.append(os.path.split(sys.argv[0])[0])
in the script I care most about. I
Suppose I have inherited the structure
PackageFolder/
__init__.py
mod1.py
SubPackageFolder/
__init__.py
mod2.py
mod3.py
When mod1 is run as a script,
I desire to import either mod2 or mod3 but not both
conditional on an option detected b
I have a subclass of dict where __getitem__ returns None rather than
raising KeyError for missing keys. (The why of that is not important for
this question.)
I was delighted to find that __contains__ still works as before
after overriding __getitem__.So even though instance['key']
does not ra
> Alan Isaac wrote:
> > I have a subclass of dict where __getitem__ returns None rather than
> > raising KeyError for missing keys. (The why of that is not important
for
> > this question.)
"Bruno Desthuilliers" <[EMAIL PROTECTED]> wrote:
> Well, actually it may be important... What's so wrong wi
"Daniel Mark" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I want to draw some shapes, such as lines, circles on an image.
http://www.pythonware.com/library/pil/handbook/psdraw.htm
hth,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
http://www.american.edu/econ/notes/soft.htm#EDITORS
has some relevant discussion and suggestions.
Cheers,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
Is it expected for access to set elements to be much
slower than access to list elements? Explanation?
Thanks,
Alan Isaac
>>> t1=timeit.Timer("for i in set(xrange(1)):pass","")
>>> t2=timeit.Timer("for i in list(xrange(1)):pass","")
>>> t1.timeit(1000)
9.806250235714316
>>> t2.timeit(1000
> Alan Isaac wrote:
> > The current situation is: use a loop because the obvious generator
> > approach is not efficient.
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "not efficient" compared to what ?
I already guess that I've missed your point, but to prove it
Paul M. wrote:
> Random access to item in list/set when item exists
> set -> 0.000241650824337
> list -> 0.0245168031132
>
> Random access to item in list/set when item does not exist
> set -> 0.000187733357172
> list -> 0.522086186932
OK, that's a much better set of answers
including to questi
I have not seen this posted and I kind of like it.
Shared for entertainment value only.
Alan Isaac
PS Easily adapted if the residual
group is not desired.
def groupsofsize(iterable,size):
itr = iter(iterable)
c=count()
for k,it in groupby(itr,lambda x:c.next()//size):
yield tup
Instances of MyClass have a method that
returns another instance. Ignoring the details
of why I might wish to do this, I could
return MyClass()
or
return self.__class__()
I like that latter better. Should I?
Should I do something else altogether?
Thanks,
Alan Isaac
--
http://mail.python.org/
Bruno wrote:
> This is usually known as a 'factory method'. You do realise that both
solutions are *not* strictky equilavent, do you?
Your point I believe is that after inheritance the factory method
in the subclass will still
return MyClass()
but will return an instance of the subclass if I
retu
>>> y
[116, 114, 121, 32, 116, 104, 105, 115]
>>> z=''.join(chr(yi) for yi in y)
>>> z
'try this'
What is an efficient way to do this if y is much longer?
(A numpy solution is fine.)
Thanks,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
Robert Kern wrote:
>>> from numpy import *
>>> y = [116, 114, 121, 32, 116, 104, 105, 115]
>>> a = array(y, dtype=uint8)
>>> z = a.tostring()
>>> z
'try this'
Very nice! Thanks also to Paul and Travis!
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
1. Why is there no argmax built-in?
(This would return the index of the largest element in a sequence.)
2. Is this a good argmax (as long as I know the iterable is finite)?
def argmax(iterable): return max(izip( iterable, count() ))[1]
3. If this is the only place in a module where I need count a
Thanks for all the replies.
A couple of comments.
1. I think the usefulness of an argmax built-in can be assessed
by looking at other languages (and e.g. at numpy). So I do not
buy the "not needed" argument as presented. More like "haven't
got around to it," I'm thinking.
2. The particular use
"Boris Borcic" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> after a while trying to find the legal manner to file numpy bug reports,
> since it's a simple one, I thought maybe a first step is to describe the
bug
> here. Then maybe someone will direct me to the right channel.
>
> So
I am just starting to think about image processing.
What are the overlaps and differences in intended
functionality between FreeImagePy and PIL?
Thanks,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
"vasudevram" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> http://sourceforge.net/projects/xtopdf
Serendipity:
I was just looking for this functionality.
Thanks!
So here is an idea for a great enhancement:
rst -> PDF
The good news: the project is all Python,
so you will only have
> Em Sex, 2006-06-09 às 12:30 -0400, Alan Isaac escreveu:
> > It's your code, so you get to license it.
> > But if you wish to solicit patches,
> > a more Pythonic license is IMHO more likely
> > to prove fruitful.
"Felipe Almeida Lessa" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED
"Johann C. Rocholl" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> What license would you suggest?
I recommend that you choose the license that will best achieve
your long run goals for the code. As I understand them, and
as I understand your application and software development,
"Rob Cowie" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> alpha = ['a','b','c','d'] #shortened for brevity
> alpha2 = ['a','b','c','d']
> alpha3 = ['a','b','c','d']
>
> def generator():
> for char in alpha:
> for char2 in alpha2:
> for char3 in alpha3:
> yield c
alpha = string.lowercase
x=(a+b+c for a in alpha for b in alpha for c in alpha)
--
http://mail.python.org/mailman/listinfo/python-list
> > (I was using *small* integers).
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote:
> "small integers" is what the phrase "small integers" in the "small
> integers" and "small integers" parts of my reply referred too, of course.
But aren't "*small* integers" likely to be smaller than "small integers
To access the doc string of a property,
I have to use the class not an instance.
Why?
Thanks,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
Somewhat OT:
Just wondering if anyone is doing something cool
with the Python support in Mahogany mail.
If so, please describe it or post some code.
Thanks,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
"Jacob Hallen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Unfortunately there is a side effect to slots. They change the behaviour
of
> the objects that have slots in a way that can be abused by control freaks
> and static typing weenies. This is bad, because the contol freaks s
I'm aware of
http://cheeseshop.python.org/pypi/pytnef/
but it uses the tnef utility, and I'd like a pure Python solution
(along the lines of http://www.freeutils.net/source/jtnef/ ).
Is there one?
Thanks,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
When I create an instance of a class,
are the class's functions *copied* to create the methods?
Or are method calls actually calls of the class's functions?
I am sure this is both obvious and FAQ,
but I did not find a clear answer
(e.g. here
http://docs.python.org/tut/node11.html#SECTION001134
I have a list of lists, N+1 deep.
Like this (for N=2):
[[['r00','g00','b00'],['r01','g01','b01']],[['r10','g10','b10'],['r11','g11'
,'b11']]]
I want to efficiently produce the same structure
except that the utlimate lists are replaced by a chosen (by index) item.
E.g.,
[['r00','r01'],['r10','r11']
> Alan Isaac wrote:
> > When I create an instance of a class,
> > are the class's functions *copied* to create the methods?
> > Or are method calls actually calls of the class's functions?
"Diez B. Roggisch" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On the class functions. You
Thanks to both Roberto and George.
I had considered the recursive solution
but was worried about its efficiency.
I had not seen how to implement the numpy
solution, which looks pretty nice.
Thanks!
Alan
--
http://mail.python.org/mailman/listinfo/python-list
> Alan Isaac wrote:
> > are method calls actually calls of the class's functions?
"Bruno Desthuilliers" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Depends on how the method was associated to the instance (you can set
> methods on a per-instance property), but in the general case
Suppose a class has properties and I want to change the
setter in a derived class. If the base class is mine, I can do this:
http://www.kylev.com/2004/10/13/fun-with-python-properties/
Should I? (I.e., is that a good solution?)
And what if I cannot change the base class?
How to proceed then?
Than
Le mercredi 06 septembre 2006 16:33, Alan Isaac a écrit :
>> Suppose a class has properties and I want to change the
>> setter in a derived class. If the base class is mine, I can do this:
>> http://www.kylev.com/2004/10/13/fun-with-python-properties/
>> Should I? (I.e., is that a good solution?)
I have no experience with database applications.
This database will likely hold only a few hundred items,
including both textfiles and binary files.
I would like a pure Python solution to the extent reasonable.
Suggestions?
Thank you,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/pyth
Thanks to all for the suggestions and much else
to think about.
Summarizing:
Those who were willing to consider a database suggested:
anydbm
Gadfly
SQLite (included with Python 2.5)
Schevo
Some preferred using the file system.
The core suggestion was to choose a directory structure
along with sp
Suppose x and y are ints in moduleA.
If I put
from __future__ import division
in moduleA then x/y will produce the truediv result.
If I put
from __future__ import division
in moduleB
and
from moduleB import *
in module A
then x/y will NOT produce the truediv result
(in moduleA).
Why?
And is ther
> Alan Isaac wrote:
> > Suppose x and y are ints in moduleA.
> >
> > If I put
> > from __future__ import division
> > in moduleA then x/y will produce the truediv result.
> >
> > If I put
> > from __future__ import division
> > in moduleB
> > and
> > from moduleB import *
> > in module A
> > then x
Where does one get the
"What's New" document for Python 2.5?
http://docs.python.org/dev/whatsnew/whatsnew25.html
pretends to hold it, but the links are corrupt.
Thanks,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
"Alan Isaac" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Where does one get the
> "What's New" document for Python 2.5?
> http://docs.python.org/dev/whatsnew/whatsnew25.html
> pretends to hold it, but the links are corrupt.
OK, here it is:
http://docs.python.org/whatsnew/whatsn
This is important for my move to Python 2.5,
so I thought others might want to know...
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
Does George's example raise the question:
why do dictionaries not implement efficient creation
for two common cases?
- Making a dict from two sequences of the same length.
- Making a dict from a sequence and a function
(as in George's example in this thread).
The current situation is:
use a loo
I would like to be able to define a loop statement
(nevermind why) so that I can write something like
loop 10:
do_something
instead of
for i in range(10):
do_something
Possible? If so, how?
Thanks,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
> Alan Isaac wrote:
> > I would like to be able to define a loop statement
> > (nevermind why) so that I can write something like
> >
> > loop 10:
> > do_something
> >
> > instead of
> >
> > for i in range(10):
> > do_something
> >
> > Possible? If so, how?
"Jeffrey Schwab" <[EMAIL PROT
"Benji York" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Here's a flagrant hack:
Admiration wins out over revulsion. ;-)
Thanks,
Alan Isaac
PS Here's the motivation. Python closely resembles pseudocode. With
a very little LaTeX hacking, it is often possible to write algorith
"Laszlo Zsolt Nagy" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I would like to use a numerical solver for a specific problem.
Another possibility:
http://nlpy.sourceforge.net/
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
Default parameter values are evaluated once when the function definition is
executed.
Where are they stored? (A guess: in a dictionary local to the function.)
Where is this documented?
As a Python newbie I found this behavior quite surprising.
Is it common in many other languages?
Is it unsurpris
Alan Isaac wrote:
> Default parameter values are evaluated once when the function definition
is
> executed. Where are they stored? ... Where is this documented?
Forgive any poor phrasing: I'm not a computer science type.
At http://www.network-theory.co.uk/docs/pytut/tut_26.html we read:
"The execu
Alan Isaac wrote:
> Default parameter values are
> evaluated once when the function definition is
> executed. Where are they stored? ... Where is this documented?
Forgive any poor phrasing: I'm not a computer science type.
At http://www.network-theory.co.uk/docs/pytut/tut_26.html we read:
"The exe
1 - 100 of 113 matches
Mail list logo