"softwindow" <[EMAIL PROTECTED]> wrote:
> Carl Banks is right
Did he write to check out:
http://groups.google.com/support/bin/answer.py?answer=14213 ?
Why didn't you do so?
--
John MexIT: http://johnbokma.com/mexit/
personal page:
"defcon8" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> How do I get all the URL's in a page?
>
pyparsing comes with a simple example that does this, too.
-- Paul
Download pyparsing at http://sourceforge.net/projects/pyparsing
--
http://mail.python.org/mailman/listinfo/python-l
Thanks
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 18 May 2006 10:33:58 +0200, Christophe wrote:
> PoD a écrit :
>> On Wed, 17 May 2006 21:37:14 +0800, Andy Sy wrote:
>>
>>
>>>If tabs are easily misunderstood, then they are a MISfeature
>>>and they need to be removed.
>>>
From the Zen of Python:
>>>
>>>"Explicit is better than implic
softwindow wrote:
>the re module is too large and difficult to study
>
>i need a detaild introduction.
>
>
>
That's not the kind of question that's likely to get a useful response
from an all volunteer newsgroup community, even one with as friendly a
reputations as this one.
Here's my suggest
On Thu, 18 May 2006 08:30:03 +, Duncan Booth wrote:
> PoD wrote:
>> How many levels of indentation does 12 spaces indicate?
>> It could be 1,2,3,4,6 or 12. If you say it's 3 then you are
>> _implying_ that each level is represented by 4 spaces.
>
> By reading the code I can see how many leve
use
htmlparser or regular expression
--
http://mail.python.org/mailman/listinfo/python-list
How do I get all the URL's in a page?
--
http://mail.python.org/mailman/listinfo/python-list
Hi bob,
1. decide the directory which will be your root folder containing foo
[/home/ROOT/foo/]
2. work out your directory structure relative to this root folder
here it is ->ROOT->foo->car.py
->bar->far.py
->bar->jar.py
3. a
Dustan wrote:
> Obviously it takes a geek to know you have to time it, as opposed to
> any other task you could be talking about.
wasn't the original question "my program uses a lot of CPU, and I want
to make it more efficient" ? what does "a lot of CPU" and "more
efficient" mean to you, and h
manstey wrote:
> Is there a clever way to see if two strings of the same length vary by
> only one character, and what the character is in both strings.
>
> E.g. str1=yaqtil str2=yaqtel
>
> they differ at str1[4] and the difference is ('i','e')
>
> But if there was str1=yiqtol and str2=yaqtel,
r.e.s. wrote:
> BTW, the first thing I tried was Fredrik Lundh's program:
>
> def number_distinct(fn):
> return len(set(s.strip() for s in open(fn)))
>
> which worked without the square brackets. Interesting that
> omitting them doesn't seem to matter.
a for loop inside square brackets is
[EMAIL PROTECTED] wrote:
> hello,
>
> i have a problem. i would like to import python files above and below
> my current directory.
>
> i'm working on /home/foo/bar/jar.py
>
> i would like to import /home/foo/car.py and
>/home/foo/bar/far.py
>
> how can i do this?
$ cat >>
the re module is too large and difficult to study
i need a detaild introduction.
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
>hello,
>
>i have a problem. i would like to import python files above and below
>my current directory.
>
>i'm working on /home/foo/bar/jar.py
>
>i would like to import /home/foo/car.py and
> /home/foo/bar/far.py
>
>how can i do this?
>
>thank you,
>
hello,
i have a problem. i would like to import python files above and below
my current directory.
i'm working on /home/foo/bar/jar.py
i would like to import /home/foo/car.py and
/home/foo/bar/far.py
how can i do this?
thank you,
bob
ps: i want to scale, so i do not wa
"Paul McGuire" <[EMAIL PROTECTED]> writes:
> >>> def offByNoMoreThanOneCharacter(a,b):
> ... return len(a)==len(b) and sum(map(lambda (x,y): x==y, zip(a,b))) >=
> len(a)-1
Yikes! How about (untested):
def offByNoMoreThanOneCharacter(a,b):
return len(a)==len(b) and \
len([i for i i
import os
import zipfile
z =
zipfile.ZipFile(r"c:\text.zip",mode="w",compression=zipfile.ZIP_DEFLATED)
cwd = os.getcwd()
try:
for dirpath,dirs,files in os.walk(cwd):
for file in files:
z_path = os.path.join(dirpath,file)
start = cwd.rfind(os.sep)+1
z.
aha
now it's right like this:
import os
import zipfile
z =
zipfile.ZipFile(r"c:\text.zip",mode="w",compression=zipfile.ZIP_DEFLATED)
cwd = os.getcwd()
try:
for dirpath,dirs,files in os.walk(cwd):
for file in files:
z_path = os.path.join(dirpath,file)
start = cwd
dongdong wrote:
> how could I get all email address in a html page? Have any modle can do
> this?
> like the htmldata.urlextract .
As if there arent' enough spammers already...
--
http://mail.python.org/mailman/listinfo/python-list
Carl Banks is right
--
http://mail.python.org/mailman/listinfo/python-list
how could I get all email address in a html page? Have any modle can do
this?
like the htmldata.urlextract .
--
http://mail.python.org/mailman/listinfo/python-list
Brian Blazer wrote:
> I promise that this is not homework. I am trying to self teach here
> and have run into an interesting problem. I have created a method
> that asks for a class name and then is supposed to add it to classes
> []. Here is a snippet:
>
> def getCurrentClasses():
> cl
"manstey" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> Is there a clever way to see if two strings of the same length vary by
> only one character, and what the character is in both strings.
>
> E.g. str1=yaqtil str2=yaqtel
>
> they differ at str1[4] and the difference is
"softwindow" <[EMAIL PROTECTED]> wrote:
> aha
> we want to do it with python
> don't use ant
:-D
I want to do a lot with Perl, but sometimes it's better to use the right
tool for the job. And I think that Ant is better at for what I use it
compared to a home brew tool I could make. Be careful
Cary West wrote:
> Hello all, having a small problem with a trig routine using python math
> module. This code is designed to convert geodetic coordinates to lambert
> conformal conic coordinates. It implements the formulas found at
> http://mathworld.wolfram.com/LambertConformalConicProjection.
Hmm...
I tried the gc.collect(). It aint helping. The reference count still
keeps growing till 5 after it which it drops. As you said, it is not
gonna hurt right away.
The only downside in that mysterious up and down thingie is that , we
could get to a wrong conclusion about a leak, if we ran the
Connelly Barnes <[EMAIL PROTECTED]> wrote:
> http://barnesc.blogspot.com/2006/05/programming-language-productivity.h
> tml
C:3 hours to write the program, 5 hours to track down the memory leaks
Java: 4 hours to write the program, 6 hours to get all the exception
handling right
C++ 5
aha
we want to do it with python
don't use ant
--
http://mail.python.org/mailman/listinfo/python-list
my code can work, like below:
import os
import zipfile
z =
zipfile.ZipFile(r"c:\text.zip",mode="w",compression=zipfile.ZIP_DEFLATED)
cwd = os.getcwd()
try:
for dirpath,dirs,files in os.walk(cwd):
for file in files:
z_path = os.path.join(dirpath,file)
z.write(z_p
"pac" <[EMAIL PROTECTED]> wrote:
> I'm preparing to distribute a Windows XP Python program and some
> ancillary files,
> and I wanted to put everything in a .ZIP archive. It proved to be
> inordinately
> difficult and I thought I would post my solution here. Is there a
> better one?
heresy may
manstey wrote:
> Hi,
>
> Is there a clever way to see if two strings of the same length vary by
> only one character, and what the character is in both strings.
You want zip.
def diffbyonlyone(string1, string2):
diffcount = 0
for c1, c2 in zip(string1, string2):
if c1 != c2:
Hi Python folks,
I created a summary PDF of two studies on programming language productivity:
http://barnesc.blogspot.com/2006/05/programming-language-productivity.html
One notes that Python and Perl are the two best languages by the "number of
hours to
solve problem" metric.
I ran into the
pac wrote:
> Suppose you have a set of files in a directory c:\a\b and some
> additional
> files in c:\a\b\subdir. Using a Python script, you would
> like to make a Windows-readable archive (.zip) that preserves this
> directory structure, and where the root directory of the archive is
> c:\a\b.
i am in win2000
"z.write(a_path,a_path)" may change to "z.write(a_path)"
but the dirpath is not in zipfile
who can tell me?
--
http://mail.python.org/mailman/listinfo/python-list
A generator expression can "share" the parenthesis of a function call.
The syntax is explained in PEP 289, which is also in "What's new" in
the Python 2.4 docs.
Nice line of code!
--
http://mail.python.org/mailman/listinfo/python-list
I'm preparing to distribute a Windows XP Python program and some
ancillary files,
and I wanted to put everything in a .ZIP archive. It proved to be
inordinately
difficult and I thought I would post my solution here. Is there a
better one?
Suppose you have a set of files in a directory c:\a\b an
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> But if a 1 person, using 1 language, with the same set of tools withing
> a 3 month period implements the same algo without bugs - I'll bet you
> the shorter one was theone written second.
You might lose that bet very often. I see often that additi
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> quoting mechanism is available on the web interface and I haven't found
> it - I'd love to know how to use it.
http://groups.google.com/support/bin/answer.py?answer=14213
> Also i use the threaded view on
> the web client, so I have little trouble
Edward Elliott <[EMAIL PROTECTED]> wrote:
> Terry Hancock wrote:
>
>> But the real point is that no one here can make
>> any reasonably objective assessment of whether your "data" is
>> meaningful unless you post examples. That's what creates the
>> hostility, I think.
>
> Fair enough. But see
I promise that this is not homework. I am trying to self teach here
and have run into an interesting problem. I have created a method
that asks for a class name and then is supposed to add it to classes
[]. Here is a snippet:
def getCurrentClasses():
classes = []
print 'P
Thanks Ben,
I actually don't spend a whole lot of time on newsgroups. I don't use
my gmail account and use the groups thru the web interface. If that
quoting mechanism is available on the web interface and I haven't found
it - I'd love to know how to use it. Also i use the threaded view on
the w
manstey wrote:
> Hi,
>
> Is there a clever way to see if two strings of the same length vary by
> only one character, and what the character is in both strings.
>
> E.g. str1=yaqtil str2=yaqtel
>
> they differ at str1[4] and the difference is ('i','e')
>
> But if there was str1=yiqtol and str2=yaqt
As a coder, I wouldn't normally use the two different conventions. you
show in your examples. So it does little to tell us about the
importance or lack there of line count.
Let me state clearly - to use line count , in absence of other
considerations, IS meaningless.
But if a 1 person, using 1
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:
> Hmm, and I thought it was respectful to actually address someone you
> are talking to.
On Usenet, it's respectful to all readers if you give a short quoted
passage from the message you're responding to, so we can follow the
discussion with context
"cracker" <[EMAIL PROTECTED]> writes:
> So wat do u think about opensource software? and what is your view
> about Microsoft share your views with us!
> and let us know what do you think about opensource software.
>
> http://www.desi-tek.com/forum/index.php?showtopic=394&st=
Please don't spam her
Hmm, and I thought it was respectful to actually address someone you
are talking to. Must every statement be a reaction to a quotable
comment? In any case, I realize I was completley wrong. Please allow
me to retract my statement.
--
http://mail.python.org/mailman/listinfo/python-list
Ron Garret wrote:
> > > I'm using an OS X terminal to ssh to a Linux machine.
> >
> > In theory it should work out of the box. OS X terminal should set
> > enviromental variable LANG=en_US.utf-8, then ssh should transfer this
> > variable to Linux and python will know that your terminal is utf-8.
>
Terry Hancock wrote:
> But the real point is that no one here can make
> any reasonably objective assessment of whether your "data" is
> meaningful unless you post examples. That's what creates the
> hostility, I think.
Fair enough. But see my other posts on why I'm not interested in objective
rh0dium wrote:
> This has several problems - least of which args aren't working Has
> anyone really tried this approach?
No, they just wrote the code for the hell of it. :)
Seriously though, you may want to consider using the popen2 module.
Then you'll be able to wait on the subprocess to r
In article <[EMAIL PROTECTED]>,
"Serge Orlov" <[EMAIL PROTECTED]> wrote:
> Ron Garret wrote:
> > In article <[EMAIL PROTECTED]>,
> > "Serge Orlov" <[EMAIL PROTECTED]> wrote:
> >
> > > Ron Garret wrote:
> > > > In article <[EMAIL PROTECTED]>,
> > > > Robert Kern <[EMAIL PROTECTED]> wrote:
> > >
manstey wrote:
> Hi,
>
> Is there a clever way to see if two strings of the same length vary by
> only one character, and what the character is in both strings.
>
> E.g. str1=yaqtil str2=yaqtel
>
> they differ at str1[4] and the difference is ('i','e')
something like this maybe?
>>> str1='yaqtil'
Ron Garret wrote:
> In article <[EMAIL PROTECTED]>,
> Robert Kern <[EMAIL PROTECTED]> wrote:
>
>>Ron Garret wrote:
>>
>>>I'm using an OS X terminal to ssh to a Linux machine.
>>
>>Click on the "Terminal" menu, then "Window Settings...". Choose "Display"
>>from
>>the combobox. At the bottom you w
Michael Tobis wrote:
>John Bokma wrote:
>>"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>>>Ok I'm going to end with a flamebait - but I would posit, ALL OTHER
>>>THINGS BEING EQUAL - that a smaller number of characters and lines in
>>>code is more maintainable than larger number of characters and
Ron Garret wrote:
> In article <[EMAIL PROTECTED]>,
> "Serge Orlov" <[EMAIL PROTECTED]> wrote:
>
> > Ron Garret wrote:
> > > In article <[EMAIL PROTECTED]>,
> > > Robert Kern <[EMAIL PROTECTED]> wrote:
> > >
> > > > Ron Garret wrote:
> > > >
> > > > > I forgot to mention:
> > > > >
> > > > sy
"Michael Tobis" <[EMAIL PROTECTED]> wrote:
>> According to your silly rule the shortest book on a subject would be
>> the best. Now why is that false?
>
> No, according to the rule, the shorter of two books **containing the
> same information** would be best.
What is "the same information"?
> I
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> John,
> Your hilarious...
If you learn to quote, you don't need to address me. But it's beyond you I
understand, so bye.
--
John MexIT: http://johnbokma.com/mexit/
personal page: ht
In article <[EMAIL PROTECTED]>,
Robert Kern <[EMAIL PROTECTED]> wrote:
> Ron Garret wrote:
>
> > I'm using an OS X terminal to ssh to a Linux machine.
>
> Click on the "Terminal" menu, then "Window Settings...". Choose "Display"
> from
> the combobox. At the bottom you will see a combobox titl
"Tim Chase" <[EMAIL PROTECTED]> wrote ...
> 2) use a python set:
>
> s = set()
> for line in open("file.in"):
> s.add(line.strip())
> return len(s)
>
> 3) compact #2:
>
> return len(set([line.strip() for line in file("file.in")]))
>
> or, if stripping the lines isn't a concern, it can just be
> According to your silly rule the shortest book on a subject would be the
> best. Now why is that false?
No, according to the rule, the shorter of two books **containing the
same information** would be best.
I don't think I'm a zealot. The original quote said "all else equal".
Certainly legible
Microsoft has dominated the world of computing for many years, with its
heavily guarded 'code' being beyond reach to many in the developing
nations. In some of the poorest countries the cost of upgrading an
operating system to keep up with the rest of the world amounts to a
year's wages, and there
Edward Elliott <[EMAIL PROTECTED]> wrote:
> corroborations. It's like a guy saying he saw a cloud that looks like
> a python. The cloud's gone now, but other people can watch other
> clouds and report what they see.
Good comparison, now does the cloud gazing make them better programmers?
--
J
John,
Your hilarious... I mean it, and as a compliment.
But seriously, I think your taking a discussion about trends and
twisting them to be about absolutes. Maybe others are too.
But, forgive the cheesy paraphrasing, but the solution should be as
simple as possible, and no simpler.
There is no
Ron Garret wrote:
>
> But what about this:
>
> >>> f2=open('foo','w')
> >>> f2.write(u'\xFF')
> Traceback (most recent call last):
> File "", line 1, in ?
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xff' in
> position 0: ordinal not in range(128)
> >>>
>
> That should have nothi
I've been doing a little c programming again (ouch!) and it's just hit
me
why python does not allow assignment inside expressions (as in c):
because it is absolutely essential that all assignments are as visible
as possible. In python the assignment is the declaration; when
declarations
are as che
Ben Finney wrote:
> Until we get the code to examine independently, all we have is an
> anecdote. Thus the comparison to UFO sightings.
Except UFO sightings comprise a large body of data containing a vast number
of known false reports and others that appear to be in the same vein with
no verified
Ben Finney wrote:
> Until we get the code to examine independently, all we have is an
> anecdote. Thus the comparison to UFO sightings.
Except UFO sightings comprise a large body of data containing a vast number
of known false reports and others that appear to be in the same vein with
no verified
Ron Garret wrote:
> I'm using an OS X terminal to ssh to a Linux machine.
Click on the "Terminal" menu, then "Window Settings...". Choose "Display" from
the combobox. At the bottom you will see a combobox title "Character Set
Encoding". Choose "Unicode (UTF-8)".
> But what about this:
>
f2=
"Michael Tobis" <[EMAIL PROTECTED]> wrote:
> The relevant corrolary is, "he programs best who programs least". I
> would have thought this was conventional wisdom among all dynamic
> language communities. Isn't that the whole point? By all means go back
> to C++ if you like to have three lines for
Edward Elliott <[EMAIL PROTECTED]> wrote:
> John Bokma wrote:
>
>> "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>>> It seems to me the discussion could actually be beneficial. If
>>> several different coders gave similar responses, ie code
>>> line/character count comparisons, we might be able
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> THe interest, on my part, is more academic than practical. I find
> data, particularly "dirty" data very fascinating
Me less, maybe that's why I originally had gg kill filed...
I prefer quotes.
--
John MexIT: http:
In article <[EMAIL PROTECTED]>,
"Serge Orlov" <[EMAIL PROTECTED]> wrote:
> Ron Garret wrote:
> > In article <[EMAIL PROTECTED]>,
> > Robert Kern <[EMAIL PROTECTED]> wrote:
> >
> > > Ron Garret wrote:
> > >
> > > > I forgot to mention:
> > > >
> > > sys.getdefaultencoding()
> > > >
> > > > 'u
rh0dium wrote:
> Needless to say this is much more complex than what I was "hoping" for.
> Has anyone solved this in a generic approach..
>
> #!/usr/bin/env python
>
> import os,sys,string
> import subprocess
>
> argc = len(sys.argv)
>
> # Yes I move all exe's to the .bin
If I were you I would see if I could get the Perl script referred to on
the ERIN web page. You might find that the discrepancy is something as
simple as a slightly different value for the Earth's radius. And by the
way, math.radians() might be a bit clearer than the pi/180 business.
--
http://mai
> Is there a clever way to see if two strings of the same length vary by
> only one character, and what the character is in both strings.
>
> E.g. str1=yaqtil str2=yaqtel
>
> they differ at str1[4] and the difference is ('i','e')
>
> But if there was str1=yiqtol and str2=yaqtel, I am not interes
John Bokma wrote:
> "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> > Ok I'm going to end with a flamebait - but I would posit, ALL OTHER
> > THINGS BEING EQUAL - that a smaller number of characters and lines in
> > code is more maintainable than larger number of characters and lines in
> > the c
Hi,
Is there a clever way to see if two strings of the same length vary by
only one character, and what the character is in both strings.
E.g. str1=yaqtil str2=yaqtel
they differ at str1[4] and the difference is ('i','e')
But if there was str1=yiqtol and str2=yaqtel, I am not interested.
can a
Ron Garret wrote:
> In article <[EMAIL PROTECTED]>,
> Robert Kern <[EMAIL PROTECTED]> wrote:
>
> > Ron Garret wrote:
> >
> > > I forgot to mention:
> > >
> > sys.getdefaultencoding()
> > >
> > > 'utf-8'
> >
> > A) You shouldn't be able to do that.
>
> What can I say? I can.
>
> > B) Don't do
Am Donnerstag 18 Mai 2006 22:13 schrieb Raymond Hettinger:
> This is a false optimization. The slicing steps are O(n) and the sort
> step is O(n log n) unless the data has some internal structure that
> Timsort can use to get closer to O(n).
>
> If you implemented this and timed in it real apps, I
glomde a écrit :
> So I read trough all of the make PEP and make would support the syntax
> i propose..
> and more generic and better in many ways. Since it was rejected I have
> to
... bug the BDFL until he reconsiders its position.
--
http://mail.python.org/mailman/listinfo/python-list
Hi all,
Here I was happily coming to working thinking - OK I need to create a
wrapper for a tool (UNIX) which does nothing but lauch the end tool and
send a sql instert letting the db know the tool was launched (Can we
say Big Brother..). Some of the tools are very long running with lots
of data
Sorry,
Never mind.
wtf.func_defaults
Thanks for the examples.
Rick
--
http://mail.python.org/mailman/listinfo/python-list
Thank you Ed for your eloquent statement. From now on I will avoid
humor in posts on this thread , my previous attempts were not useful or
productive - and I think there is something interesting in this
discussion.
It might be interesting to come up with a coding assignment for
developers to atte
r.e.s. wrote:
> I have a million-line text file with 100 characters per line,
> and simply need to determine how many of the lines are distinct.
>
> On my PC, this little program just goes to never-never land:
>
> def number_distinct(fn):
> f = file(fn)
> x = f.readline().strip()
> L
"Christophe" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>Instead of saying that all works as intended could you be a little
>helpful and tell me why it was intended in such an obviously broken way
>instead ?
I answered both your explicit and implied questions in good faith. But
Fredrik Lundh wrote:
> Dustan wrote:
>
> >> 2. Measure it.
> >
> > Tell me how and I will; I'm not nearly that much of a geek
> > unfortunately.
>
> do you have to be a geek to be able to measure how much time
> something takes?
Obviously it takes a geek to know you have to time it, as opposed to
> I have a million-line text file with 100 characters per line,
> and simply need to determine how many of the lines are distinct.
A few ideas:
1) the shell way:
bash$ sort file.in | uniq | wc -l
This doesn't strip whitespace...a little sed magic would
strip off whitespace for you:
bash$ sed
Dustan wrote:
>> 2. Measure it.
>
> Tell me how and I will; I'm not nearly that much of a geek
> unfortunately.
do you have to be a geek to be able to measure how much time
something takes?
--
http://mail.python.org/mailman/listinfo/python-list
So I read trough all of the make PEP and make would support the syntax
i propose..
and more generic and better in many ways. Since it was rejected I have
to continue live
with my preprocessor...
>From the make PEP
. Allowing this sort of customization could allow XML to be written
without rep
r.e.s. wrote:
> I have a million-line text file with 100 characters per line,
> and simply need to determine how many of the lines are distinct.
>
> On my PC, this little program just goes to never-never land:
>
> def number_distinct(fn):
> f = file(fn)
> x = f.readline().strip()
> L =
Fredrik Lundh wrote:
> Dustan wrote:
>
> > I have a program that uses up a lot of CPU and want to make it is
> > efficient as possible with what I have to work with it. So which of the
> > following would be more efficient, knowing that l is a list and size is
> > a number?
> >
> > l=l[:size]
> >
Registration for Europython (3-5 July) at CERN in Geneva is now open,
if you feel submitting a talk proposal there's still time until
the 31th of May.
If you want to talk about a library you developed, or you know well
and want to share your knowledge, or about how you are making the best
out of P
"Dustan" <[EMAIL PROTECTED]> writes:
> John Machin wrote:
> > 2. Measure it.
>
> Tell me how and I will; I'm not nearly that much of a geek
> unfortunately.
You've already been told. Here it is again:
http://docs.python.org/lib/profile.html>
--
\ "I don't know half of you half as we
Fredrik Lundh wrote:
> George Sakkis wrote:
>
>> It would be useful if list.sort() accepted two more optional
>> parameters
>
>
> useful for what? what's the use case ?
>
>
>
Although there is a use case (see below), I don't think it's strictly
necessary in this case. Arguments to add it:
- Don
r.e.s. wrote:
> I have a million-line text file with 100 characters per line,
> and simply need to determine how many of the lines are distinct.
>
> On my PC, this little program just goes to never-never land:
>
> def number_distinct(fn):
> f = file(fn)
> x = f.readline().strip()
> L
John Machin wrote:
> 1. Think about it. The first case will make a new list and copy "size"
> *objects. When the assignment happens, the old list has its reference
> count decremented. Not very memory-friendly. The second case merely
> truncates the existing list in situ. Bit hard to imagine how t
"r.e.s." <[EMAIL PROTECTED]> writes:
> I have a million-line text file with 100 characters per line,
> and simply need to determine how many of the lines are distinct.
I'd generalise it by allowing the caller to pass any iterable set of
items. A file handle can be iterated this way, but so can an
John Bokma wrote:
> "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>> It seems to me the discussion could actually be beneficial. If several
>> different coders gave similar responses, ie code line/character count
>> comparisons, we might be able to see if there is a trend of any sort -
>> the mo
r.e.s. wrote:
> I have a million-line text file with 100 characters per line,
> and simply need to determine how many of the lines are distinct.
>
> On my PC, this little program just goes to never-never land:
>
> def number_distinct(fn):
> f = file(fn)
> x = f.readline().strip()
> L
Ron Garret wrote:
> In article <[EMAIL PROTECTED]>,
> Robert Kern <[EMAIL PROTECTED]> wrote:
>
>>Ron Garret wrote:
>>
>>>I forgot to mention:
>>>
>>>
>>sys.getdefaultencoding()
>>>
>>>'utf-8'
>>
>>A) You shouldn't be able to do that.
>
> What can I say? I can.
See B).
>>B) Don't do that.
1 - 100 of 272 matches
Mail list logo