forgot about that one. Thanks!
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
version. The only quirk to it is
that it accepts nothing but unicode. Other than that, it's a keeper.
It is extremely fast.
Cheers,
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
re efficient.
I agree. I would rather call func() only once per iteration in any
case. I will revise it to a plain for loop with a single call.
Thanks,
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
aries that stay in step with currently
available language releases would be most welcome.
Just my $0.02,
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
so it's not too bad.. but it's possible for this
pattern to apply to more substantial operations. My conjecture is
that higher func() loads would favor more the use of a simple for-
yield loop.
Cheers,
Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
all.
I am pretty sure that the sorted() construct cannot be improved much
further, but...
...does anyone have ideas on improving the "rawPairs" iterator so that
it calls "func(s)" only once per iteration? Perhaps a lambda
construct, but I am not sure how to go about it...?
Ch
, I have watched Guido's GoogleTalk on Py3k plans, and the
changes are not all that scary. I'm looking forward to it.
Cheers,
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
ssful for me because the content is well-connected.
As far as which language to choose - well, you can make the choice
yourself after reading at least the introductions of all the books. If
you do decide on Python, there is a library called "pygame" that may
achieve your visual game programming goals.
Enjoy!
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
ssion, and I'm sure a bunch
of folks will benefit from it. And please update it (if necessary) to
the current Python version. At the time of that writing, 2.3 must have
been King, but oh my, how time flies :-)
Cheers,
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
for i in range(len(data_in)):
> data_out.append([])
>
> This caused me to wonder why Python does not have a "foreach" statement (and
> also why has it not come up in this thread)? I realize the topic has probably
> been beaten to death in earlier thread(s), but doe
catching unused
> > variables in the general is useful to me.
>
> Agreed.
>
> --
> \ "Dyslexia means never having to say that you're ysror." |
> `\--anonymous |
> _o__) |
> Ben Finney
Neat! That is the best solution I've seen so far. I should definitely
dig into the itertools module more often.
Cheers,
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
for f in actions:
f()
fetching foo...
fetching foo...
fetching foo...
fetching foo...
fetching foo...
..but not knowing your specific implementation, I may be off the wall
here.
Cheers,
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
e = E()
> e.meth()
> for class_ in E, D1, C1, B1, B2, B0, C, B:
> print class_.__name__, super(class_, e).pn()
>
> > I can clearly see that it doesn't work, I just don't understand why. I'd
> > be inclined to chalk it up to super() being a mysterious black box that
> > makes no sense *wink*
>
> super (and mro) work to get to all the superclasses in an order that
> produces subtypes before their supertypes. The diamond inheritance
> examples "show" why its needed.
>
> -Scott
Cool, thanks for posting this example and clearing that up. Several
times in the past I have used super(self.__class__, cls) instead of
super(Klass_obj, cls), without a clue that it would wreck the
subclasses. My beginner's thought at the time was that it would
provide more flexibility.. Good thing I haven't had to subclass
them..yet :)
Cheers,
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
//www.python.org/doc/newstyle/
Cheers,
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
ne enough to choose.
Here's a new word -
...its humanicity factor.
That definition, according to me, is:
"its ability to let you *quickly* formulate and solve your problem in
the way that YOU see it, not as the computer sees it."
Did programmers stop writing programs on punch card
.
FWIW, an ASP is also a snake...but that's another discussion. Shall we
start one? I think NOT..
This has been an entertaining break from the ordinary, but let's get
back to something more useful.
Cheers,
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
ncy analysis based
on real-time sampling. It's well worth taking a look:
http://pymedia.org/
Cheers,
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
ds of audio metadata. On mp3's, that
includes track duration, all ID3 info, bitrate, sample rate, etc. It
provides an easy dictionary-like interface. It supports a number of
audio formats, but I don't believe it has conversion capability.
Cheers,
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
you
upgrade now :)
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 7, 5:08 am, "Andreas Tawn" <[EMAIL PROTECTED]> wrote:
>
> Maybe http://www.pythonchallenge.com/?
That's the one, thanks!
---
--
http://mail.python.org/mailman/listinfo/python-list
Woody!
:))
--
http://mail.python.org/mailman/listinfo/python-list
I got to 14 :)
It's rather silly.
I remember seeing a more elaborate puzzle that involved coding,
cryptography knowledge, etc. to get through it. But what was the link,
I forget now...
--
http://mail.python.org/mailman/listinfo/python-list
GUI2Exe - it makes the distribution process a bit less
painful.
Of course, you're welcome to search for other stuff as suggested by
the other responses.
Cheers,
Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
d its necessary data files in this way. Wouldn't it be
nice if py2exe had something simple like that built in...
Have you tried GUI2Exe? I've found its interface quite easy to use.
It doesn't recurse into a dir tree (feature request?), but it makes
the selection process at leas
just nice how it works that way.
Otherwise, the function factory approach like Hrvoje's
functionToCall = getattr(self, "testCase%s" % tc)
is the best optimization.
Cheers,
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
source for any beginner in Python, whether he/she has previous
programming background or not.
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
Thank you both for clearing that up.
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
And wrap if it
> is.
Can you give an example of such an iterable (other than a tuple)? I'd
certainly like to fix my 'fix' to work for a more general case.
Regards,
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
for filename in filelist:
f = open(filename,'r')
#do interesting stuff with file, etc...
..and it's been working very well.
Cheers,
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
> This would be a RTFM moment :) defaultdict is not a built-in, it is part
> of the collections module.
Bingo! I should have read higher up in the manual tree :)
Thanks
--
http://mail.python.org/mailman/listinfo/python-list
nual, I got a "NameError: name 'defaultdict' is not defined". What
am I missing in my Python installation?
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
to add type-checking to the
__eq__ method?
(untested)
def __eq__(self, other):
if isinstance(other, int):
tmp = other
else:
tmp = other.a # (other.b in class B definition)
return self.a == tmp # (self.b in class B definition)
Cheers,
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
On May 22, 5:44 pm, [EMAIL PROTECTED] wrote:
> On May 22, 6:29 am, jolly <[EMAIL PROTECTED]> wrote:
>
> > Hey guys,
>
> > I want to begin python. Does anyone know where a good starting point
> > is?
>
> > Thanks,
> > Jem
>
> I really liked How to Think Like a Computer Scientist learning with
> pyth
in your case the 3 fixes above will allow you now to do this:
>>>C = Cc14(2,3)
>>>result = C.out(C)
>>>result.r, result.i
(3, 4)
Which is beginning to look like your design intent..
Cheers,
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
> After this I went to the tutorial and started trying out some of the
> examples. I pasted the code to separate text files and then ran them
> through a Terminal window. This stuff is freaking cool!!! Now I
> just have to figure out how this all works!
>
"wxPython in Action" is a decent book fo
un on that system.
>
Try wxPython. I've seen it run on a Mac with OS X and Windows
simultaneously, where the operating systems were switched from one to
the other at the touch of a button, and the GUI had a very native look
in either platform (mind you, the app was running exactly
appropriate for this and how to apply it. Perhaps
the above function should be a method of a class that inherits from
the appropriate handler class? Any help will be appreciated.
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
post: you want to create a loop that steps by an
increment of 2. If that's the case, then:
>>> for j in range(0,10,2):
... print j
...
0
2
4
6
8
would be a simple result.
Cheers,
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
ou can avoid
such a faux pas by using the raw string construct of the form r"some
string". Otherwise, any backslashes in in your string will be
interpreted as escape characters.
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
> How do you know that s is a string?
It's a presumption based on the original problem statement.
The example shown is a simple T/F check, which happens to determine
the "emptiness" of strings.
If type checking is absolutely necessary, one could use
if isinstance(s, basestring):
if s:
A simple
if s:
print "not empty"
else:
print "empty"
will do.
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
t
box scrolled at the bottom :)
How about this:
>>>help(Tkinter.Text.see)
Help on method see in module Tkinter:
see(self, index) unbound Tkinter.Text method
Scroll such that the character at INDEX is visible.
It may be what you're looking for if you use 'end' for inde
Would this work?
self.text = wx.TextCtrl(panel, style=wx.TE_MULTILINE)
...
line = '\n' + "Hello world!"
self.text.AppendText(line)
--
http://mail.python.org/mailman/listinfo/python-list
What was I thinking? split() will only work if you have no other
whitespace characters in the string. A regex like "[\n\r]+" is indeed
much more appropriate and robust.
Cheers
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
why not use split:
>>>s = "
>>>a\n\n\n\n\n\n\n\n\nsss\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvsa\n\n\n\nasf...
>>>\n\nafs"
>>>s.split()
['a', 'sss', '', 'vsa', 'asf...', 'afs']
--
http://mail.python.org/mailman/listinfo/python-list
on my PyCon mug there are words "Python: so easy...even your BOSS
can use it!"
Thankfully, my boss doesn't know the difference between directories
and files, so I can easily succeed in making him think that Python
really IS a black art :)
Cheers
-Basilisk96
--
http://mail.python.
code base shrinks compared to its C++ or Java counterpart :)
But really, do it just to understand Python on a deeper level. Instead
of thinking in the old way, try to think in the Pythonic way. A nice
example of this is iteration. Where an iteration counter variable is
required in most oth
>
> Could the file like object still be encoded in MIME or something?
>
Yes it is. You don't need to seek(0).
Try this:
decoded = email.base64mime.decode(part.get_payload())
fileObj.write(decoded)
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
Thanks for the help, guys.
Dictionaries to the rescue!
Steven, it's certainly true that runtime creation of attributes does
not fit well here. At some point, an application needs to come out of
generics and deal with logic that is specific to the problem. The
example I gave was classification of b
This topic is difficult to describe in one subject sentence...
Has anyone come across the application of the simple statement "if
(object1's attributes meet some conditions) then (set object2's
attributes to certain outcomes)", where "object1" and "object2" are
generic objects, and the "conditions
50 matches
Mail list logo