Gerard Flanagan <[EMAIL PROTECTED]> wrote:
...
> a = [ '+', 'tag1', '+', 'tag2', '-', 'tag3', '+', 'tag4' ]
>
> import itertools
>
> b = list(itertools.islice(a,0,8,2))
> c = list(itertools.islice(a,1,8,2))
Much as I love itertools, this specific task would be best expressed ad
b = a[::2]
c
[EMAIL PROTECTED] a écrit :
> Hi,
>
> I read the mod_python documentation on the Django site but I'm getting
> this error:
>
> EnvironmentError: Could not import DJANGO_SETTINGS_MODULE
> 'accesshiphop.settings' (is it on sys.path?): No module named
> accesshiphop.settings
>
> Here's my httpd.con
"vbgunz" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello all,
>
> I am just learning Python and have come across something I feel might
> be a bug.
I feel it is more likely that there in a bug in the communication process
from the manual to you, on an admittedly somewhat con
> def cran_rand(min,max):
You're shadowing built-ins here. Not a problem, but something I'd generally
avoid.
>if(min>max):
>x=max
>max=min
>min=x
If the args were a,b you could say:
maxarg,minarg = min(a,b),max(a,b)
>range=round(log(max-min)/log(256))
more
James Stroud wrote:
> Gerard Flanagan wrote:
> > Rob Cowie wrote:
> >
> >>I'm having a bit of trouble with this so any help would be gratefully
> >>recieved...
> >>
> >>After splitting up a url I have a string of the form
> >>'tag1+tag2+tag3-tag4', or '-tag1-tag2' etc. The first tag will only be
>
Alex Martelli wrote:
> Gerard Flanagan <[EMAIL PROTECTED]> wrote:
> ...
> > a = [ '+', 'tag1', '+', 'tag2', '-', 'tag3', '+', 'tag4' ]
> >
> > import itertools
> >
> > b = list(itertools.islice(a,0,8,2))
> > c = list(itertools.islice(a,1,8,2))
>
> Much as I love itertools, this specific task wo
Hi Alex
[...]
> The trick about distinguishing a name's exact nature based on whether
> the compiler sees an assignment to that name in some part of code is
> found in both languages, albeit in different ways. In Ruby, as you've
> pointed out, it's the heuristic used to disambiguate local variabl
"Rob Cowie" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm having a bit of trouble with this so any help would be gratefully
> recieved...
>
> After splitting up a url I have a string of the form
> 'tag1+tag2+tag3-tag4', or '-tag1-tag2' etc. The first tag will only be
> preceeded
First of all, please don't flame me immediately. I did browse archives
and didn't see any solution to my problem.
Assume I want to add a method to an object at runtime. Yes, to an
object, not a class - because changing a class would have global
effects and I want to alter a particular object only.
[EMAIL PROTECTED] wrote:
> First of all, please don't flame me immediately. I did browse archives
> and didn't see any solution to my problem.
>
> Assume I want to add a method to an object at runtime. Yes, to an
> object, not a class - because changing a class would have global
> effects and I wa
Gerard Flanagan a écrit :
> Alex Martelli wrote:
>
>>Gerard Flanagan <[EMAIL PROTECTED]> wrote:
>>...
>>
>>>a = [ '+', 'tag1', '+', 'tag2', '-', 'tag3', '+', 'tag4' ]
>>>
>>>import itertools
>>>
>>>b = list(itertools.islice(a,0,8,2))
>>>c = list(itertools.islice(a,1,8,2))
>>
>>Much as I love i
Francois wrote:
> I discovered Python a few months ago and soon decided to invest time in
> learning it well. While surfing the net for Python, I also saw the hype
> over Ruby and tried to find out more about it, before I definitely
> embarked on studying and practicing Python. I recently found two
I was reading over some python code recently, and I saw something like
this:
contents = open(file).read()
And of course you can also do:
open(file, "w").write(obj)
Why do they no close the files? Is this sloppy programming or is the
file automatically closed when the reference is destroyed (aft
Sandra-24 wrote:
> I was reading over some python code recently, and I saw something like
> this:
>
> contents = open(file).read()
>
> And of course you can also do:
>
> open(file, "w").write(obj)
>
> Why do they no close the files? Is this sloppy programming or is the
> file automatically clos
Sandra-24 wrote:
> I was reading over some python code recently, and I saw something like
> this:
>
> contents = open(file).read()
>
> And of course you can also do:
>
> open(file, "w").write(obj)
>
> Why do they no close the files? Is this sloppy programming or is the
> file automatically clos
On Mar 5, 2006, at 2:30 PM, Marek wrote:
> Assume I want to add a method to an object at runtime. Yes, to an
> object, not a class - because changing a class would have global
> effects and I want to alter a particular object only. The following
> approach fails:
>
> class kla:
> x = 1
>
> de
Marcin Mielżyński wrote:
> Sandra-24 wrote:
>> I was reading over some python code recently, and I saw something like
>> this:
>>
>> contents = open(file).read()
>>
>> And of course you can also do:
>>
>> open(file, "w").write(obj)
>>
>> Why do they no close the files? Is this sloppy programming or
On Mar 5, 2006, at 1:01 AM, sam wrote:David Treadwell wrote: exp(x) is implemented by:1. reducing x into the range |r| <= 0.5 * ln(2), such that x = k *ln(2) + r2. approximating exp(r) with a fifth-order polynomial,3. re-scaling by multiplying by 2^k: exp(x) = 2^k * exp(r)sinh(x) is mathematica
On Sat, 4 Mar 2006 13:08:35 -0500, "Peter Decker" <[EMAIL PROTECTED]>
wrote:
>On 3/4/06, Bill Maxwell <[EMAIL PROTECTED]> wrote:
>
>> Dabo does look really nice, but seems like it has a ways to go yet.
>>
>> I downloaded it a couple of weeks ago, and the very first thing I wanted
>> to do doesn't
Sandra-24 a écrit :
> I was reading over some python code recently, and I saw something like
> this:
>
> contents = open(file).read()
>
> And of course you can also do:
>
> open(file, "w").write(obj)
>
> Why do they no close the files? Is this sloppy programming or is the
> file automatically c
Hm this doesn't work. Say I have the following directory structure:
A
|--- util
||--- foo.py
|
|--- B
|--- bar.py
And bar.py has this line
from util import foo
I then run
python B/bar.py
in directory A. Still got error
ImportError: No module named util
A check of sys.path in bar
Dennis Lee Bieber wrote:
> > 1. Can python do "pass by reference"? Are datastructures represented by
> > references as in Java (I don't know yet).
> >
> Everything in Python is a reference to an object. I think the
> question you want is more on the lines of: Can I change an object that
> ha
Good idea about the max and min values. Yes, urandom is os.urandom.
s2num('blah') will convert the phrase blah to ascii, and treat them as
if they were a big function.
Anyone else whose still interested, I found another small bug, but it
was in the modular (Again). It won't do much, but...
I did
Rob Cowie wrote:
> I'm having a bit of trouble with this so any help would be gratefully
> recieved...
>
> After splitting up a url I have a string of the form
> 'tag1+tag2+tag3-tag4', or '-tag1-tag2' etc. The first tag will only be
> preceeded by an operator if it is a '-', if it is preceded by n
> First there are a few things I don't like:
Hi, I will respond to things that others haven't responded yet
> 2. How good is matplotlib/pylab? I tried to install it but only get
> error messages so I haven't tested it. But plotting capabilities is
> really major issue.
I don't know because I hav
[EMAIL PROTECTED] a écrit :
> First of all, please don't flame me immediately.
Granted - we'll do it later then !-)
> I did browse archives
> and didn't see any solution to my problem.
>
> Assume I want to add a method to an object at runtime. Yes, to an
> object, not a class - because changing
fortepianissimo wrote:
> Hm this doesn't work. Say I have the following directory structure:
> A
> |--- util
> ||--- foo.py
> |
> |--- B
> |--- bar.py
>
> And bar.py has this line
>
> from util import foo
>
> I then run
>
> python B/bar.py
>
> in directory A. Still got er
Robert Kern wrote:
>> I usually use:
>>
>> try:
>> f = open(file)
>> contents = f.read()
>> finally:
>> f.close()
>>
>> But now I am wondering if that is the same thing. Which method would
>> you rather use? Why?
>
> Just keep doing what you are doing, please.
Note quite. The assignment
Erik Max Francis wrote:
> Robert Kern wrote:
>
>>>I usually use:
>>>
>>>try:
>>> f = open(file)
>>> contents = f.read()
>>>finally:
>>> f.close()
>>>
>>>But now I am wondering if that is the same thing. Which method would
>>>you rather use? Why?
>>
>>Just keep doing what you are doing, please.
I'll just play the devil's advocate here
Francois wrote:
> 1) In Ruby there is a risk of "Variable/Method Ambiguity" when calling
> a method with no parameters without using () :
>
Yes, but that's in my opinion a programmer error, not necessarily a
language error.
> 2) Ruby does not have true f
"Schüle Daniel" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>> block (Python forbids the rebinding of variables coming from an
>> enclosing but non-global scope, to avoid facing this issue).
>
> I am not sure what you mean here
> can you elaborate on this please
>
> >>> def a():
>
On 3/5/06, Bill Maxwell <[EMAIL PROTECTED]> wrote:
> Thanks for the info. Knowing that, I was able to create a simple app in
> the Dabo Designer that contains a Notebook.
>
> But, I'm having a heck of a time finding any documentation at all on
> Dabo. I looked all thru the website(s), and have c
fortepianissimo wrote:
> Hm this doesn't work. Say I have the following directory structure:
>
> A
> |--- util
> ||--- foo.py
> |
> |--- B
> |--- bar.py
>
>
> And bar.py has this line
>
> from util import foo
This would only work with A in sys.path/PYTHONPATH. However...
> I then run
>
>
Sandra-24 wrote:
> I was reading over some python code recently, and I saw something like
> this:
>
> contents = open(file).read()
>
> And of course you can also do:
>
> open(file, "w").write(obj)
>
> Why do they no close the files? Is this sloppy programming or is the
> file automatically clos
Robert Kern <[EMAIL PROTECTED]> wrote:
...
> > just a toy. And as Matlab's run-time does reference counting insted of
> > proper garbage collection, any datastructure more complex than arrays
> > are sure to leak memory (I believe Python also suffered from this as
> > some point).
>
> Python st
Xavier Morel <[EMAIL PROTECTED]> wrote:
> Francois wrote:
> > 1) In Ruby there is a risk of "Variable/Method Ambiguity" when calling
> > a method with no parameters without using () :
> >
> Yes, but that's in my opinion a programmer error, not necessarily a
> language error.
In Python, you can
hi;
say i have a text file with a string ( say '(XYZ)') and I want to find
the number of line where this string has occured. What is the best way
to do that?
what about if that string was say a 0 with leading and trailing white
spaces, would that be any different?
thanks
moe smadi
--
http://m
Interesting - Python seems to act differently under Windows then. Here
I'm using Python 2.4 on Mac OS X. With all of the files, directories
and command exactly like yours, it's still not working.
One thing I noticed is that you have this 'C:\\WUTemp\\A' when you
print sys.path in B/bar.py, but min
M.N.A.Smadi wrote:
> hi;
> say i have a text file with a string ( say '(XYZ)') and I want to find
> the number of line where this string has occured. What is the best way
> to do that?
>
> what about if that string was say a 0 with leading and trailing white
> spaces, would that be any differen
M.N.A.Smadi wrote:
> hi;
> say i have a text file with a string ( say '(XYZ)') and I want to find
> the number of line where this string has occured. What is the best way
> to do that?
>
> what about if that string was say a 0 with leading and trailing white
> spaces, would that be any differen
> hi;
> say i have a text file with a string ( say '(XYZ)') and I want to find
> the number of line where this string has occured. What is the best way
> to do that?
I would suggest:
# Read file contents
lines = file('filename.txt').readlines()
# Extract first line number containing 'XYZ' string
Tuvas wrote:
[...]
> Actually, I did another test, and realized that it was indeed a bug in
> the code. Yikes. Oh well, thanks for the help in identifying it!
>
> An example that would be alot easier is this:
>
Mod(16,561).is_strong_pseudo_prime()
>
> True
Hmmm...my M-R tester disagrees...
Paul Boddie wrote:
> fortepianissimo wrote:
> > Hm this doesn't work. Say I have the following directory structure:
> >
> > A
> > |--- util
> > ||--- foo.py
> > |
> > |--- B
> > |--- bar.py
> >
> >
> > And bar.py has this line
> >
> > from util import foo
>
> This would only work with A in
Paul Boddie wrote:
> Yes, Python does this - it puts the directory of bar.py (B in this
> case) in sys.path, but not the directory in which you're sitting when
> you run the program from the shell (A in this case).
This seems to be OS dependent. If I put 'print sys.path' at the start of
site.py (
sturlamolden wrote:
> Robert Kern wrote:
>
>
>>And you need to ask why Python is a better Matlab than Matlab?
>
>
>
> First there are a few things I don't like:
>
> 1. Intendation as a part of the syntax, really annoying.
>
Troll. You think this is going away because *you* don't like it? Am
Frank Millman wrote:
[...]
> There is a server component and a client component. All the business
> logic is performed on the server.
Oh, what a give-away. If the logic is in the server, then the
client component should probably be the user's chosen web browser.
> The client communicates with
[EMAIL PROTECTED] wrote:
> Hi,
>
> thanks for the reply. I was not aware of this in raw strings (and
> frankly, don't like it... but who cares about that :-) )
>
Healthy attitude!
> When I needed embedded quotes in a raw string I went the triple quote
> route:
>
> a = r'''check \' this'''
>
>
Ahh, I see, I missed doing the last step in my M-R test. Hmmm. Well,
got that one fixed now, time for a new release I guess. Sigh. I do seem
to be going through them rather quickly...
--
http://mail.python.org/mailman/listinfo/python-list
Okay, now I get the correct number of 561 pseudoprimes, 5, so I can
assume that it is indeed working right. Whew. Thanks for the help on
that one. Now, I only wish I could change the answer to my last
homework assignment... Oh well.
--
http://mail.python.org/mailman/listinfo/python-list
>Alas, somebody will now quote Emerson at you, I fear;-).
Let them come :-)
I almost always see this (mis)quoted as:
"consistency is the hobgoblin of little minds"
which is not really what Emerson said. The full quote is:
"A foolish consistency is the hobgoblin of little minds"
I would say t
1) indentation:
I claim that this is a trivial matter. Indentation is enforced, but if
you want to end all your blocks with #end, feel free.
Or write a preprocessor to go from your preferred block style to
python's
2) self.something tedious to look at.
Again, you can somewhat work around this i
hi
am using Tix notebook and i have two frames in that. am adding some
widgets in to both of the frames. now i want to delete all of the
widgets in one of the frame. i dont want to delete the frame, but its
childres.
so how can i get the sub widgets within that frame.
Thanks in advance
Anil
--
Hi,
Isn't the following code supposed to return ('1994')?
>>> re.search('(\d{4})?', '4 1994').groups()
(None,)
Thanks,
Ray
--
http://mail.python.org/mailman/listinfo/python-list
Rares Vernica wrote:
> Hi,
>
> Isn't the following code supposed to return ('1994')?
>
> >>> re.search('(\d{4})?', '4 1994').groups()
> (None,)
>
> Thanks,
> Ray
The ? is allowing it to not match before it finds the 1994.
Note:
py> re.search('(\d{4})?', '1994 4').groups()
('1994',)
James
-
Rares Vernica wrote:
> Isn't the following code supposed to return ('1994')?
>
> >>> re.search('(\d{4})?', '4 1994').groups()
> (None,)
it's supposed to return the first thing that matches your pattern, which,
in this case, is the empty string at the beginning of the target string.
if you want
Is there a way using any of the Python UI toolkits to generate popup
menus outside the context of an application? For example,
middle-clicking on the desktop shows a list of shortcuts to choose
from.
Pointers to source examples would be appreciated.
--
Cheers,
Rich.
--
http://mail.python.org/m
Hi, Anybody, please help me to set PYTHONPATH to import my modules?. Where is sy.path set?In some python groups site, to import the user modules, they explained to create one __init__.py file in my module directory (this file should include __all__ variable, which refer to the modules
>>The values of some inputs are encoded using html entities.
>>How can I decode a string like "Bessy's cat" in "Bessy's cat"?
>>
>>
>
>this snippet might help:
>
>http://effbot.org/zone/re-sub.htm#strip-html
>
>
Thank you, worked like a charm. :-)
Laszlo
--
http://mail.python.org/m
Rajesh Sathyamoorthy wrote:
> I tried the script and had to get a hexdigest to get the value provided
>
> My test:
> SimplyMEPIS-3.3.1-1.iso
> checksum: 41a19060d3bb37bd596708ba77964491
> i got: 41a19060d3bb37bd596708ba77964491
>
> Do people normally provide md5 checksum in a *hexadecimal string?
101 - 159 of 159 matches
Mail list logo