On Mon, Oct 27, 2008 at 4:29 PM, Mark <[EMAIL PROTECTED]> wrote:
> Hi;
>
> I'm trying to use the struct.unpack to extract an int, int, char
> struct info from a file. I'm more accustomed to the file.readlines
> which works well in a 'for' construct (ending loop after reaching
> EOF).
>
> # This do
> For efficiency reasons many CPUs require particular primitive data
> types (integers/pointers of various sizes) to be placed in memory at
> particular boundaries. For example, shorts ("H" above, usually two bytes
> and probably always so in the struct module) are often required to be
> on even ad
On Wed, Jun 25, 2008 at 7:03 PM, John Machin <[EMAIL PROTECTED]> wrote:
> On Jun 26, 9:00 am, "Steven Clark" <[EMAIL PROTECTED]> wrote:
>> Can anyone explain to me why
>> struct.pack('HB',1,2) gives 3 bytes, whereas struct.pack('BH'
Can anyone explain to me why
struct.pack('HB',1,2) gives 3 bytes, whereas struct.pack('BH',1,2)
gives 4 bytes?
-Steven
--
http://mail.python.org/mailman/listinfo/python-list
> Hello ,
> following scenario
>
> list_current = [ "welcome", "search", "done", "result"]
> list_ldap = [ "welcome", "hello"]
>
> result:
>
> list_toadd = [ "hello"]
>
> by words said , i want to check if list item from list_ldap exists in
> list_current if not i want to add it to list_toadd.
>
>
>
> for 1 in oids, vals head_oids:
> SyntaxError: can't assign to literal
> --
1 is a literal, you can't assign it to something. Are you trying to
use it as a variable name?
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Jun 10, 2008 at 5:30 PM, maehhheeyy <[EMAIL PROTECTED]> wrote:
> On Jun 10, 1:21 pm, Matimus <[EMAIL PROTECTED]> wrote:
>> On Jun 10, 12:53 pm, maehhheeyy <[EMAIL PROTECTED]> wrote:
>>
>> > this is stopping my program from running properly. is there something
>> > wrong in my code when that
http://www.ferg.org/projects/python_gotchas.html#contents_item_6
On Mon, May 19, 2008 at 10:30 AM, cseja <[EMAIL PROTECTED]> wrote:
> If I call
>
> print walk([1,2,3], [])
> print walk([5,6,7])
>
> I get
>
> [1, 2, 3]
> [4, 5, 6]
>
> but when I call
>
> print walk([1,2,3])
> print walk([5,6,7])
>
> > I believe the best way to implement this would be a binary search
> > (bisect?) on the actual times, which would be O(log N). Though since
> > they are timestamps they should be monotonically increasing, in which
> > case at least you don't have to go to the expense of sorting them.
> >
> > "So
> bisect is definitely the way to go. You should take care with
> floating point precision, though. One way to do this is to choose a
> number of digits of precision that you want, and then internally to
> your class, multiply the keys by 10**precision and truncate, so that
> you are working
> You can pass a cmp-function that will always make one object being greater
> than all others.
>
> Diez
> --
Yeah, I figured it out 2 minutes after I posted, d'oh!
class Anvil(object):
def __cmp__(self. other):
return 1
Sorry for the wasted space.
--
http://mail.python.org/ma
If I have a list of items of mixed type, can I put something into it
such that after a list.sort(), is guaranteed to be at the end of the
list?
Looking at http://www.python.org/doc/2.3.5/ref/comparisons.html
"Most other types compare unequal unless they are the same object; the
choice whether one
Hi all-
I'm looking for a data structure that is a bit like a dictionary or a
hash map. In particular, I want a mapping of floats to objects.
However, I want to map a RANGE of floats to an object.
This will be used for timestamped storage / lookup, where the float
represents the timestamp.
get(x)
print sum([ord(ch)-96 for ch in small])
On Mon, Mar 17, 2008 at 11:28 PM, <[EMAIL PROTECTED]> wrote:
> I'm trying to convert a name into a numerical value that is not
> consistent with ANSCII values. In my case, I convert all to lowercase,
> then try to sum the value of the letters entered by t
Why not make chromosome itself a class?
class BasicChromosome(object):
def __init__(self, data):
self.data = data
def crossover(self):
[stuff here]
You can subclass this as needed, altering the crossover method as necessary.
...perhaps I didn't understand your question.
> l = []
> l.append(man)
> l.append(woman)
>
> # Print the state.
> for item in l:
> print item.state()
>
>
Small, off-topic nitpick:
please don't use "l" (lower-case el) as a variable name.
>From http://www.python.org/dev/peps/pep-0008/:
"Naming Conventions
Names to Avoid
Never use the cha
On Jan 10, 2008 4:54 PM, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Adrian Wood wrote:
>
> > I can call man.state() and then woman.state() or Person.state(man) and
> > Person.state(woman) to print the status of each. This takes time and
> > space however, and becomes unmanageable if we start talki
On Dec 20, 2007 10:30 PM, Terry Reedy <[EMAIL PROTECTED]> wrote:
>
> "PatrickMinnesota" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> | I think I need at least this: 2D graphics, sound, input (kbd, mouse,
> | joystick maybe), some IPC might be nice (Stuff like: Sockets, TCP,
> |
Hi all-
I was reading http://dirtsimple.org/2004/12/python-is-not-java.html, in
particular the part about "getters and setters are evil":
"In Java, you have to use getters and setters because using public fields
gives you no opportunity to go back and change your mind later to using
getters and set
19 matches
Mail list logo