On Sun, Jun 3, 2012 at 8:09 AM, MRAB wrote:
> Look at the "Software" page:
>
> """We use the mpy language to program the MSP430 microcontroller. MPY is
> short for Microcontroller PYthon. mpy is based on the Python computer
> language. In fact to keep things simple it is only a small subset of t
On Mon, Jun 4, 2012 at 7:19 AM, Janet Heath
wrote:
> configure:3534: error: no acceptable C compiler found in $PATH
The configure script is used to build Python from source. To do that,
you need a C compiler (such as gcc, which it went looking for a few
lines earlier). Perhaps you want a binary d
cross-communicates with the newsgroup comp.lang.python, so you can be
on either (and there are web-based newsgroup readers too).
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Jun 8, 2012 at 7:18 AM, Kevin Walzer wrote:
> On 6/5/12 10:10 AM, Mark R Rivet wrote:
>>
>> I want a gui designer that writes the gui code for me. I don't want to
>> write gui code. what is the gui designer that is most popular?
>> I tried boa-constructor, and it works, but I am concerned
On Sat, Jun 9, 2012 at 3:41 AM, Prasad, Ramit wrote:
>> > Where is the lastest step by step guide to compile Python into an
>> executable?
>>
>> Google.
>
> I think you mean the Internet as Google is just an index.
> Unless you are referring to Google's cache.
He means this:
http://www.catb.org/
On Sat, Jun 9, 2012 at 6:29 PM, Jussi Piitulainen
wrote:
> The point is that the function itself can be passed as an argument to
> the auxiliary function ...
And unlike in Javascript, a bound method is fully callable too.
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, Jun 9, 2012 at 11:25 PM, Dietmar Schwertberger
wrote:
> ... for many purposes only simple GUIs are required
> and it should be possible to create these without studying manuals
> (on toolkit and GUI editor).
> A typical simple GUI would e.g. be for a measurement / data aquisition
> program
On Sun, Jun 10, 2012 at 12:08 AM, Devin Jeanpierre
wrote:
> I do, although I'm hesitant, because this only applies when mode ==
> 'w', and open has a large and growing list of parameters.
True, but keyword arguments don't cost much complexity.
open(file, mode='r', buffering=-1, encoding=None, er
On Sun, Jun 10, 2012 at 3:07 AM, Dietmar Schwertberger
wrote:
> None of these were such that I could propagate it as GUI development
> tool for non-programmers / casual users.
> Sure, some are good for designing the GUI, but at the point where
> the user code is to be added, most people would be l
On Sun, Jun 10, 2012 at 11:40 PM, Matej Cepl wrote:
> Just my personal experience, but after passively learning many many
> languages, I came to the conclusion that I (and I suppose many others) am
> able to learn only one platform well. The point is that you are never
> interested in learning *a
On Mon, Jun 11, 2012 at 5:37 AM, Dietmar Schwertberger
wrote:
> Chris Angelico wrote (in two posts):
>
>> There was a time when that was a highly advertisable feature - "build
>> XYZ applications without writing a single line of code!". I've seen it
>> in
On Tue, Jun 12, 2012 at 7:39 PM, Gilles wrote:
> Since web scripts are usually very short anyway (user sends query,
> server handles request, sends response, and closes the port) because
> the user is waiting and browsers usually give up after 30 seconds
> anyway... why did Python solutions go for
On Tue, Jun 12, 2012 at 8:36 PM, Gilles wrote:
> Thanks for the input.
>
> But I read that PHP-based heavy-duty web servers compile the scripts
> once and keep them in a cache, so they don't have to be
> read/parsed/executed with each new query.
>
> In that case, what is the benefit of using a lon
all config entries, and builds your config
file parser... but that may be beyond the scope of your project.
Anything you can imagine can be done in code. It's just a question of
how much work. :)
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Jun 13, 2012 at 9:59 AM, Gilles wrote:
> On Tue, 12 Jun 2012 20:18:21 +1000, Chris Angelico
> wrote:
>>Think of it as Apache + PHP versus Python. Apache keeps running, it's
>>only your PHP script that starts and stops. With a long-running
>>process, you ke
the simple answer for simple tasks is: Don't bother with
frameworks, run an HTTP server.
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Jun 13, 2012 at 7:49 PM, Gilles wrote:
> On Wed, 13 Jun 2012 19:41:41 +1000, Chris Angelico
> wrote:
>>For high-availability servers, I can't speak for Python, as I've never
>>done that there; but it seems likely that there's good facilities. My
>>
On Fri, Jun 15, 2012 at 5:04 PM, Yesterday Paid
wrote:
> I'm very new to programing though I learn very little of java,C
> I love python and have fun to do something with it
> but some people said python's future perhaps not that bright.
> I know this question maybe looks like an idiot:(
> I reall
On Fri, Jun 15, 2012 at 6:05 PM, Mark Lawrence wrote:
> "an active and helpful mailing list/newsgroup (hi!)"? Gmane lists 322
> entries under comp.python :)
Sorry, should have said: A set of active and helpful mailing
lists/newsgroups! You're quite right, there's a lot of them :) I
wonder... is
On Fri, Jun 15, 2012 at 9:15 AM, Dennis Lee Bieber
wrote:
> PDF is not an "image" file format; it is a "program" describing how
> to render each page. Some of the page contents can be image bitmap data,
> but a "proper" PDF has text AS text.
Plus, JPG is very poor at handling text. It's de
On Sun, Jun 17, 2012 at 12:15 PM, Yesterday Paid
wrote:
> I'm making cipher program with random.seed(), random.random() as the
> key table of encryption.
> I'm not good at security things and don't know much about the
> algorithm used by random module.
For security, you don't want any algorithm,
On Fri, Jun 15, 2012 at 7:47 AM, Dietmar Schwertberger
wrote:
> The point is, that if you want to promote Python as replacement
> for e.g. VB, Labview etc., then an easy-to-use GUI builder is required.
> The typical GUI programs will just have an input mask, a button and one
> or two output fields
On Sun, Jun 17, 2012 at 2:18 PM, Steven D'Aprano
wrote:
> Safe from what? What is your threat model? Are you worried about your
> little sister reading your diary? Or the NSA discovering your plans to
> assassinate the President? Or something in between?
>
> Python's random module is not cryptogra
On Sun, Jun 17, 2012 at 7:01 PM, Chris Fox wrote:
> On 17/06/2012 03:42, Chris Angelico wrote:
>> I want to promote Linux as a replacement for Windows. But I do not
>> see that Linux needs to be able to run Internet Explorer in order
>> to do that. Maybe when people move t
On Mon, Jun 18, 2012 at 3:06 AM, Rafael Durán Castañeda
wrote:
> The language Python includes a SystemRandom class that obtains cryptographic
> grade random bits from /dev/urandom on a Unix-like system, including Linux
> and Mac OS X, while on Windows it uses CryptGenRandom.
/dev/urandom isn't ac
t string literal formats, because you don't need to
delimit it. In code, you need to make it clear to the interpreter
where your string finishes, and that's traditionally done with quote
characters:
name = "Chris Angelico" # this isn't part of the string, because the
two qu
in terms of a maximum. However, Unicode planes 0-2 have all
the defined printable characters, and there are only 16 planes in
total, so (since each plane is 2^16 characters) that kinda makes
Unicode 18-bit or 20-bit. UTF-16 / UCS-2, therefore, uses two 16-bit
numbers to store a 20-bit number. Why d
On Fri, Jun 3, 2011 at 1:52 PM, Chris Angelico wrote:
> However, Unicode planes 0-2 have all
> the defined printable characters
PS. I'm fully aware that there are ranges defined in page 14 / E.
They're non-printing characters, and unlikely to be part of a text
string, although it
ncoming x is garbage, your outgoing 1 is also garbage. Later
on, you can use 'isgarbage(x)' to find out whether anything went
wrong. You can also use 'isinsane(self)', which is defined as follows:
class Programmer:
def isinsane(self):
return True if float("nan")
r
DEFAULT_PROTOCOL, and recv() unpickles whatever it gets. If you do the
pickling manually, you could choose to use version 2 explicitly, and
then the 2.6 other end could read it comfortably.
I don't know how effective the pickling of functions actually is.
Someone else will doubtless be ab
3c__main__\nasdf\nq\x00.'
>>> asdf
b'\x80\x03c__main__\nasdf\nq\x00.'
I tried to do the classic - encode something, discard the original,
attempt to decode. Didn't work.
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
ery careful
> if you use something like that...
Nice piece of safe ambiguity there - two people said that, both named Chris!
Just how many Chrises are there on this list? I have a pet theory that
there's a greater-than-usual correlation between geeks and the name
"Chris", and t
On Fri, Jun 3, 2011 at 6:10 PM, Thomas Rachel
wrote:
> Kids, don't try this at home nor on your external server.
>
Aye... you would be in a pickle.
(Yes, he really did make a pun that bad. Feel free to throw rotten tomatoes.)
Chris Angelico
--
http://mail.python.org/mailman/list
On Fri, Jun 3, 2011 at 6:50 PM, Steven D'Aprano
wrote:
> On Fri, 03 Jun 2011 18:26:47 +1000, Chris Angelico wrote:
>
>> Just how many Chrises are there on this list? I have a pet theory that
>> there's a greater-than-usual correlation between geeks and the name
>>
IEEE floating point, which specifies signalling nan)?
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
te
range leads to exponential performance costs, and still doesn't
properly handle irrationals like pi. And if you cap the denominator to
a power of 2 and cap the length of the mantissa, err I mean numerator,
then you have IEEE 754 floating point. Python offers you a way to
store and manipulate
t a header with a regex, and then
string content below that. That IS one advantage of the regex.
However, that's a very VERY specific situation. If I'm not asking a
third party to provide the match condition, then that's not a reason
to go regex.
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
, it evaluates as False and
terminates the loop.
Python doesn't seem to have an inbuilt function to divide strings in
this way. At least, I can't find it (except the special case where n
is 1, which is simply 'list(string)'). Pike allows you to use the
division operator: "Hello, world!"/3 is an array of 3-character
strings. If there's anything in Python to do the same, I'm sure
someone else will point it out.
Hope that helps!
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
alling NaN, and then save that into a memory variable, all without
it trapping; and then it traps when you next perform an operation on
that number?
Apologies, this is getting quite off-topic and away from Python.
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
ating point work if at all possible, but hey, this gives me more
topics to bore people with at parties! (Wait. I never get invited to
parties any more. I think my work on that front is complete.)
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, Jun 6, 2011 at 2:59 PM, Steven D'Aprano
wrote:
> On Mon, 06 Jun 2011 14:11:03 +1000, Chris Angelico wrote:
>> So does this mean that:
>> (with signalling NANs) should trap on the second line but not the first?
BTW, by "should" I meant "would if Python
tions cannot do what RE can do.
for X in features:
"When speed is important and every millisecond counts, X should be
used only when there is no other faster way."
"When speed is not such a big issue, X should be used only if it is
easier to understand and maintain than other way
oing to parties. When I
found myself writing programs during dinner, I knew I was an addict.
So I came to Prog-Anon, with their 12-step .. ARGH! I can't
escape!!
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
d .test, which you
can probably ignore.
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Jun 7, 2011 at 3:23 PM, Nobody wrote:
> [1] If a hostname ends with a dot, it's fully qualified.
>
Outside of BIND files, when do you ever see a name that actually ends
with a dot?
ChrisA
--
http://mail.python.org/mailman/listinfo/python-list
sign in front of the number.
:)
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
e all your
scripts in .py format rather than py2exeing them all.
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
option #2 - run the scripts on the
server. It's completely different from distributing them to people as
EXEs, but it might very well do what you need.
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
't work if num
is a perfect square. Use range(2,sqrt(num)+1) for safety.) That will
save a fair amount of effort. Also, if you divide num by each factor
found, it'll make the numbers smaller, which may be faster.
Hope that helps!
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
7;re fully allowed to fiddle with something and
compile it for your own use, and not release your changes. See for
instance the GPL FAQ which Ben Finney posted, specifically this
question and answer:
http://www.gnu.org/copyleft/gpl-faq.html#GPLRequireSourcePostedPublic
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Jun 10, 2011 at 8:39 AM, Gregory Ewing
wrote:
> Chris Angelico wrote:
>
>> Rather than find all prime numbers up to num, stop at sqrt(num) - it's
>> not possible to have any prime factors larger than that.
>
> That's not quite true -- the prime facto
On Fri, Jun 10, 2011 at 3:18 AM, hisan wrote:
> Hi All,
>
> Please let me know which one is GOOD whether Python 2.6 OR 3.2.
As a side point, you should probably use 2.7 rather than 2.6. With
regard to 2.x versus 3.x, Corey already posted a link to an excellent
article.
Chris Angelico
square) is something I hope no-one else notices or draws
> attention to.
class Square(Number):
""" A class designed to confuse the issue arbitrarily. """
pass
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
TF-16, you'll get a whole lot of rubbish if
you send it UTF-8 - but it'll look fine if you send it Unicode.
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
99% of their time waiting
for the network. This makes threads very effective, and largely
eliminates the GIL issues (if they occasionally have to take turns,
it's not going to affect things much). Pick whichever threading
library suits your coding style; they'll all work, most likely.
Ch
ible to narrow it down viably.
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
e.
Those hours you've spent grokking this are not wasted, if you now have
a comprehension of characters vs encodings. More people in the world
need to understand that difference! :)
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
se two sets,
and different_headers is the XOR.
# If you need the lists afterwards, use different variable names
source_headers = set(source_headers)
target_headers = set(target_headers)
similar_headers = len(source_headers & target_headers)
different_headers = len(source_headers ^ target_head
On Tue, Jun 14, 2011 at 1:21 AM, Zachary Dziura wrote:
> Wow! That was a lot easier than I thought it would be! I guess I
> should have done a little bit more research into such operations.
> Thanks a bunch!!
:)
Python: "Batteries Included".
(Although Python 3 is "Most of the batteries you're u
s special to IDLE.
>>> 1+2
3
>>> _
3
It's the last result. So presumably when you did it, your last result
was something boolean.
>>> sorted([random.randint(1,10) for i in range(10)])
[1, 1, 2, 3, 4, 4, 5, 7, 8, 10]
>>> set(_)
{1, 2, 3, 4, 5, 7, 8, 1
On Tue, Jun 14, 2011 at 2:02 AM, Steven D'Aprano
wrote:
> On Mon, 13 Jun 2011 07:37:02 -0800, Tim Johnson wrote:
>
>> Consider the following code:
> [...]
>
> You know Tim, if you hadn't blocked my email address in a fit of pique
> over something that didn't even involve you, you would have seen m
On Tue, Jun 14, 2011 at 2:04 AM, Steven D'Aprano
wrote:
> On Tue, 14 Jun 2011 01:39:50 +1000, Chris Angelico wrote:
>
>> Python: "Batteries Included".
>>
>> (Although Python 3 is "Most of the batteries you're used to, included".)
>
> O
On Tue, Jun 14, 2011 at 2:15 AM, Steven D'Aprano
wrote:
> On Tue, 14 Jun 2011 01:55:04 +1000, Chris Angelico wrote:
>> _ is special to IDLE.
>
> Not just IDLE. Also the vanilla Python command line interpreter. In fact,
> you can even find the code that controls it:
Sorry
On Tue, Jun 14, 2011 at 3:46 AM, geremy condra wrote:
> On Mon, Jun 13, 2011 at 9:30 AM, Chris Angelico wrote:
>> Ha! That *lengthy* thread started fairly soon after I joined this
>> list. It was highly... informative. I learned a bit about Python, and
>> a lot about python
nes from first difference
to rematch as insertions.
(Since that was for comparing a source file with a user-supplied
modified source - a sort of diff/patch - a re-match was defined by N
consecutive matching lines, but in this, a re-match can simply be two
identical strings.)
But for the situati
On Tue, Jun 14, 2011 at 4:11 AM, Chris Angelico wrote:
> The algorithm went
> something like this:
>
> * Start with pointers to beginnings of both lists.
PS. It wasn't C with pointers and the like; iirc it actually used
array indices as the "pointers". Immaterial to th
On Tue, Jun 14, 2011 at 4:20 AM, geremy condra wrote:
> I know that, but I mean what were you talking about before if you
> weren't talking about cmp?
Not sure what you mean. There were other threads before the cmp thread
started. That thread started with, if my memory serves me correctly,
someth
On Tue, Jun 14, 2011 at 5:11 AM, Ethan Furman wrote:
> I suspect Geremy is referring to your "most of the batteries you're used to,
> included" comment -- which batteries are missing?
Oh! There's a handful of modules that aren't yet available in 3.x,
which might surprise someone who's moving from
On Tue, Jun 14, 2011 at 8:33 AM, Tim Chase
wrote:
> print ("this is not "
> "such a huge line "
> "even though it has "
> "lots of text in it."
> )
>
> print (
> "this is not "
> "such a huge line "
> "even though it has "
> "lots of text in it."
> )
I'm not seeing th
On Tue, Jun 14, 2011 at 8:37 AM, SherjilOzair wrote:
> I want a list which contains n lists, which are all different. I had
> read a page which was about the mutability of lists, and how the *
> operator on lists just does a shallow copy. But I can't find it now.
> Does anyone know of that page ?
On Tue, Jun 14, 2011 at 9:03 AM, Tim Chase
wrote:
> On 06/13/2011 05:38 PM, Chris Angelico wrote:
>> I'm not seeing the difference between these two. Pointer, please?
>> *puzzled*
>
> Sorry...tried to make that clear in the surrounding text. The first one has
> the o
On Tue, Jun 14, 2011 at 9:08 AM, SigmundV wrote:
> To the OP I'd say: learn Python through 3.2. It's the best way
> forward, for the sake of yourself and others. The only way more
> modules can become 3k compatible is if more people use 3k.
I skipped 3.2 and went straight to 3.3a0 from hg, but th
On Tue, Jun 14, 2011 at 11:45 AM, Gregory Ewing
wrote:
> Chris Angelico wrote:
>
>> And did any of the studies take into account the fact that a lot of
>> computer users - in all but the purest data entry tasks - will use a
>> mouse as well as a keyboard?
>
> W
tures and everyone else's JS engines don't, we can't use those
features. Even if they're added to the standard, there'll still be old
browsers that don't support things. The only way to add to the
language is to dump stuff into a .js file and include it everywhere.
But if an
On Tue, Jun 14, 2011 at 6:39 PM, Martin P. Hellwig
wrote:
> On 14/06/2011 07:31, Chris Angelico wrote:
>
>>
>> But if anyone feels like writing an incompatible browser, please can
>> you add Python scripting?
>
> You might find that Pyjamas already fill your needs p
On Wed, Jun 15, 2011 at 3:33 AM, geremy condra wrote:
>> My suggestion: Cruftbuster
>
> 'Phile'
Or 'Philtre'. A philtre is a very useful thing to have around a
house... just ask Aline Sangazure.
I'd like to join this project, as a tester.
Chris Angeli
wn web site at some
point.
Thanks for the tips, all. This is what makes a good mailing list -
helpful people!
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
27;m glad you got some good replies. It probably reflects badly on me
> that my first thought was http://bash.org/?5804>.
Well *OBVIOUSLY* the difference is that that snippet is referring to
"Ms Access", and on this list we're working with "Montgomery Python",
and as we
On Wed, Jun 15, 2011 at 12:50 AM, Dotan Cohen wrote:
> And disproportionate usage of fingers. On QWERTY the weakest fingers
> (pinkies) do almost 1/4 of the keypresses when modifier keys, enter,
> tab, and backspace are taken into account.
That's true on a piano too, though. My pinkies are quite
On Wed, Jun 15, 2011 at 8:29 AM, Andrew Berg wrote:
> On 2011.06.13 08:58 PM, Chris Angelico wrote:
>> That's one of the reasons I like my laptop keyboard so much.
> I find that the terribly tiny keys on a laptop keyboard make them very
> evil. I don't see how anyone
could control the selection of IP address using a hosts file. In
Unix, that's /etc/hosts; in Windows,
c:\windows\system32\drivers\etc\hosts; in OS/2, c:\mptn\etc\hosts;
etc. The urllib2 resolver should respect that.
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Jun 15, 2011 at 10:51 AM, Eric Snow wrote:
> if condition_1:
> ...
> return
> if condition_2:
> ...
> return
>
> # now do my expensive module stuff
>
> # finally handle being run as a script
> if __name__ == "__main__":
> ...
>
The best way I can think of is:
.com.au/esstu/rosmud.html
The code is Windows-specific, but the TinyURL code is mostly just
network work, so by the time you've ported it to Python it will be
cross-platform.
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
altering .
If you edit your hosts file, it will affect where something.com points
- you can force it to be IPA and then test, then force it to IPB and
test. You'll still be downloading https://something.com so the HTTPS
handshake should work exactly the same way.
Chris Angelico
--
http://mai
.
You need only tinker with the configuration on the client, not the
server.
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Jun 15, 2011 at 5:16 PM, Tim Roberts wrote:
> Dennis Lee Bieber wrote:
>> Oh, there was an "inefficiency" in QWERTY -- but it only applies to
>>fully manual typewriters, in which some of the more common letters were
>>placed under the weakest fingers -- to slow down key strokes enou
On Wed, Jun 15, 2011 at 7:22 PM, Dotan Cohen wrote:
> Utter nonsense. The QWERTY keyboard was - and this is verified fact -
> designed the way is was because the inventor's mother in law's
> initials were AS and his father is law was DF. The letter combinations
> JK and L; were his childrens' init
On Wed, Jun 15, 2011 at 10:29 PM, Olivier LEMAIRE
wrote:
> b = str(bin(number))[2:]
> if len(b) !=size:
> b = (size-len(b))*"0"+b
You don't need the str() there as bin() already returns a number.
Here's a relatively trivial simplification - although it does make the
code more cryptic
On Fri, Jun 17, 2011 at 8:07 AM, Erik Max Francis wrote:
> It's quite consistent on which control structures you can break out of --
> it's the looping ones.
Plus functions.
ChrisA
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Jun 17, 2011 at 9:29 AM, Erik Max Francis wrote:
> Chris Angelico wrote:
>>
>> On Fri, Jun 17, 2011 at 8:07 AM, Erik Max Francis wrote:
>>>
>>> It's quite consistent on which control structures you can break out of --
>>> it's the loop
On Fri, Jun 17, 2011 at 10:48 AM, Steven D'Aprano
wrote:
> Perhaps the most sensible alternative is conditional importing:
>
> # === module extras.py ===
>
> def ham(): pass
> def cheese(): pass
> def salad(): pass
>
>
> # === module other.py ===
>
> def spam(): pass
>
> if not some_condition: fro
On Fri, Jun 17, 2011 at 2:32 AM, Christian Heimes wrote:
> "c:d" is a valid directory name on Linux. :]
>
The different naming rules come in handy now and then. Wine creates
directories (symlinks, I think, but same diff) called "c:" and "d:"
and so on, which then become the drives that Windows pr
On Fri, Jun 17, 2011 at 10:57 AM, Jason Friedman wrote:
> The code behaves as I expect and want, but the de-denting of the
> Python call is unattractive, especially unattractive the longer the
> Python call becomes. I'd prefer something like:
>
#!/bin/bash
for i in 1 2 3 4; do
python -c "if Tr
On Fri, Jun 17, 2011 at 3:20 PM, Erik Max Francis wrote:
> Yes, which could be rephrased as the fact that `break` and `continue` are
> restricted to looping control structures, so reusing `break` in this context
> would be a bad idea.
Which is why I believe 'return' would be a better choice, even
e for this, though, as the above call
will succeed if there is a user of that name (for instance, replacing
"/aasdfadefa" with "/rosuav" changes the response to a 200). You also
have to contend with the possibility that the server won't allow HEAD
requests at all, in which case just fall back on GET.
But all this isn't certain, even so. There are some misconfigured
servers that actually send a 200 response when a page doesn't exist.
But you can probably ignore those sorts of hassles, and just code to
the standard.
Hope that helps!
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, Jun 18, 2011 at 2:10 AM, Steven D'Aprano
wrote:
> If you've ever wondered what lambda and reduce are good for, run this one-
> liner and wonder no more...
>
> (Be patient, it may take a few seconds to return.)
I have a decent CPU so it's not too bad. And the precision produced is
notewort
On Sat, Jun 18, 2011 at 1:50 PM, Steven D'Aprano
wrote:
> I don't think the use-case for this is convincing enough to need it, but
> it's an interesting concept. I once played around with a mini-language
> for config files that included a "STOP" command, so that:
>
> key = value
> STOP
> everythin
On Sat, Jun 18, 2011 at 2:17 PM, John Salerno wrote:
> 1)
> class Character:
>
> def __init__(self, name, base_health=50, base_resource=10):
> self.name = name
> self.health = base_health
> self.resource = base_resource
If you expect to override the health/resource, I'd us
On Sat, Jun 18, 2011 at 2:49 PM, Steven D'Aprano
wrote:
> Not quite. In my config language, "ignored" means ignored. There was no
> way of accessing the rest of the file, short of guessing the file name,
> opening it and reading it as text.
>
> In Perl, the __END__ and __DATA__ keywords mark the e
s, but if you
want it to be a good game, sometimes you need to go back on decisions
like that.
And that's where mailing lists like this are awesome. I've learned so
much from the wisdom here... there is an amazing amount of expertise
being offered freely!
Chris Angelico
--
http://mail.
2001 - 2100 of 14669 matches
Mail list logo