On Tuesday 24 July 2007 13:11, Kent Johnson wrote:
> 'while 1' is optimized to just a jump - the compiler recognizes that the
> test is not needed and skips it. 'while True' requires looking up the
> value of the name 'True' and testing it.
This may seem counter intuitive, but the reason for this
Stephen,
I've come into this thread late, but it looks like you're lamenting the fact
you can stipulate complex iterations on a single line, which can be nice. I'd
not really missed this in several years of programming with python.
However, Your post is interesting because it raises a point I'
Hi,
You're really asking about optimisation incidentally.
On Friday 10 August 2007 10:54, Jaggo wrote:
> Hello!
>
> I desperately need a simple way to compare whether any item of SmallList is
> in BigList.
A simple way:
True in [x in BigList for x in SmallList]
Not efficient necessarily, but
On Monday 13 August 2007 15:28, Kent Johnson wrote:
> > The original poster posted a post with the following function:
...
> > message=raw_input("Enter the message to decode: ")
> > result=''
> > for x in string.split(message):
> > result=result+c
On Monday 13 August 2007 21:53, Kent Johnson wrote:
> Hmm...could be a remote connection such as ssh, which precludes the
> sledgehammer though probably not the sort of mischief you can get into
> with eval()...perhaps there are untrusted remote connections where
> eval() would still be a significa
On Monday 13 August 2007 22:39, Tiger12506 wrote:
> > foo = raw_input(...)
> > x = eval(foo)
> >
...
> Let your program run on your machine and I'll walk by, type in this string,
> and hit enter. We'll see how much of an exception it is when you can't boot
> your XP machine anymore.
> ;-)
Who care
Tiger12506,
You are COMPLETELY missing the point. The __following__ code
> >> > foo = raw_input(...)
> >> > x = eval(foo)
ONLY works if the user has console access to the machine.
If they have console access to the machine
AND you're worried about them damaging it
THEN an eval(raw_input( ...)
On Tuesday 14 August 2007 16:48, Eric Brunson wrote:
...
> The only thing I can imagine is
> that you're stuck in some DOS mindset that if you're able to type into
> "the console" then you have ultimate access to the machine, which is not
> the case when using a true multi-user operating system li
On Thursday 22 September 2005 23:46, [EMAIL PROTECTED] wrote:
> I am coming to Python from Perl. Does Python have anything like the diamond
> operator found in Perl?
The correct answer is not really no, but you can manually perform the
same tasks. For those who don't know perl, <> is an incredibly
On Tuesday 27 September 2005 14:49, Matt Williams wrote:
> Could someone explain how, in very general terms, one would use python
> to wrap some C libraries/ API.
>
> I ask because there are a few bits of C software that look quite
> interesting, and I know that Python can be used to wrap the C - b
On Tuesday 27 September 2005 23:16, Kent Johnson wrote:
> Joseph Quigley wrote:...
> > Well we are three programmers. I know python, another knows Java and the
> > other C++. We are trying to figure out how to combine all three
> > langauges to make a game.
>
> Sounds like a bit of a hash to me. Sh
On Thursday 29 September 2005 07:27, Pierre Barbier de Reuille wrote:
> IMO, it is better to explicitely call the base class ... I think it is
> more readable. But I don't know if there is any drawback for any
> solution...
A drawback of NOT using super is that you're potetially setting yourself y
On Thursday 29 September 2005 22:26, Alan G wrote:
> string -> function mapping directly.
>
> Its not usually a very useful thing to do
This is precisely how shared libraries under linux and IIRC DLLs in windows
work. cf dlopen, dysym in C.
> how would the typical user know what the function na
Thanks in advance to anyone willing to give this a go, and to others for their
patience regarding this message!
Best Regards,
Michael.
--
Michael Sparks, Senior R&D Engineer, Digital Media Group
[EMAIL PROTECTED], http://kamaelia.sourceforge.net/
British Broadcasting Corporation, Research and Dev
On Saturday 01 October 2005 12:36, Kent Johnson wrote:
> Another way to do what you want is to use Twisted; this is touched on in
> the second thread above.
Another way is to use Kamaelia - its' specifically aimed at making it
easy for newbies (and everyone else, me especially :-) do more than one
[ cc'ing the Kamaelia list in case it makes sense to move this conversation
there. ]
On Sunday 02 October 2005 15:20, Joseph Quigley wrote:
> Hi Michael,
> You're explanation helped a lot, however, I'm really not good at gui
> programming and the irc client was supposed to be a console application
erested in
hearing. If it's difficult, what was difficult (naff HTML for example...), if
it was clear/unclear, that sort of thing. That said, this query is useful
feedback in itself :)
Best Regards, (and apologies for the HTML formatting ... :-(
Michael.
--
Michael Sparks, Senior R&am
On Friday 07 October 2005 03:04, R. Alan Monroe wrote:
> > I've just double checked what happens when running the contents of that
> > page, and it works as expected (here at least), so I suspect the problems
> > you're seeing are simply due to "code being in HTML" issues.
>
> Yeah I was writing as
On Wednesday 05 October 2005 19:20, Kent Johnson wrote:
> This seems to be an update to his previous book, "Practical Python", rather
> than a completely new book. The TOC is almost identical. I haven't read the
> earlier book, either, so I don't have an opinion. The same sample chapter
> is availa
On Friday 07 October 2005 10:20, Suranga Sarukkali wrote:
> All this could look mostly like any of a question of a idiot! sorry for
> that. I've heard that Python is good for hacking and when I ask how to here
> on python tutor mailing list answers were all about reading some article
> I've already
On Wednesday 12 October 2005 23:19, Kent Johnson wrote:
> I don't think you can compile python code
Pypy can compile a restricted subset of python...
More accurately it translates the restricted subset to C and then *that* can
be compiled. Some code can get quite dramatic speed improvements - t
On Wednesday 12 October 2005 19:10, Marc Buehler wrote:
> i would like to extract the number of JPG files
> from the current directory and use that number
I've looked through the thread, and the following strikes me as simpler than
the suggestions so far.
path = "." # Current directory, unix at
On Thursday 13 October 2005 01:08, Kent Johnson wrote:
> Michael Sparks wrote:
> > On Wednesday 12 October 2005 23:19, Kent Johnson wrote:
> >>I don't think you can compile python code
> >
> > Pypy can compile a restricted subset of python...
>
> There is
On Tuesday 14 February 2006 20:57, Michael Broe wrote:
...
> But I can't see a way to do this in a list comprehension:
>
> >>> map (pow, [2, 2, 2, 2], [1, 2, 3, 4])
> [2, 4, 8, 16]
>>> [ x**y for x,y in zip([2,2,2,2],[1,2,3,4]) ]
[2, 4, 8, 16]
To me this is clearer. (despite having written som
On Monday 27 March 2006 22:21, Steve Slevinski wrote:
> Does this sound reasonable? Are their any alternatives to Movable
> Python? (http://www.voidspace.org.uk/python/movpy/)
Hi Steve,
I've got no experience of setting up such a beast or using movable python, but
I just wanted to say it sounds
On Sunday 05 November 2006 15:02, Kent Johnson wrote:
...
> Regular expressions are an extremely powerful and useful tool that every
> programmer should master and then put away and not use when there is an
> alternative :-)
There's always an alternative to a regular expression, so are you reall
On Monday 06 November 2006 01:08, Alan Gauld wrote:
> While using a dictionary is probably overkill, so is a regex.
No, in this case it's absolutely the right choice.
> A simple string holding all characters and an 'in' test would probably
> be both easier to read and faster.
I'm stunned you th
On Monday 06 November 2006 22:52, Alan Gauld wrote:
> I wasn't aware we were having a war, but I'm happy to desist :-)
FWIW, I wasn't aware of one either. (Mind you I've often noticed what passes
for plain speaking in the UK passes for vehement flame war elsewhere, so
maybe that's it)
Anyway, i
On Friday 16 March 2007 06:52, ammar azif wrote:
> Is generator function similar to multi threading?
Yes, however unlike threads they are more general. They can be used in two
main ways:
* To generate a sequence of values
* To achieve something similar to multithreading, but without using
On Wednesday 28 March 2007 10:50, Rohan Deshpande wrote:
> Out of curiousity, why md5? Hasn't it been cracked already? Would sha1 or
> 2sum be a better alternative? I'm a newbie to this so it's just a
> question.
People have indeed shown vulnerabilities in MD5 for this sort of purpose.
Specifi
speech.py is a Python module that provides a clean interface to Windows's
voice recognition and text-to-speech capabilities. But it requires Windows
XP or Vista, and Python 2.4 or 2.5. I use Windows 7.
another one I found; Dragonfly is a speech recognition framework. It is a
Python package which
You can explain it yourself or just drop me a link (or both).
Right now I'm learning Python 2.x but I plan on learning Python 3.x as well.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailma
I believe it's % string interpolation where % formats strings
I'm reading Practical Programming and I'm stuck on page 35, question 6. b)
where:
"___" % 34.5 => "3.45e+01"
On Sat, Jun 8, 2013 at 11:03 AM, Steven D'Aprano wrote:
> On 09/06/13 01:58,
I read Practical Programming, chapter 4 and I know how to write and use my
own modules on IDLE for Python 3.2 but now I switched to version 2.7 and I
don't know how to use a downloaded module such as mp3play-0.1.15 written by
Michael Gundlach. I got Python 2.5, 2.7 and 3.2 on my computer at home an
34 matches
Mail list logo