On Apr 17, 4:54 am, Nigel Rantor wrote:
> Adam Olsen wrote:
> > On Apr 16, 11:15 am, SpreadTooThin wrote:
> >> And yes he is right CRCs hashing all have a probability of saying that
> >> the files are identical when in fact they are not.
>
> > Here'
On Apr 16, 3:16 am, Nigel Rantor wrote:
> Adam Olsen wrote:
> > On Apr 15, 12:56 pm, Nigel Rantor wrote:
> >> Adam Olsen wrote:
> >>> The chance of *accidentally* producing a collision, although
> >>> technically possible, is so extraordinarily rare that it's completely
> >>> overshadowed by the
On Apr 15, 8:04 am, Grant Edwards wrote:
> On 2009-04-15, Martin wrote:
>
>
>
> > Hi,
>
> > On Mon, Apr 13, 2009 at 10:03 PM, Grant Edwards wrote:
> >> On 2009-04-13, SpreadTooThin wrote:
>
> >>> I want to compare two binary files and se
I want to compare two binary files and see if they are the same.
I see the filecmp.cmp function but I don't get a warm fuzzy feeling
that it is doing a byte by byte comparison of two files to see if they
are they same.
What should I be using if not filecmp.cmp?
--
http://mail.python.org/mailman/li
On Apr 13, 2:37 pm, Grant Edwards wrote:
> On 2009-04-13, Grant Edwards wrote:
>
>
>
> > On 2009-04-13, SpreadTooThin wrote:
>
> >> I want to compare two binary files and see if they are the same.
> >> I see the filecmp.cmp function but I don't get
On Apr 13, 2:03 pm, Grant Edwards wrote:
> On 2009-04-13, SpreadTooThin wrote:
>
> > I want to compare two binary files and see if they are the same.
> > I see the filecmp.cmp function but I don't get a warm fuzzy feeling
> > that it is doing a byte by byte compariso
On Apr 13, 2:00 pm, Przemyslaw Kaminski wrote:
> SpreadTooThin wrote:
> > I want to compare two binary files and see if they are the same.
> > I see the filecmp.cmp function but I don't get a warm fuzzy feeling
> > that it is doing a byte by byte comparison of two fi
I am wondering if someone who knows the implemention of python's time
could help converting this to c/c++
nanoseconds = int(time.time() * 1e9)
# 0x01b21dd213814000 is the number of 100-ns intervals between
the
# UUID epoch 1582-10-15 00:00:00 an
Bruno Desthuilliers wrote:
> SpreadTooThin a écrit :
> > Bruno Desthuilliers wrote:
> >
> >>Nick Vatamaniuc a écrit :
> >>(snip)
> >>
> >>>In Python all the primitives are copied and all other entities are
> >>>references.
> &
Bruno Desthuilliers wrote:
> Nick Vatamaniuc a écrit :
> (snip)
> > In Python all the primitives are copied and all other entities are
> > references.
>
> Plain wrong. There's no "primitives" (ie : primitive data types) in
> Python, only objects. And they all get passed the same way.
so..
def fn
J. Clifford Dyer wrote:
> SpreadTooThin wrote:
> > J. Clifford Dyer wrote:
> >> SpreadTooThin wrote:
> >>> Steven D'Aprano wrote:
> >>>> On Mon, 30 Oct 2006 13:10:47 -0800, SpreadTooThin wrote:
> >>>>
> >>>>
> &g
J. Clifford Dyer wrote:
> SpreadTooThin wrote:
> > Steven D'Aprano wrote:
> >> On Mon, 30 Oct 2006 13:10:47 -0800, SpreadTooThin wrote:
> >>
> >>>>> How do I specify or create deep copies of objects that may contain
> >>>>>
Steven D'Aprano wrote:
> On Mon, 30 Oct 2006 13:10:47 -0800, SpreadTooThin wrote:
>
> >> > How do I specify or create deep copies of objects that may contain
> >> > other objects that may contain other object that may contain other
> >> > objects
Marc 'BlackJack' Rintsch wrote:
> In <[EMAIL PROTECTED]>, SpreadTooThin
> wrote:
>
> > I'm really worried that python may is doing some things I wasn't
> > expecting... but lets see...
>
> Expect that Python never copies something if don'
Marc 'BlackJack' Rintsch wrote:
> In <[EMAIL PROTECTED]>, SpreadTooThin
> wrote:
>
> > I'm really worried that python may is doing some things I wasn't
> > expecting... but lets see...
>
> Expect that Python never copies something if don'
I'm really worried that python may is doing some things I wasn't
expecting... but lets see...
if I pass a list to a function def fn(myList):
and in that function I modify an element in the list, then does the
callers list get modied as well.
def fn(list):
list[1] = 0
myList = [1, 2, 3]
print
Paul Rubin wrote:
> "SpreadTooThin" <[EMAIL PROTECTED]> writes:
> > print a.mean()
> > print a.std_dev()
> >
> > Is there a way to calculate the mean and standard deviation on array data?
>
> Well, you could use numpy or whatever. If you want to
import array
a = array.array('f', [1,2,3])
print a.mean()
print a.std_dev()
Is there a way to calculate the mean and standard deviation on array
data?
Do I need to import it into a Numeric Array to do this?
--
http://mail.python.org/mailman/listinfo/python-list
Why is it that (On MAC OS X) in Komodo 3.5 Professional, if I try to
find something in my script,
I am unable to change the text it is searching for?
--
http://mail.python.org/mailman/listinfo/python-list
Hi I need to get a for loop to give me an element from a list and an
index number...
for example:
i = 0
l = ['a','b','c']
for e in l:
print l, i
i = i + 1
Is there a way to get rid of the i processing in this script?
Sorry I'm still trying to learn python tricks here...
--
http://mail.pyt
Hi I'm writing a python script that creates directories from user
input.
Sometimes the user inputs characters that aren't valid characters for a
file or directory name.
Here are the characters that I consider to be valid characters...
valid =
':./,^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLM
Tim Chase wrote:
> > for example:
> > a = [1,2,3,4,5,6,7,8,9,10] #Although not necessarily in order
> >
> > def cmp(i,j): #to be defined in this thread.
>
> Well, if you're willing to give up doing it in a cmp() method,
> you can do it as such:
>
> >>> a.sort()
> >>> chunk_size = 3
> >>> [a[i:
SpreadTooThin wrote:
> Simon Brunning wrote:
> > On 10/16/06, Simon Brunning <[EMAIL PROTECTED]> wrote:
> > > >>> a = [1,2,3,4,5,6,7,8,9,10]
> > > >>> a.sort(key=lambda item: (((item-1) %3), item))
> > > >>> a
> > > [1,
Simon Brunning wrote:
> On 10/16/06, Simon Brunning <[EMAIL PROTECTED]> wrote:
> > >>> a = [1,2,3,4,5,6,7,8,9,10]
> > >>> a.sort(key=lambda item: (((item-1) %3), item))
> > >>> a
> > [1, 4, 7, 10, 2, 5, 8, 3, 6, 9]
>
> Re-reading the OP's post, perhaps sorting isn't what's required:
>
> >>> a[::3]
Fredrik Lundh wrote:
> SpreadTooThin wrote:
>
> > I have a list and I need to do a custom sort on it...
>
> > Its more like
> > 1 4 7 10
> > 2 5 8
> > 3 6 9
>
> that's trivial to do with slicing, of course. what makes you think you
> need to
I have a list and I need to do a custom sort on it...
for example:
a = [1,2,3,4,5,6,7,8,9,10] #Although not necessarily in order
def cmp(i,j): #to be defined in this thread.
a.sort(cmp)
print a
[1,4,7,10, 2,5,8, 3,6,9]
So withouth making this into an IQ test.
Its more like
1 4 7 10
2 5 8
3 6
Daniel Nogradi wrote:
> > Can these operators be overloaded?
> > If so. How?
> >
>
> http://www.python.org/doc/ref/numeric-types.html
>
> HTH,
> Daniel
Thanks everyone.
--
http://mail.python.org/mailman/listinfo/python-list
Can these operators be overloaded?
If so. How?
--
http://mail.python.org/mailman/listinfo/python-list
Hi... Many python object can be printed simpy by saying:
print obj
what method(s) need to be implemented in my own classes such that print
dumps the object?
--
http://mail.python.org/mailman/listinfo/python-list
Jean-Paul Calderone wrote:
> On 5 Oct 2006 07:01:50 -0700, SpreadTooThin <[EMAIL PROTECTED]> wrote:
> > [snip]
> >
> >Jean-Paul many thanks for this and your effort.
> >but why is it every time I try to do something with 'stock' python I
> >nee
Jean-Paul Calderone wrote:
> On 4 Oct 2006 19:31:38 -0700, SpreadTooThin <[EMAIL PROTECTED]> wrote:
> >client:
> >
> >import socket
> >s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> >s.connect(("192.168.1.101", 8080))
> >print
client:
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("192.168.1.101", 8080))
print 'Connected'
s.send('ABCD')
buffer = s.recv(4)
print buffer
s.send('exit')
server:
serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serversocket.bind(("192.168.1.1
Peter Otten wrote:
> SpreadTooThin wrote:
>
> > If you are deriving a new class from another class,
> > that you must (I assume) know the initializer of the other class.
> >
> > So in myClass
> >
> > import array
> > class myClass(arrary.array):
If you are deriving a new class from another class,
that you must (I assume) know the initializer of the other class.
So in myClass
import array
class myClass(arrary.array):
def __init__(self, now here I need to put array's constructor
parameters..., then mine):
array.array.__init__(self
Thomas Jollans wrote:
> On Tue, 03 Oct 2006 10:29:00 -0700, "SpreadTooThin" <[EMAIL PROTECTED]>
> let this slip:
>
> > I was under the impression that a file and socket were interchangable
> > (like a file descriptor). Does anyone have an idea that might
Hi I am using arrays in an application.
They have been working very well for me as I have been using them for
reading and writing data to and from files whose endianisms can be big
or little endian.
However now I need handle data that can be transferred over a socket.
I would rather not have to go
Robert Kern wrote:
> [EMAIL PROTECTED] wrote:
> > To your question on casting long to short. This is how:
> > a=1234L # long
> > b=int(a) # int (short)
>
> No, a Python int is a C long. A Python long is an arbitrary-precision number
> and
> does not correspond to any C type.
>
> --
So
Basically I think the problem is in converting from a 32 bit integer to
a 16 bit integer.
I have two arrays:
import array
a = array.array('L', [65537])
b = array.array('H', [0])
b[0] = a[0]
Which gives an overflow message
So can't I truncate the long by discaring the upper bits ..
Like b[0
f = open('myfile.bin', 'rb')
How do I know if there was an error opening my file?
--
http://mail.python.org/mailman/listinfo/python-list
How do I define a constant that I can use in my script...
For example lets say I have a file called constants.py and in there I
have PI = 3.14
in my test script I do:
from constants import *
How do I access PI later on?
Pardon my newbie questions...
--
http://mail.python.org/mailman/listinfo
How does one get the process id?
Is there a method for windows and unix (mac os x etc...)
--
http://mail.python.org/mailman/listinfo/python-list
Tim Peters wrote:
> [Marc 'BlackJack' Rintsch]
> >> What about:
> >>
> >> b = array.array('f', a)
>
> [Diez B. Roggisch]
> > AFAIK d and f are synonym for arrays, as python doesn't distinguish
> > between these two on a type-level. And double it is in the end.
>
> While Python has no type of its o
I have some code...
import array
a = array.array('d')
f = open('file.raw')
a.fromfile(f, 10)
now I need to convert them into floats (32 bit...) what do i do?
--
http://mail.python.org/mailman/listinfo/python-list
43 matches
Mail list logo