On 23 June 2010 00:06, Neil Webster wrote:
> Hi all,
>
> I've got a simple problem but it's defeated me and I was wondering if
> somebody could point out where I'm going wrong or offer an alternative
> solution to the problem?
>
> I have a list of lists such as [[a,2,3,4],[b,10,11,12], [a,2,3,4]]
erent ways of launching
the program. And share with us what you did to run this to begin with, that
might help as well.
Best regards,
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavierho.com
Website: http://xav
I'm quite curious as to why you would like it, because:
>>> MyClass
(returns the MyClass class representation)
>>> MyClass()
(returns a instance of the MyClass class)
So, are you just looking for a method that does exactly the above?
Best regards,
Ching-Yun "
:
print applicant(random.randint(0,100),
random.randint(0,100)).randomnum
==
Or you could just use randint() if you only wanted a linear distribution.
PS: Thanks, btw, new to python myself also, and looking into this was cool.
:]
hat was to print out 10 random samples.
If you're not sure if this is what you want, then um.. not much I can do
there. What is this class originally for?
If you feel the clamp is too huge, well, I'm always interested in
improvements/alternatives!
Best regards,
Ching-Yun "Xavier"
to begin?
>
> x = max(0, min(100, normalvariate(x, y)))
>
>
That is an awesome way of shorthanding clamp.
Best regards,
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavierho.com
Website: http://xavier
x27;m just getting this "necessary" step because my books say so. If anyone
has a good explanation, please do tell.
Best regards,
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavierho.com
Website: http://x
(arg, MRAB, sorry, wrong address!)
Defining None to 0 is a bad idea. You'll have trouble debugging later on.
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavierho.com
Website: http://xavierho.com/
On Tu
ding to mailing list for some reason. What happend to the
reply-to request? =/)
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavierho.com
Website: http://xavierho.com/
--
http://mail.python.org/mailman/listinfo/python-list
command like this:
python .py
That should do the trick. Alternatively, you can type in python and start
the python shell in the same folder.
Then you can just do import and whatever you like. :]
Best regards,
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04
ing is 40x slower, and was expected. But I still
can't puzzle out why his use of appending in Version B was so much faster
than mine.
Any insights would be welcome. I'm going on a family trip, though, so my
replies may delay.
Best regards,
Ching-Yun "Xavier" Ho, Technical Arti
Thanks for the response all, I finally got my 'net working on the mountains,
and I think your reasons are quite sound. I'll keep that in mind for the
future.
Best regards,
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID:
lines = f0.readlines()*
Then in the for loop, change f1 to
*f1=lines[i].split()*
That may just stop it from complaining.
Untested, but logically it's sound.
Hope that works,
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaX
e list mycontacts ,like
> mycontacts_numbers=3 <http://mail.python.org/mailman/listinfo/python-list>
>
>>> len(emails['mycontacts'])
3
HTH,
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavierho.com
Website: http://xavierho.com/
--
http://mail.python.org/mailman/listinfo/python-list
w, but I'm probably missing something. Any pointers would
be great.
Best regards,
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavierho.com
Website: http://xavierho.com/
--
http://mail.python.org/mailman/listinfo/python-list
I see. Thanks!
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavierho.com
Website: http://xavierho.com/
On Tue, Jul 14, 2009 at 11:20 PM, Jochen Schulz wrote:
> Xavier Ho:
> >
> > Why doesn
see? the while body ran for about 7 seconds... i bet it has to do with the
> fact that the timer does not control inner loops... any suggestion?
>
>
I'm guessing it has to do with a sleep of 0.66 seconds x 10 times = sleep
for 6.6 seconds, and then it checks for e.isSet().
Best rega
pends it into primes.
This way, it keeps trying to append until the nth prime requested exist, and
returns it.
My problem is that it's a "While True" loop, which I get a lot of "Don't do
it!" In the light of making the code better, what could I do?
Best regards,
, common sense. Also... "while True" has a bad reputation.
But mostly outside influences.
But if it's okay, it's okay by me.. I can't think of an easier way to code
the "try loop" above, anyhow.
Ching-Yun "Xavier" Ho, Technical Artist
Contact Informa
as well as the previous version, but slightly safer on my
part... and I can adapt this in my future coding habits.
Thanks again.
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavierho.com
Website: http
erate from n=2 and on every
time, which makes generation time linear.
However, I just gave the link's code a quick try. It was at least 10x times
faster than my code to generate 100000 prime numbers - I'll have a closer
look.
Thanks a great deal.
Ching-Yun "Xavier" Ho, Technical
gt; is not really an exceptional case.
>
> If you insists on using a try-except clause, use it this way:
>
> Well, I don't have to use try-except. I think I got another idea though. I
could use an internal counter to keep track of how many prime numbers have
generated, and if not eno
.
Right, so for i in xrange() would be a better choice?
Best regards,
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavierho.com
Website: http://xavierho.com/
--
http://mail.python.org/mailman/listinfo/python-list
#x27;
^
SyntaxError: invalid syntax
So, uh, I'm wondering if this is a bug. And also the solution to his
problem.
Good luck. Any ideas appreciated.
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavierho.com
Website: http://xavierho.com/
--
http://mail.python.org/mailman/listinfo/python-list
>
> val('self.' + attr + '=\'' + val + '\'')
>
Obviously that was eval, not val. Also it doesn't work without the escaped
single quotes, either.
--
http://mail.python.org/mailman/listinfo/python-list
Got it:
exec('self.' + attr + '=\'' + val + '\'')
That worked. I think it'll do what you want now ;)
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavierho.com
W
> What is the point of the _SetVar method?
>
>
So you can set any variable in that class, I guess?
--
http://mail.python.org/mailman/listinfo/python-list
op.
Either way works!
Best regards,
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavierho.com
Website: http://xavierho.com/
On Wed, Jul 29, 2009 at 6:21 AM, writeson wrote:
> David,
>
> Thanks fo
k of. It's a lot slower, but
definitely more space than your RAM.
Good luck,
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavierho.com
Website: http://xavierho.com/
--
http://mail.python.org/mailman/listinfo/python-list
>
> superpollo wrote:
>
>>
>> for (i, e) in enumerate(nomi):
>>print i, "-", e
>>
>> Just to be random:
print '\n'.join(["%s - %s" % (i, e) for i, e in enumerate(nomi)])
This has one advantage: only print once. So it's slightly faster if you have
a list of a large amount.
--
http://mail.pyth
On Wed, Jul 29, 2009 at 8:52 PM, MRAB wrote:
> Slightly shorter:
>
> print '\n'.join("%s - %s" % p for p in enumerate(nomi))
>
> :-)
>
That's cool. Does that make the "list" a tuple? (not that it matters, I'm
just curious!)
I just tested for a list of 1000 elements (number in letters from 1 to 1
Ack, sent to the wrong email again.
On Wed, Jul 29, 2009 at 9:02 PM, superpollo wrote:
>
> >>> print '\n'.join("%s - %s" % p for p in enumerate(nomi))
> File "", line 1
>print '\n'.join("%s - %s" % p for p in enumerate(nomi))
>^
> SyntaxError: invalid syn
On Wed, Jul 29, 2009 at 9:17 PM, MRAB wrote:
> I've just replaced the list comprehension with a generator expression.
>
>
Oh, and that isn't in Python 2.3 I see. Generators are slightly newer,
eh.
Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
Is this a spam? Why did you have to send it 4 times, and it's already in the
past (July 9 and 10) ?
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavierho.com
Website: http://xavierho.com/
--
http://
Whoops, posted to the wrong address yet again.
I deserve some punishment.
On Fri, Jul 31, 2009 at 5:33 PM, Xavier Ho wrote:
> On Fri, Jul 31, 2009 at 5:25 PM, MalC0de wrote:
>
>>
>> while true :
>>
>> where's the problem,
>
>
> There
On Fri, Jul 31, 2009 at 6:08 PM, Masklinn wrote:
> ... but since Python doesn't have anonymous functions that usage
> tends to be a bit too verbose ...
>
Sorry to interrupt, but wouldn't lambda in Python be considered as
'anonymous functions'?
--
http://mail.python.org/mailman/listinfo/python-
On Fri, Jul 31, 2009 at 6:25 PM, Chris Rebert wrote:
> I believe "full" anonymous functions was intended by the author.
> lambdas are limited to a single expression. "Full" anonymous functions
> would be allowed to contain multiple statements.
>
> Cheers, but what about this:
def goBig(x):
On Fri, Jul 31, 2009 at 6:38 PM, Chris Rebert wrote:
> No, because it has a name, namely "goBig"; this obviously prevents it
> from being "anonymous".
>
> For comparison, note how the function in the following example is
> never given a name, and is thus anonymous:
> >>> (lambda x: x+5)(6)
> 11
>
On Fri, Jul 31, 2009 at 7:25 PM, learner learner wrote:
> Hi all,
>
> I want to compare two text files line by line and eliminate the
> matching/repeated line and store the unmatched/leftout lines into a third
> file or overwrite into one of them.
>
Sounds like homework to me. Why not look into:
roup.
Well, some people have suggested to use that inside Python. That would work,
right?
Although, if you're just trying to find the Python-equivalent, fair enough.
Regards,
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
E
c loader, and
only load pictures as relevant (i.e: visible, and next to visible)
Think how Google Maps do it. They can't possibly upload 5GB of pictures
every time you access Maps - that wouldn't have worked. They work with the
only visible areas.
If you could tell us exactly wh
On Tue, Aug 4, 2009 at 8:30 PM, Yinon Ehrlich wrote:
> Hi,
> Easy way to test for Python version:
> if sys.hexversion >= 0x2060100:
> pass
>
Great suggestion. I just tested it on my newly installed Python 3.1 (as of
3.1r31)
>>> import sys
>>> "%X" % sys.hexversion
'30100F0'
That's genius - '3
On Tue, Aug 4, 2009 at 9:34 PM, Xavier Ho wrote:
> ... and '00F0' is r31!
>
Actually, 00F0 is 576 in decimal. Maybe it's the subversion?
Anyhow, it's still good!
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Aug 5, 2009 at 12:17 AM, MRAB wrote:
> 0x00F0 is 240.
... Right. I wonder where my brain is. *searches pocket*
So, what am I doing wrong here?
>>> int(str(0x00F0), 16)
576
Cheers,
-Xav
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Aug 5, 2009 at 12:44 AM, D'Arcy J.M. Cain wrote:
> On Wed, 5 Aug 2009 00:39:56 +1000
>> Xavier Ho wrote:
>> > So, what am I doing wrong here?
>> >
>> > >>> int(str(0x00F0), 16)
>>
>> Look at the output of str(0x00F0) for a
On Wed, Aug 5, 2009 at 10:50 PM, kpal wrote:
> Hello Everybody,
>
> The standard datetime has 1 microsecond granularity. My application
> needs finer time resolution, preferably float seconds. Is there an
> alternative to the out-of-the-box datetime? Timezone support is not
> essential.
This is
Mapping might be of your interest.
> Another guy have reported me that he experiences similar problems with
> subclassing builtin 'list'.
Similarly, UserList is what you should subclass.
HTH,
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+6
On Thu, Aug 6, 2009 at 5:23 AM, Joshua Kugler wrote:
> Are you referring to Python 3.0? Python 2.6 does not have
> collections.UserDict
>
> j
>
Yes, I was sometimes it's hard to keep track what's not in 2.6 and in
3.1 for me, sorry. And thanks.
The ABC MutableMapping is still valid, though.
On Thu, Aug 6, 2009 at 12:17 PM, cocobear wrote:
>
> I want to view image use Windows Pic View.
>
> If you run out of memory trying to combining those images into a 30k by 40k
pixels image, the Windows Pic View isn't going to be able to display it
either.
Regards,
Chin
On Thu, Aug 6, 2009 at 1:19 PM, alex23 wrote:
> Xavier Ho wrote:
> > You should subclass collections.UserDict, and not the default dict class.
> > Refer to the collections module.
>
> Xavier, why do you think that is the correct approach?
I'll be honest first and sa
# Do for New DNA Sequence
# ...
else:
line = line[:-76]
# ...
Should do what you need.
Best regards,
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavierho.com
Website: http://xavierho.com/
--
http://mail.python.org/mailman/listinfo/python-list
Well, it's back up now.
At least for me. ;)
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavierho.com
Website: http://xavierho.com/
On Sun, Aug 9, 2009 at 4:49 AM, Sharath wrote:
> On Aug
On Sun, Aug 9, 2009 at 6:37 AM, Aahz wrote:
> www.python.org is currently having hardware problems
>
So what I'm seeing is an illusion? It works as of now.
- Xavier
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, Aug 10, 2009 at 10:41 PM, Christopher wrote:
>
> Actually, it appears to be down again.
>
Nope, works for me, just a little slow.
-Xav
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Aug 12, 2009 at 3:29 AM, Maria Liukis wrote:
> Hello everybody,
> Is somebody aware of built-in Python's function that would return
> a value for smallest positive double precision floating point number
> (analogous to 'realmin' in Matlab). Python has built-in sys.maxint but I
> could not
I got it to work with Python 2.6.2.
>>> import struct
>>> struct.unpack('d', struct.pack('Q', 1))[0]
4.9406564584124654e-324
Python 3.1 will print 5e-324, which is fair enough.
Cheers,
Xavier
--
http://mail.python.org/mailman/listinfo/python-list
Actually, that was double precision. You asked for float precision.
>>> struct.unpack('f', struct.pack('L', 1))[0]
1.4012984643248171e-45
which is the same as:
>>> 2**-149
1.4012984643248171e-45
I think that's it. Sorry for posting to the list three times in a row.
corrections welcome.
--
http:
mewhere, I apologise in advance.
Already googled around but I didn't find information on this.
Any replies appreciated.
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavierho.com
Website: http://xavierho.com/
-
-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavierho.com
Website: http://xavierho.com/
--
http://mail.python.org/mailman/listinfo/python-list
he rich comparison special methods, etc.
Also, I noticed heapq (the priority queue/heap queue module) doesn't use the
natural sorting order like sorted() does. Just saying. Could someone give it
a try?
Regards,
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mo
give that a test tomorrow and see what I can come up with.
Thanks for the quick info.
Regards,
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavierho.com
Website: http://xavierho.com/
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, Aug 16, 2009 at 10:33 PM, Mark Lawrence wrote:
>
> I wasn't discussing __cmp__, I was referring to the quote by Chris Rebert
> from the Python docs regarding the rich comparison methods, a discrepancy
> between the documentation and the implementation as noted in the link that I
> gave, an
On Tue, Aug 18, 2009 at 2:45 PM, naveen wrote:
> Is it possible to split up a class definition over multiple files?
> -
Answer in short, I don't think so.
Now why would you want to do that?
There is another solution - have a main class for shared methods, and have
other classes [in different
On Wed, Aug 19, 2009 at 5:57 PM, digisat...@gmail.com
wrote:
> Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
> [GCC 4.3.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> ' test\ttest'.expandtabs(4)
> ' test test'
> >>> 'test \ttest'.expandtabs(4)
On Wed, Aug 19, 2009 at 7:00 PM, Horst Jäger wrote:
> Hi,
>
> I would like to create my own lib "hotte.py" which I can import like
>
>
>import string,hotte
>
> . How do I do that?
>
1) Have the hotte.py in the same directory of any of your other Python code
that imports it, or
2) Put the
On Thu, Aug 20, 2009 at 10:07 PM, Yan Jian wrote:
>
> Does anyone encounter similar situation. Thank you for your help?
>
Yeah, in Python 3.1 I get this:
Traceback (most recent call last):
File "test.py", line 6, in
binhex.binhex(file, sys.stdout)
File "c:\Python31\lib\binhex.py", lin
On Sat, Aug 22, 2009 at 6:17 PM, flagmino wrote:
> To get familiar with the debugger, I have loaded this program:
>
> import math
>
> def s1(x, y):
> a = (x + y)
> print("Answer from s1"), a
> return
>
> def s2(x, y):
> b = (x - y)
> print("This comes from s2"), b
> #print z
> print
On Sun, Aug 23, 2009 at 9:26 PM, newbie wrote:
> Hi all
> I'm interested in developing computer based, interactive programs for
> students in a special school who have an aversion to pen and paper.
What sort of interactive program? Would it be educational, for example?
> I've searched the net
I'm not really quite sure what voodoo I did here, but my code seems to work
in Python 3.1.1 in the following way:
class Demo(object):
def func(self, n):
return n * 5
_f = func(None, 5)
d = Demo()
print(d._f)
print(d.func(5))
# OUTPUT
25
25
So, hmm?
Regards,
Ching-Yun &q
On Wed, Aug 26, 2009 at 2:14 AM, Diez B. Roggisch wrote:
>
> Classes are not scopes.
>
> So the above doesn't work because name resolution inside functions/methods
> looks for local variables first, then for the *global* scope. There is no
> class-scope-lookup.
Sorry, I'm coming here with sincer
I haven't tested it, but did you encounter a problem defining __iadd__ in
the class definition?
See:
http://docs.python.org/reference/datamodel.html#object.__iadd__
Cheers,
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaX
marks bold. Does __ mark underline? Those are cool things
I never hear about. Thanks!
On another tangent, I only found out the Python Wiki on the official site
today (http://wiki.python.org/moin/) Does anyone actually use it, and what
for?
-
Kind regards,
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavierho.com
Website: http://xavierho.com/
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Aug 25, 2009 at 3:43 AM, Emanuele D'Arrigo wrote:
> Let's say I have a list accessed by two threads, one removing list
> items via "del myList[index]" statement the other iterating through
> the list and printing out the items via "for item in myList:"
> statement.
I tried something sim
On Fri, Aug 28, 2009 at 9:49 AM, kj wrote:
>
> Miles Kaufmann writes:
>
> >...because the suite
> >namespace and the class namespace would get out of sync when different
> >objects were assigned to the class namespace:
>
> >class C:
> > x = 1
> > def foo(self):
> > print x
> > pr
On Fri, Aug 28, 2009 at 1:27 PM, Miles Kaufmann wrote:
> You're right, of course. If I had been thinking properly, I would have
> posted this:
>
> ... the suite namespace and the class namespace would get out of sync when
> different objects were assigned to the class namespace:
I'm not an exp
On Fri, Aug 28, 2009 at 1:48 PM, Xavier Ho wrote:
>
> Class already provides some kind of scoping/namespace, that is the locals()
> method for the class. What is pypothetical about this, if you could
> elaborate?
>
Obviously that was supposed to be "hypotheti
On Fri, Aug 28, 2009 at 1:52 PM, Duke Normandin wrote:
> How do I convert the contents of "op" from a string to an actual
> arithmetic operator? eval() does not seem to be the answer. TIA!
Maybe you were looking for
print eval(num1 + op + num2) # it's a little ugly string concatenation.
Hm? (
On Fri, Aug 28, 2009 at 2:35 PM, Ben Finney
> wrote:
>import operator
>
>op_funcs = {
>'+': operator.add,
>'-': operator.sub,
>'*': operator.mul,
>'/': operator.div,
>}
>
>num_1 = int(raw_input('Enter the first number: '))
>num_2 = int(raw_i
On Fri, Aug 28, 2009 at 5:45 PM, hoffik wrote:
> Hello,
>
> I'm quite new in Python and I have one question. I have a 2D matrix of
> values stored in list (3 columns, many rows). I wonder if I can select one
> column without having to go through the list with 'for' command.
As far as I know tho
On Fri, Aug 28, 2009 at 6:18 PM, Hendrik van Rooyen wrote:
> It would really be nice if the "reply" would go to the list, but for the
> digest versions, at least, it does not.
I'm on a few other lists. The Python ones are the only ones that I have to
manually change.
The Nuke-user mailing list
On Fri, Aug 28, 2009 at 6:54 PM, Ben Finney
> wrote:
> Fortunately, the messages that come from the list enable any mail client
> to know the correct address for “reply to list”. It only remains to
> choose a mail client that knows how to use it.
Would you be so kind and share with us for such
I'm afraid I'm not much of a help here, but was there any reason you didn't
want to wrap those "string functions" inside a function, and just call the
function?
Cheers,
-Xav
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Sep 1, 2009 at 9:29 AM, Ecir Hana wrote:
> - if I understood it correctly defining a function in the string and
> exec-ing it created the function in current scope. This is something I
> really don't want
>
Oops, missed that point.
May I ask what is there you don't want, and what about
This topic came up before. =] See below. Not sure how 'standardised' this
is, though.
Double precision:
>>> import struct
>>> struct.unpack('d', struct.pack('Q', 1))[0]
4.9406564584124654e-324
Float precision:
>>> struct.unpack('f', struct.pack('L', 1))[0]
1.4012984643248171e-45
Cheers,
Xavier
Try
if __name__ == '__main__'
:],
Xav
On Mon, Sep 14, 2009 at 11:43 AM, Peng Yu wrote:
> Hi,
>
> I try the following code. I don't quite understand why __main__ is not
> defined. Could somebody let me know what I am wrong about it?
>
> Regards,
> Peng
>
> $ cat test.py
> #!/usr/bin/env python
On Tue, Sep 15, 2009 at 9:47 PM, Lambda wrote:
> When I run it, it says "TypeError: unhashable instance"
>
> I believe you need to implement __hash__() for the class. Make sure your
class returns a unique identifier for a certain value.
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Sep 15, 2009 at 10:31 PM, Ulrich Eckhardt
wrote:
> "'abc'.split('')" gives me a "ValueError: empty separator".
> However, "''.join(['a', 'b', 'c'])" gives me "'abc'".
>
> Why this asymmetry? I was under the impression that the two would be
> complementary.
>
I'm not sure about asymmetry,
On Mon, Sep 21, 2009 at 6:27 AM, daggerdvm wrote:
> Write the definition of a function twice , that receives an int
> parameter and returns an int that is twice the value of the
> parameter.
>
> how can i do this
>
I thought it was easier to implement this twice function than to find this
ma
On Tue, Sep 22, 2009 at 11:58 PM, Mahmoud Abdelkader
wrote:
> hi looking for help catching up in a class and overall to get me better
> than i am now. I can pay you by the week or per hour.
>
Wow. I'd feel guilty getting paid doing that. Sounds all too easy.
I hope he is actually learning, not j
test()
user = set(locals()) - default
loc = dict(locals())
for item in loc.items():
if item[0] in user:
print(item)
###output:
('a', <__main__.test object at 0x02D6A240>)
('default', {'__builtins__', '__name__', '__file__',
On Thu, Sep 24, 2009 at 1:05 PM, MacRules wrote:
> s="1234abcd"
> s.range(0..4)
> 1234a
>
> Is there a string function like this?
>
>
Use the slice.
>>> s = "1234abcd"
>>> s[:5]
'1234a'
Cheers,
Xav
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, Sep 24, 2009 at 8:54 PM, Evora wrote:
>
> Hello,
>
> I'm a bit of a newbie to python, so this may very well be a basic question:
>
> I have a list of lists, with around 1000 lists looking like this:
> ['0.000744', '0.480106', 'B'].
>
> I need the average of the first to entries of all the
On Fri, Sep 25, 2009 at 10:42 PM, Bahadir wrote:
> Hi there,
>
> My question is simple, but I've been spending some hours over the web
> and still struggling to get this right: How do I format a string that
> contains single quotes in it?
>
I don't know what you're doing wrong, but I've tried bo
One possible reason I can think of -
"- exiting this loop means all compared chars were identical hence it
is a palindrome and i return True"
is probably incorrect reasoning. Think again.
Also, you may consider posting your code in a way that preserves the
whitespace characters.
Cheers,
Xav
On
Ethan, are you trying to write the constructor in the class statement?
Cheers,
Xav
On 31 August 2010 00:10, Ethan Furman wrote:
> Good Day!
>
> I am stuck... hopefully a few fresh pairs of eyes will spot what I am
> missing.
>
> I have a metaclass, Traits, and two different testing files, test_
Actually, scrape what I said.
I think you need to have metaclass in the class statement, not just meta.
-Xav
On 31 August 2010 00:16, Xavier Ho wrote:
> Ethan, are you trying to write the constructor in the class statement?
>
> Cheers,
> Xav
>
>
> On 31 August 2010 00:10
On 1 September 2010 07:57, Alban Nona wrote:
> listPass = ["DIF","SPC", "RFL", "SSS", "REFR", "ALB", "AMB", "NRM", "MVE",
> "DPF", "SDW", "MAT", "WPP"]
>
Out of curiosity, could you briefly mention what "SDW" and "WPP" passes are?
I've worked out the rest, and these two are riddling my brain.
(
On 1 September 2010 12:00, Alban Nona wrote:
> @Xavier: ShaDoW, WorldPositionPoint (which is the same thing as
> WordPointCloud passe) :)
>
Aha! That's what I was missing.
Cheers,
Xav
--
http://mail.python.org/mailman/listinfo/python-list
On 2 September 2010 00:47, Alban Nona wrote:
> Hello,
>
> So I figure out this night how to create automatically varibales via
> vars(), the script seems to work, exept that where it should give me a list
> like :
> [ELM004_DIF,ELM004_SPC,ELM004_RFL,ELM004_SSS, ELM004_REFR, ELM004_ALB,
> etc...]
On 2 September 2010 01:11, Alban Nona wrote:
> Hello,
>
> seems to have the same error with python.
> In fact I was coding within nuke, a 2d compositing software (not the best)
> unfortunately, I dont see how I can use dictionnary to do what I would like
> to do.
>
Hello Alban,
The reason it's
101 - 200 of 224 matches
Mail list logo