On 11 Gen, 21:47, webtourist wrote:
> On Jan 10, 8:35 am, flow wrote:
>
> > I've just finished reading a sort of beginner Python book, and I know
> > quite a bit now but I'm looking for a book that can teach me advanced
> > aspects of Python - code optimisation, threading, etc.
>
> > Any recommen
On Jan 12, 1:26 pm, Alan Harris-Reid
wrote:
> Does anyone know where I can find any decent dynamically-constructed
> HTML control classes (dropdown list, table, input field, checkbox, etc.)
> written in Python.
There's pyWeb[1], which seems pretty close to what you're asking for:
mytable = tab
* Steve Holden:
Alf P. Steinbach wrote:
* W. eWatson:
Ben Finney wrote:
"W. eWatson" writes:
See my post about the datetime controversy about 3-4 posts up from
yours.
This forum is distributed, and there's no “up” or “3-4 messages” that is
common for all readers.
Could you give the Messag
On Mon, Jan 11, 2010 at 10:26 PM, Ben Finney wrote:
> "Alf P. Steinbach" writes:
>
>> And considering this, and the fact that Google's archive is now the
>> main Usenet archive, message id's are not that useful, really.
>
> You've demonstrated only that Google is an unreliable Usenet archive.
>
>
"Alf P. Steinbach" writes:
> And considering this, and the fact that Google's archive is now the
> main Usenet archive, message id's are not that useful, really.
You've demonstrated only that Google is an unreliable Usenet archive.
One doesn't even need to use Usenet, in this case, since
comp.l
Hi,
Does anyone know where I can find any decent dynamically-constructed
HTML control classes (dropdown list, table, input field, checkbox, etc.)
written in Python. For example, for a HTML table I would like something
like...
MyTable = html_table() # instantiate class
MyTable.data =
Alf P. Steinbach wrote:
> * W. eWatson:
>> Ben Finney wrote:
>>> "W. eWatson" writes:
>>>
See my post about the datetime controversy about 3-4 posts up from
yours.
>>>
>>> This forum is distributed, and there's no “up” or “3-4 messages” that is
>>> common for all readers.
>>>
>>> Could y
* W. eWatson:
Ben Finney wrote:
"W. eWatson" writes:
See my post about the datetime controversy about 3-4 posts up from
yours.
This forum is distributed, and there's no “up” or “3-4 messages” that is
common for all readers.
Could you give the Message-ID for that message?
Sort of like oute
On Jan 10, 8:35 am, flow wrote:
> I've just finished reading a sort of beginner Python book, and I know
> quite a bit now but I'm looking for a book that can teach me advanced
> aspects of Python - code optimisation, threading, etc.
>
> Any recommendations?
>
> Cheers.
Can you tell us what book i
"W. eWatson" writes:
> Ben Finney wrote:
> > Could you give the Message-ID for that message?
> >
> Sort of like outer space I guess. No real direction. How would I find
> the message ID?
It is a field in the header of every message. Show the full header, and
look for the field named ‘Message-ID’
Ben Finney wrote:
"W. eWatson" writes:
See my post about the datetime controversy about 3-4 posts up from
yours.
This forum is distributed, and there's no “up” or “3-4 messages” that is
common for all readers.
Could you give the Message-ID for that message?
Sort of like outer space I guess
I mentioned that I figured out how to use a variable with a Python TK Listbox
in my post (http://www.mail-archive.com/python-list@python.org/msg271288.html).
Now, I'm trying to make a class, ListVar, that allows me to operate on a
Listbox's listvariable as if it were a list. The problem is, it
Martin P. Hellwig wrote:
Martin P. Hellwig wrote:
W. eWatson wrote:
Maybe there's a more elegant way to do this. I want to express the
result of datetime.datetime.now() in fractional hours.
Here's one way.
dt=datetime.datetime.now()
xtup = dt.timetuple()
h = xtup[3]+xtup[4]/60.0+xtup[5]/3600
Martin P. Hellwig wrote:
Martin P. Hellwig wrote:
W. eWatson wrote:
Maybe there's a more elegant way to do this. I want to express the
result of datetime.datetime.now() in fractional hours.
Here's one way.
dt=datetime.datetime.now()
xtup = dt.timetuple()
h = xtup[3]+xtup[4]/60.0+xtup[5]/3600
trailingPattern = '(\S*)\ +?\n'
line = re.sub(trailingPattern, '\\1\n', line)
What happens with this?
trailingPattern = '\s+$'
line = re.sub(trailingPattern, '', line)
I'm guessing that $ terminates \s+'s greediness without snarfing the underlying
\n. Then I'm guessing that
2010/1/11 Eknath Venkataramani :
> correct.txt snippet:
> 1 2 1
> 1 3 3
> 1 5 21
> 1 7 19
>
> union_output_TEMP.txt snippet:
> 1 2 1_NN
> 1 3 3_VBZ
> 1 3 5_VBZ
> 1 3 2_VBZ
> 1 5 21_VB
> 1 7 19_NN
> 1 9 14_VB
>
> I need to get the output in categorized.txt as:
> NN={1 7 19, 1 2 1}
> VBZ={1 3 3}
> VB
On 2010-01-11, monkeys paw wrote:
> >>> print 'hey'
> 'hey'
> >>> # I want to access the shell here, how do i do that?
Look into the commands module.
--
http://mail.python.org/mailman/listinfo/python-list
On 2010-01-11 17:50 PM, wiso wrote:
The problem now is this:
start reading file r1_200909.log
start reading file r1_200910.log
readen 488832 lines from file r1_200910.log
readen 517247 lines from file r1_200909.log
with huge file (the real case) the program freeze. Is there a solution to
avoid
On Jan 12, 7:30 am, Jeremy wrote:
> On Jan 11, 1:15 pm, "Diez B. Roggisch" wrote:
>
>
>
> > Jeremy schrieb:
>
> > > On Jan 11, 12:54 pm, Carl Banks wrote:
> > >> On Jan 11, 11:20 am, Jeremy wrote:
>
> > >>> I just profiled one of my Python scripts and discovered that >99% of
> > >>> the time wa
On 01/11/2010 11:57 PM, Zabin wrote:
Hey!
I am new to PyQt programming and am trying to activate a secondary qt
form from a primary form. I am unsure as to how this will work as i am
using pyuic4 to convert .ui file to .py and then importing it by:
from SimLCM_GUI import Ui_main
I am unsure as
Robert Kern wrote:
> On 2010-01-11 17:15 PM, wiso wrote:
>> I'm using a class to read some data from files:
>>
>> import multiprocessing
>> from collections import defaultdict
>>
>> def SingleContainer():
>> return list()
>>
>>
>> class Container(defaultdict):
>> """
>> this class s
correct.txt snippet:
1 2 1
1 3 3
1 5 21
1 7 19
union_output_TEMP.txt snippet:
1 2 1_NN
1 3 3_VBZ
1 3 5_VBZ
1 3 2_VBZ
1 5 21_VB
1 7 19_NN
1 9 14_VB
I need to get the output in categorized.txt as:
NN={1 7 19, 1 2 1}
VBZ={1 3 3}
VB={1 5 21}
in python.
Kindly help
1 2 1
1 3 3
1 5 21
1 7 19
1 10 13
1
On 2010-01-11 17:15 PM, wiso wrote:
I'm using a class to read some data from files:
import multiprocessing
from collections import defaultdict
def SingleContainer():
return list()
class Container(defaultdict):
"""
this class store odd line in self["odd"] and even line in self["
On Mon, 11 Jan 2010 13:51:48 -0800, Chris Rebert wrote:
> On Mon, Jan 11, 2010 at 12:34 PM, Steven D'Aprano
> wrote:
>> If you can avoid regexes in favour of ordinary string methods, do so.
>> In general, something like:
>>
>> source.replace(target, new)
>>
>> will potentially be much faster tha
Paul Rubin writes:
> John Bokma writes:
>>> Why EVER make anything yourself when you can buy it?
>>
>> Do you make your own processors? Your own hard disk drives?
>> Why not?
>
> Well, if you try to make your own processors or hard drives, worst
> normal outcome is they don't work and you try so
ta...@mongo.net (tanix) writes:
> Sorry to tell you, but I studied Google architecture in sufficient
> detail to say what I am saying.
http://groups.google.com/groups?lnk=hpsg&q=group%3Acomp.lang.python%20pyparsing
--
John Bokma
Read my blog: http://johnbokma.com/
Hire me (Perl/Python): http:
I'm using a class to read some data from files:
import multiprocessing
from collections import defaultdict
def SingleContainer():
return list()
class Container(defaultdict):
"""
this class store odd line in self["odd"] and even line in self["even"].
It is stupid, but it's only a
Hey!
I am new to PyQt programming and am trying to activate a secondary qt
form from a primary form. I am unsure as to how this will work as i am
using pyuic4 to convert .ui file to .py and then importing it by:
from SimLCM_GUI import Ui_main
I am unsure as to how the self.uicommands will fu
On 2010-01-11 14:09 PM, Anthra Norell wrote:
Robert Kern wrote:
On 2010-01-09 03:52 AM, Anthra Norell wrote:
"Don't use a random generator for encryption purposes!" warns the
manual, of which fact I was reminded in no uncertain terms on this forum
a few years ago when I proposed the following
In article , Terry Reedy
wrote:
>On 1/11/2010 2:50 PM, tanix wrote:
>> In article, Terry
> Reedy wrote:
>
>>> This site pops up spam windowns. One was blocked, one managed to bypass
>>> the popup blocker. Tnis is not friendly behaviour.
>>
>> I am sorry. But this is a known issue.
>> This is one
On Jan 12, 11:31 am, Jeremy Sanders wrote:
> Zabin wrote:
> > Thanks for the pointersi had a look around and found the site:
>
> http://www.microsoft.com/resources/documentation/windows/xp/all/prodd...
> us/xcopy.mspx?mfr=true
>
>
>
> > to disable the prompt- i needed to include /y as below:
>
monkeys paw wrote:
How do you access the command line from the
python interpreter?
on unix:
type python
>>> print 'hey'
'hey'
>>> # I want to access the shell here, how do i do that?
If you're interactive, I'd just use standard process/job control,
and hit control+Z to suspend and "fg"
On Mon, Jan 11, 2010 at 2:00 PM, Zabin wrote:
> and just wondering- whats the drawback of using os.system() command
Forgetting to properly escape your input. Simple example:
filename = "foo bar.txt"
os.system("rm "+filename) # uh-oh, we deleted 'foo' and 'bar.txt' instead
The `subprocess` modu
On 2010-01-11 14:31 PM, CELEN Erman wrote:
(I also noticed that this behavior is same under standard NumPy 1.4
with standard Python 2.6 on Windows. If you call numpy.log10(0.0) you
will get an "-inf" and no exceptions will be raised. Which is not the
case with Python's standard math.log10(0.0) wh
* suresh.amritapuri:
On Jan 9, 9:51 pm, "Alf P. Steinbach" wrote:
* Lie Ryan:
On 1/9/2010 8:43 AM, suresh.amritapuri wrote:
Hi,
In PIL, how to display multiple images in say m rows and n colums when
I have m*n images.
suresh
Tkinter has PhotoImage widget and PIL has support for this widget:
On Jan 12, 10:23 am, Chris Rebert wrote:
> On Mon, Jan 11, 2010 at 12:43 PM, Zabin wrote:
> > Hey everyone!
>
> > I am a new python programmer. I am trying to get the general file
> > functionality with options of save and save as working. These save
> > functions save a folder with multiple file
On Mon, 11 Jan 2010 10:03:04 +0100, Alf P. Steinbach wrote:
>>> A Python "list" is an array functionality-wise.
>>>
>>> If one isn't observant of that fact then one ends up with O(n^2) time
>>> for the simplest things.
>>
>> Well that's certainly not true. Some operations may be O(N**2), but
>> o
On Mon, Jan 11, 2010 at 12:34 PM, Steven D'Aprano
wrote:
> If you can avoid regexes in favour of ordinary string methods, do so. In
> general, something like:
>
> source.replace(target, new)
>
> will potentially be much faster than:
>
> regex = re.compile(target)
> regex.sub(new, source)
> # equi
On Jan 11, 9:03 pm, John Bokma wrote:
> amadain writes:
> > On Jan 11, 7:26 pm, John Bokma wrote:
> >> amadain writes:
> >> > >> > uniqueId="1261124569.35725_PFS_1_1340035961">
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >
On Mon, Jan 11, 2010 at 12:43 PM, Zabin wrote:
> Hey everyone!
>
> I am a new python programmer. I am trying to get the general file
> functionality with options of save and save as working. These save
> functions save a folder with multiple files. Upon using the os.system
> copy function- if my d
On Jan 9, 3:55 am, Anssi Saari wrote:
> aj writes:
> > I access python from a network share. This works fine on XP but on
> > windows 7 it throws the following error:
>
> > Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit
> > (Intel)] on
> > win32
> > Type "help", "copyright",
monkeys paw writes:
> How do you access the command line from the
> python interpreter?
>
> on unix:
>
> type python
>
print 'hey'
> 'hey'
# I want to access the shell here, how do i do that?
Like this?
>>> import os
>>> os.system('echo $HOME')
/Users/arno
0
>>>
--
Arnaud
--
htt
Philip Semanchuk writes:
>
> I second the suggestion to use rstrip(), but for future reference you
> should also check out the compile() function in the re module. You
> might want to time the code above against a version using a compiled
> regex to see how much difference it makes.
The re module
2010/1/11 Zabin :
> Hey everyone!
>
> I am a new python programmer. I am trying to get the general file
> functionality with options of save and save as working. These save
> functions save a folder with multiple files. Upon using the os.system
> copy function- if my destination directory has files
>> (I also noticed that this behavior is same under standard NumPy 1.4
>> with standard Python 2.6 on Windows. If you call numpy.log10(0.0) you
>> will get an "-inf" and no exceptions will be raised. Which is not the
>> case with Python's standard math.log10(0.0) which will raise a
>> ValueErro
On 1/11/2010 2:50 PM, tanix wrote:
In article, Terry
Reedy wrote:
This site pops up spam windowns. One was blocked, one managed to bypass
the popup blocker. Tnis is not friendly behaviour.
I am sorry. But this is a known issue.
This is one of counter vendors doing these popups.
They were c
amadain writes:
> On Jan 11, 7:26 pm, John Bokma wrote:
>> amadain writes:
>> > > > uniqueId="1261124569.35725_PFS_1_1340035961">
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
Philip Semanchuk schrieb:
On Jan 11, 2010, at 3:30 PM, Jeremy wrote:
On Jan 11, 1:15 pm, "Diez B. Roggisch" wrote:
Jeremy schrieb:
On Jan 11, 12:54 pm, Carl Banks wrote:
On Jan 11, 11:20 am, Jeremy wrote:
I just profiled one of my Python scripts and discovered that >99% of
the time w
How do you access the command line from the
python interpreter?
on unix:
type python
>>> print 'hey'
'hey'
>>> # I want to access the shell here, how do i do that?
--
http://mail.python.org/mailman/listinfo/python-list
On 2010-01-11, Steven D'Aprano wrote:
[regarding profiling results]
> I think you'll find that Python's regex engine is pretty much
> optimised as well as it can be, short of a major re-write. But
> to quote Jamie Zawinski:
>
> Some people, when confronted with a problem, think "I know,
>
On Jan 11, 2010, at 3:30 PM, Jeremy wrote:
On Jan 11, 1:15 pm, "Diez B. Roggisch" wrote:
Jeremy schrieb:
On Jan 11, 12:54 pm, Carl Banks wrote:
On Jan 11, 11:20 am, Jeremy wrote:
I just profiled one of my Python scripts and discovered that
>99% of
the time was spent in
{built-in met
> There's nothing wrong with building dicts or other lookup tables outside
> a function in order to avoid re-creating them every time the function is
> called.
Brilliant! I didn't think of that. I guess I accidentally did it right
this time as I query that dictionary quite a few times from the
fun
On Mon, 11 Jan 2010 18:57:09 +, MRAB wrote:
> There's nothing wrong with building dicts or other lookup tables outside
> a function in order to avoid re-creating them every time the function is
> called.
Actually there is, but the benefit (avoiding the re-creation of the
table) may be worth
On Jan 11, 1:50 pm, Phlip wrote:
> MRAB wrote:
> > Scott wrote:
> >> for prtnmS in open(portfpth):
> >> prtnmS = prtnmS.rstrip()
> > There's nothing wrong with building dicts or other lookup tables outside
> > a function in order to avoid re-creating them every time the function is
> > called.
On 1/11/2010 3:02 PM, Jeremy wrote:
I am using the re.sub command to remove trailing whitespace from lines
in a text file.
>>> help(str.rstrip)
Help on method_descriptor:
rstrip(...)
S.rstrip([chars]) -> str
Return a copy of the string S with trailing whitespace removed.
If chars
On Mon, Jan 11, 2010 at 15:02, Jeremy wrote:
> I am using the re.sub command to remove trailing whitespace from lines
> in a text file. The commands I use are copied below. If you have any
> suggestions on how they could be improved, I would love to know.
Just curious, but if each line is simpl
Hey everyone!
I am a new python programmer. I am trying to get the general file
functionality with options of save and save as working. These save
functions save a folder with multiple files. Upon using the os.system
copy function- if my destination directory has files with similar
names- i am ask
On Mon, 11 Jan 2010 11:20:34 -0800, Jeremy wrote:
> I just profiled one of my Python scripts
Well done! I'm not being sarcastic, or condescending, but you'd be AMAZED
(or possibly not...) at how many people try to optimize their scripts
*without* profiling, and end up trying to speed up parts
Anthra Norell writes:
> Why EVER make anything yourself when you can buy it?
http://en.wikipedia.org/wiki/Dunning-Kruger_effect
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 11, 1:15 pm, "Diez B. Roggisch" wrote:
> Jeremy schrieb:
>
>
>
>
>
> > On Jan 11, 12:54 pm, Carl Banks wrote:
> >> On Jan 11, 11:20 am, Jeremy wrote:
>
> >>> I just profiled one of my Python scripts and discovered that >99% of
> >>> the time was spent in
> >>> {built-in method sub}
> >>>
On Mon, Jan 11, 2010 at 12:02 PM, Jeremy wrote:
> Your guess is correct. I had forgotten that I was using that
> function.
>
> I am using the re.sub command to remove trailing whitespace from lines
> in a text file. The commands I use are copied below. If you have any
> suggestions on how they
On Jan 9, 9:51 pm, "Alf P. Steinbach" wrote:
> * Lie Ryan:
>
> > On 1/9/2010 8:43 AM, suresh.amritapuri wrote:
> >> Hi,
>
> >> In PIL, how to display multiple images in say m rows and n colums when
> >> I have m*n images.
>
> >> suresh
>
> > Tkinter has PhotoImage widget and PIL has support for th
Jeremy schrieb:
On Jan 11, 12:54 pm, Carl Banks wrote:
On Jan 11, 11:20 am, Jeremy wrote:
I just profiled one of my Python scripts and discovered that >99% of
the time was spent in
{built-in method sub}
What is this function and is there a way to optimize it?
I'm guessing this is re.sub (or
On Jan 11, 7:26 pm, John Bokma wrote:
> amadain writes:
> > I have an event log with 100s of thousands of entries with logs of the
> > form:
>
> > > uniqueId="1261124569.35725_PFS_1_1340035961">
> >
> >
> >
> >
> >
> >
> >
Robert Kern wrote:
On 2010-01-09 03:52 AM, Anthra Norell wrote:
Daniel Fetchinson wrote:
> I have a plain text file which I would like to protect in a very
> simple minded, yet for my purposes sufficient, way. I'd like to
> encrypt/convert it into a binary file in such a way that
possession
On 2010-01-11, Steven Woody wrote:
> I am using pyserial. But I always get the local echo after I
> write some characters onto serial port
I really doubt you're getting a local echo. Is the data coming
out the serial port? Do you get the echo if you disconnect the
serial cable?
> and I find
On Jan 11, 12:54 pm, Carl Banks wrote:
> On Jan 11, 11:20 am, Jeremy wrote:
>
> > I just profiled one of my Python scripts and discovered that >99% of
> > the time was spent in
>
> > {built-in method sub}
>
> > What is this function and is there a way to optimize it?
>
> I'm guessing this is re.s
On Jan 11, 2010, at 2:50 PM, Phlip wrote:
MRAB wrote:
Scott wrote:
for prtnmS in open(portfpth):
prtnmS = prtnmS.rstrip()
There's nothing wrong with building dicts or other lookup tables
outside
a function in order to avoid re-creating them every time the
function is
called.
Ho
Jeremy wrote:
I just profiled one of my Python scripts and discovered that >99% of
the time was spent in
{built-in method sub}
What is this function and is there a way to optimize it?
I think it's the subtraction operator. The only way to optimise it is to
reduce the number of subtractions th
Jeremy wrote:
I just profiled one of my Python scripts and discovered that >99% of
the time was spent in
{built-in method sub}
What is this function and is there a way to optimize it?
Thanks,
Jeremy
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 11, 11:20 am, Jeremy wrote:
> I just profiled one of my Python scripts and discovered that >99% of
> the time was spent in
>
> {built-in method sub}
>
> What is this function and is there a way to optimize it?
I'm guessing this is re.sub (or, more likely, a method sub of an
internal object
In article , Steve Holden
wrote:
>Steve Holden wrote:
>[...]
>> Because I habitually run the NoScript extension to Firefox the popups
>> didn't appear, but there didn't seem to be any original content on this
>> site. Google continues to be your friend.
>>
>And dammit, why didn't I think to stri
In article , Steve Holden
wrote:
>Terry Reedy wrote:
>> On 1/8/2010 11:50 AM, tanix wrote:
>>> Python Goldmine collection contains the extensive collection of articles
>>> going back several years. It includes thousands of code
>>> examples and expert discussions on all major topics.
>>>
>>> The
In article , Terry Reedy
wrote:
>On 1/8/2010 11:50 AM, tanix wrote:
>> Python Goldmine collection contains the extensive collection of articles
>> going back several years. It includes thousands of code
>> examples and expert discussions on all major topics.
>>
>> The information is organized by
MRAB wrote:
Scott wrote:
for prtnmS in open(portfpth):
prtnmS = prtnmS.rstrip()
There's nothing wrong with building dicts or other lookup tables outside
a function in order to avoid re-creating them every time the function is
called.
However, please consider writing complete, pronoun
amadain writes:
> I have an event log with 100s of thousands of entries with logs of the
> form:
>
> uniqueId="1261124569.35725_PFS_1_1340035961">
>
>
>
>
>
>
>
>
>
>
I just profiled one of my Python scripts and discovered that >99% of
the time was spent in
{built-in method sub}
What is this function and is there a way to optimize it?
Thanks,
Jeremy
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 11, 9:28 am, Duncan Booth wrote:
> MRAB wrote:
> >> Yep. Thanks for pointing that out. I guess I just assumed that
> >> re.split was similar to re.search/match/findall in what it accepted as
> >> function parameters. I guess I'll have to use a \n instead of a ^ for
> >> split.
>
> > You
r0g wrote:
> Scott wrote:
>> When creating a function is there any difference between putting
>> everything under the "def" or not?
>>
>> Here I created a function called CscoPortNum to convert the network
>> port number field in a Cisco syslog string from a an ascii name back
>> into its numeric f
I have an event log with 100s of thousands of entries with logs of the
form:
I am using xml.sax to parse the event log. The trouble w
Nobody writes:
> On Sun, 10 Jan 2010 23:13:55 -0800, Dan Bishop wrote:
>
>>> If you actually need to perform comparisons across types, you can rely
>>> upon the fact that tuple comparisons are non-strict and use e.g.:
>>>
>>> > a = 5
>>> > b = '5'
>>> > (type(a).__name__,
On Mon, 11 Jan 2010 18:57:24 +0100, mk wrote:
>> I have two lists of IP addresses:
>>
>> hostips = [ 'a', 'b', 'c', 'd', 'e' ]
>>
>> thread_results = [ 'd', 'b', 'c' ]
>>
>> I need to sort thread_results in the same order as hostips.
>
> P.S. One clarification: those lists are actually more co
Jeremy wrote:
> On Jan 11, 8:44 am, Iain King wrote:
>> On Jan 11, 3:35 pm, Jeremy wrote:
>>
>>
>>
>>
>>
>>> Hello all,
>>> I am using re.split to separate some text into logical structures.
>>> The trouble is that re.split doesn't find everything while re.findall
>>> does; i.e.:
found = re.
Scott wrote:
> When creating a function is there any difference between putting
> everything under the "def" or not?
>
> Here I created a function called CscoPortNum to convert the network
> port number field in a Cisco syslog string from a an ascii name back
> into its numeric form if required. D
On Mon, 11 Jan 2010 23:27:03 +0800, Steven Woody wrote:
> I am using pyserial. But I always get the local echo after I write
> some characters onto serial port and I find no way to disable this
> behavior. When I say 'local echo', I mean the next read operation will
> get characters that was just
Scott wrote:
When creating a function is there any difference between putting
everything under the "def" or not?
Here I created a function called CscoPortNum to convert the network
port number field in a Cisco syslog string from a an ascii name back
into its numeric form if required. Does it mat
On 2010-01-11 12:27 PM, CELEN Erman wrote:
Numeric.log10() will check to see if the errno was set to ERANGE. It does not
check if a floating point exception flag was set, which is tricky to do across
platforms. The newer numpy can do it because we've finally managed to implement
all of that platf
On Mon, 11 Jan 2010 10:09:36 +0100, Martin v. Loewis wrote:
>> In Python 3.1 is there any difference in the buffering behavior of the
>> initial sys.stdout and sys.stderr streams?
>
> No.
>
>> Were they different at some earlier point in Python's evolution?
>
> That depends on the operating sys
mk writes:
> I have two lists of IP addresses:
>
> hostips = [ 'a', 'b', 'c', 'd', 'e' ]
>
> thread_results = [ 'd', 'b', 'c' ]
>
> I need to sort thread_results in the same order as hostips.
Assuming each address in hostips appears just once:
from itertools import izip,count
d = dict(iz
On Sun, 10 Jan 2010 23:13:55 -0800, Dan Bishop wrote:
>> If you actually need to perform comparisons across types, you can rely
>> upon the fact that tuple comparisons are non-strict and use e.g.:
>>
>> > a = 5
>> > b = '5'
>> > (type(a).__name__, a) < (type(b).__name__, b)
mk wrote:
> mk wrote:
>> Hello everyone,
>>
>> I have two lists of IP addresses:
>>
>> hostips = [ 'a', 'b', 'c', 'd', 'e' ]
>>
>> thread_results = [ 'd', 'b', 'c' ]
>>
>> I need to sort thread_results in the same order as hostips.
>
> P.S. One clarification: those lists are actually more com
When creating a function is there any difference between putting
everything under the "def" or not?
Here I created a function called CscoPortNum to convert the network
port number field in a Cisco syslog string from a an ascii name back
into its numeric form if required. Does it matter at all that
mk wrote:
mk wrote:
Hello everyone,
I have two lists of IP addresses:
hostips = [ 'a', 'b', 'c', 'd', 'e' ]
thread_results = [ 'd', 'b', 'c' ]
I need to sort thread_results in the same order as hostips.
P.S. One clarification: those lists are actually more complicated
(thread_result is a
> Numeric.log10() will check to see if the errno was set to ERANGE. It does not
> check if a floating point exception flag was set, which is tricky to do
> across
> platforms. The newer numpy can do it because we've finally managed to
> implement
> all of that platform-specific code, but the e
mk writes:
> Hello everyone,
>
> I have two lists of IP addresses:
>
> hostips = [ 'a', 'b', 'c', 'd', 'e' ]
>
> thread_results = [ 'd', 'b', 'c' ]
>
> I need to sort thread_results in the same order as hostips.
[...solution:]
> hostips_limited = []
> for h in hostips:
> if h in thread_resul
mk wrote:
Hello everyone,
I have two lists of IP addresses:
hostips = [ 'a', 'b', 'c', 'd', 'e' ]
thread_results = [ 'd', 'b', 'c' ]
I need to sort thread_results in the same order as hostips.
P.S. One clarification: those lists are actually more complicated
(thread_result is a list of tup
mk wrote:
Incidentally, it *seems* that list comprehension preserves order:
hostips_limited = [ h for h in hostips if h in thread_results ]
Empirically speaking it seems to work (I tested it on real ips), but
please correct me if that's wrong.
Regards,
mk
Sounds good to me.
List are *o
Hello everyone,
I have two lists of IP addresses:
hostips = [ 'a', 'b', 'c', 'd', 'e' ]
thread_results = [ 'd', 'b', 'c' ]
I need to sort thread_results in the same order as hostips.
(Obviously, hostips can contain any valid ip addresses as strings, they
are sorted alphabetically here just f
Kevin Walzer a écrit :
I'm trying to make use of a Python library, aemreceive, that provides a
procedural API. (aemreceive is a library for Python on the Mac that
allows the application to receive and respond to Apple Events.)
My Python apps basically run in a single fooApp class, and everythi
Austyn wrote:
Here's an improvement in case you want your code to work outside of
Arizona:
from time import time, timezone
h = ((time() - timezone) / 3600) % 24
On Jan 10, 9:04 pm, Austyn wrote:
How about:
import time
arizona_utc_offset = -7.00
h = (time.time() / 3600 + arizona_utc_offset) %
1 - 100 of 143 matches
Mail list logo