On Fri, Oct 12, 2012 at 1:16 AM, Juergen Bartholomae
wrote:
> One possible solution is to somehow redirect every __builtins__ to a
> function that returns a different __builtins__ dictionary for each thread
> (such a function already exists).
How exactly does the code reference it? If they're si
On Fri, Oct 12, 2012 at 3:24 AM, wrote:
> Le jeudi 11 octobre 2012 15:16:33 UTC+2, Ramchandra Apte a écrit :
>
> PS C:\> $cmd="import sys;"
> PS C:\> $cmd+="print('\n'.join(sys.path))"
> PS C:\> $cmd
> import sys;print('\n'.join(sys.path))
> PS C:\> c:\python32\python -c $cmd
>
> C:\Windows\syste
On Fri, Oct 12, 2012 at 3:49 AM, Gisle Vanem wrote:
> wrote in comp.lang.python
>
> (my ISP no longer updates this group. Last message is from 8. April.
> Does the postings to the python mailing-list automatically get reposted to
> comp.lang.python?)
Yes, c.l.p and python-list mirror each other.
On Fri, Oct 12, 2012 at 4:44 PM, Trevor Nelson wrote:
> I really would truely appreciate and example coding of how to put together an
> initial basic "AI" bot where it can monitor the system and tell me alerts as
> with being able to query it for questions. As with I am looking for some sort
>
On Sat, Oct 13, 2012 at 7:41 PM, Thomas Bach
wrote:
> On Sat, Oct 13, 2012 at 12:32:41AM +, Steven D'Aprano wrote:
>>
>> He gets SyntaxError because you can't follow a semicolon with a
>> statement that begins a block.
>
> Can someone provide a link on where to find this type of information?
On Sun, Oct 14, 2012 at 12:44 AM, Etienne Robillard
wrote:
> Why dont you grow yourself some usable neurons instead ? Don't you realize
> now stackoverflow.com is starting
> to hurt your capacity to cogitate on your own or have you not realized this
> yet?
Excuse me?
I'm not overly familiar wi
On Sat, Oct 13, 2012 at 3:49 PM, wrote:
> Basically its a framework that forces the developer(s) to strictly separate
> the model from the view and controller. You can 'hook up' multiple
> controllers to a project. The model layer can be completely mocked out so
> front end designers don't hav
On Sun, Oct 14, 2012 at 2:57 AM, wrote:
> Do you have an example of a task that giotto can't handle that other
> frameworks can? One of my goals is to have this framework "turing complete"
> in the sense that everything that other frameworks can do, giotto should be
> able to do. I think my co
On Sun, Oct 14, 2012 at 3:38 AM, Joshua Landau
wrote:
> This here isn't a flaw in Python, though. It's a flaw in the command-line
> interpreter. By putting it all on one line, you are effectively saying:
> "group these". Which is the same as an "if True:" block, and some things
> like Reinteract e
On Sun, Oct 14, 2012 at 2:21 AM, Zero Piraeus wrote:
> I'm a mostly passive subscriber to this list - my posts here over the
> years could probably be counted without having to take my socks off -
> so perhaps I have no right to comment, but I've noticed a marked
> increase in aggressive language
On Sun, Oct 14, 2012 at 4:43 AM, Jussi Piitulainen
wrote:
> Chris Angelico writes:
>
>> Here's a side challenge. In any shell you like, start with this
>> failing statement, and then fix it without retyping anything:
>>
>> sikorsky@sikorsky:~$ python -c "a=
On Sun, Oct 14, 2012 at 5:18 AM, wrote:
> On Saturday, October 13, 2012 12:48:23 PM UTC-4, Chris Angelico wrote:
>> No, I don't, because I haven't tried to use it. But allow me to give
>> two examples, one on each side of the argument.
>>
>> The 'tee
On Sun, Oct 14, 2012 at 5:21 AM, Joshua Landau
wrote:
> Because Python uses indentation, what would "if A: print(1); if B: print(2)"
> even do? It has to fail, because we have to assume consistent indentation
> for ";"s*. With "\n" as I proposed, you still have to indent: it is just a
> method to
On Sun, Oct 14, 2012 at 5:43 AM, Olive wrote:
> it seems when I read the code above that the proxy acts mostly as an
> orinary server with respect to the client except that it is supposed to
> receive the full URL instead of just the path. Am I right? Is there any
> documentation on what an http p
On Sun, Oct 14, 2012 at 6:06 AM, Joshua Landau
wrote:
> The fact that your proposal can't allow "a=[]\nfor x in range(10):
> a.append(x**a[-2])\nprint(a)" makes it somewhat an incomplete suggestion,
> and code like:
>
>> while True: while True: break; break
>
> is just confusing.
Agreed. However,
On Sun, Oct 14, 2012 at 8:31 AM, Joshua Landau
wrote:
> With two irritants (including 8), is it not advisable that python-list
> gets an admin to block these accounts? Even if it does nothing more than
> slow them, that's something.
That's what killfiles are for. You have two options:
http:/
On Sun, Oct 14, 2012 at 9:00 AM, Joshua Landau
wrote:
> That is also callable from the command-line like so:
>>
>> python -m debrace -c "if a: ${ print(1) $ print(2) $ while b: c() $ if g:
>> ${ pass }$ }$ print(d)"
Wait you're pretty much implementing from __future__ import braces?
ChrisA
-
On Sun, Oct 14, 2012 at 9:25 AM, Joshua Landau
wrote:
> On 13 October 2012 22:44, Chris Angelico wrote:
>>
>> On Sun, Oct 14, 2012 at 8:31 AM, Joshua Landau
>> wrote:
>> > With two irritants (including 8), is it not advisable that
>> > python-list
>
On Sun, Oct 14, 2012 at 9:24 AM, wrote:
> On Saturday, October 13, 2012 2:33:43 PM UTC-4, Chris Angelico wrote:
>>
>> Nice theory, but this is the bit that I fundamentally disagree with.
>> Forcing programmers to work in one particular style is usually not the
>> jo
On Sun, Oct 14, 2012 at 2:37 PM, Steven D'Aprano
wrote:
> On Sun, 14 Oct 2012 05:33:40 +1100, Chris Angelico wrote:
>
>> Forcing programmers to work in one particular style is usually not the
>> job of the language/framework/library.
>
> Have you actually programme
On Sun, Oct 14, 2012 at 3:23 PM, Vincent Davis wrote:
> OverflowError: Python int too large to convert to C long
> line 266, in _maketile
> bytecount = read(channels * ysize * 2)
Is the file over 2GB? Might be a limitation, more than a bug, and one
that could possibly be raised by using a 64-bi
On Sun, Oct 14, 2012 at 3:36 PM, Vincent Davis wrote:
> Oops, I was going to make note of the file size. 1.2MB
Then I'd definitely declare the file bad; I don't know what the valid
ranges for channels and ysize are, but my reading of that is that your
file's completely corrupt, maybe even malicio
if attr_name is None:
> attr_name = '_' + func.__name__
You assign to it, but there's no nonlocal declaration, so Python thinks
it's a local var, hence your error.
Pardon my brevity and some lack of trimming; I'm on a smartphone and in a
rush.
- Chri
On Sun, Oct 14, 2012 at 4:01 PM, Vincent Davis wrote:
> I can open it is and all looks good using Pixelmator (I don't have Photoshop
> installed). I don't think there is anything wrong with the image.
>
> Part of my question is a result of being new to actually using exceptions in
> my programs an
On Sun, Oct 14, 2012 at 9:36 PM, Juergen Bartholomae
wrote:
> Unfortunately, replacing __builtins__ at import time won't do, because
> external modules (that is, .py) get imported only once when they are
> accessed by the first thread, which includes (of course) setting up of
> __dict__ and __buil
things working. So, what's the
> neatest way to protect the get_text() method from empty data?
Filter out the `None`s with a generator expression:
", ".join(tag for tag in node.tags if tag is not None),
Cheers,
Chris
--
http://mail.python.org/mailman/listinfo/python-list
en/dev/ref/templates/builtins/?from=olddocs#floatformat
Cheers,
Chris
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Oct 16, 2012 at 12:45 AM, রুদ্র ব্যাণার্জী wrote:
> Dear friends,
> I am starting a project of creating a database using mySQL(my first
> project with database).
> I went to my institute library and find that, all books are managing
> "mySQL with perl and php"
>
> I am new to python itself
On Tue, Oct 16, 2012 at 12:55 AM, Debashish Saha wrote:
> how to insert random error in a programming?
how to ask question good in forumming?
http://www.catb.org/~esr/faqs/smart-questions.html
But here's one way to do it:
raise
random.choice((OSError,IOError,ZeroDivisionError,UnicodeDecodeErro
On Tue, Oct 16, 2012 at 1:47 AM, রুদ্র ব্যাণার্জী wrote:
> On Tue, 2012-10-16 at 01:01 +1100, Chris Angelico wrote:
>> But you may wish to consider using PostgreSQL instead.
> Thanks, as I am very much new in database thing, I am not very aware of
> the options I have.
> But in
On Tue, Oct 16, 2012 at 4:18 AM, Serhiy Storchaka wrote:
> On 15.10.12 17:04, Chris Angelico wrote:
>> On Tue, Oct 16, 2012 at 12:55 AM, Debashish Saha wrote:
>>> how to insert random error in a programming?
>>
>> how to ask question good in forumming?
>>
On Tue, Oct 16, 2012 at 6:28 AM, Mark Lawrence wrote:
> I like clearly written code like this
>
> "
> d = {}
> for c in (65, 97):
> for i in range(26):
> d[chr(i+c)] = chr((i+13) % 26 + c)
>
> print "".join([d.get(c, c) for c in s])
Surely there's a shorter way to rot13 a piece of tex
On Wed, Oct 17, 2012 at 5:24 PM, Steven D'Aprano
wrote:
> In an ideal world, we'd all agree on what counts as acceptable behaviour,
> and stick to it, and discuss nothing but Python coding problems. But we
> don't live in an idea world, and there are disagreements and people
> behaving badly, and
On Wed, Oct 17, 2012 at 5:27 PM, Dwight Hutto wrote:
> On Wed, Oct 17, 2012 at 2:06 AM, Demian Brecht wrote:
>> I can't ascertain what your strengths are as I don't work with you on a
>> daily basis (one of the many benefits of working with people smarter than
>> you ;)).
>
> Doubt that, unless
On Wed, Oct 17, 2012 at 8:37 PM, Hans Mulder wrote:
> I have no experience with win7/64, but on earlier versions of Windows,
> there's a file named "hosts", somewhere in a system directory. When
> looking up an IP address, this file is consulted first. Removing the
> ::1 from the entry for local
On Wed, Oct 17, 2012 at 9:10 PM, Anatoli Hristov wrote:
> Hello,
>
> I'm trying to index a text in a list as I'm importing a log file and
> each line is a list.
>
> What I'm trying to do is find the right line which contains the text
> User : and take the username right after the text "User :", bu
On Tue, Oct 16, 2012 at 1:41 PM, Noah Coad wrote:
> error: Not a recognized archive type:
> c:\users\noahco~1\appdata\local\temp\easy_
> install-gpekqc\PyMySQL-0.5.tar.gz
Nobody seems to have responded to this (or I haven't seen it), but it
looks like your system can't extract gzip files. Sugges
On Wed, Oct 17, 2012 at 11:40 PM, Ulrich Eckhardt
wrote:
> Concerning the question whether a firewall blocks and unnecessarily delays
> connection attempts to ::1, I haven't determined that yet. I'll ask our
> admins here to verify whether that is the case.
It would only be a software firewall on
On Thu, Oct 18, 2012 at 1:29 AM, Grant Edwards wrote:
> I disagree! I think occasional off-topic meta-arguments can be
> interesting and entertaining.
>
> Yow! Am I having a meta-meta-discussion yet?
Now we get to the meat of the discussion...
It's like I was explaining to one of my brothers t
On Thu, Oct 18, 2012 at 3:48 AM, wrote:
>On 10/16/2012 08:45 PM, Steven D'Aprano wrote:
>> Except that you've made a 180-
>> degree turn from your advice to "ignore" bad behaviour, but apparently
>> didn't notice that *sending private emails* is not by any definition
>> "ignoring". So apparently
On Thu, Oct 18, 2012 at 5:17 AM, wrote:
> Not at all, I knew this. In this I decided to program like
> this.
>
> Do you get it? Yes/No or True/False
Yes but why? When you're returning a boolean concept, why not return a
boolean value? You don't even use values with one that
compares-as-true an
On Thu, Oct 18, 2012 at 11:28 AM, Roy Smith wrote:
> One likely path is to check in /etc/nsswitch.conf to see what data
> sources the resolver should consult. On the box I'm using at the
> moment, it says:
>
> hosts: files dns
This is true on Linux, and presumably on various other Unice
On Thu, Oct 18, 2012 at 3:05 PM, Dwight Hutto wrote:
> On Wed, Oct 17, 2012 at 11:50 PM, wu wei wrote:
>> Did you really forward a private email to a public mailing list without
>> permission?
>>
>> Are you really that fucking ignorant of the law?
>
> This is a public discussion. Maybe you just n
On Thu, Oct 18, 2012 at 3:21 PM, Dwight Hutto wrote:
> On Thu, Oct 18, 2012 at 12:06 AM, alex23 wrote:
>> On Oct 18, 2:02 pm, Dwight Hutto wrote:
>> [a public response to a private email]
>>
>> I really don't appreciate you pushing public a *private email
>> exchange*, especially when it has not
On Thu, Oct 18, 2012 at 3:33 PM, Dwight Hutto wrote:
> On Thu, Oct 18, 2012 at 12:23 AM, Chris Angelico wrote:
>> Common misconception. The First Amendment to the United States
>> Constitution prohibits the *making of any law* that restricts certain
>> freedoms. It does no
On Thu, Oct 18, 2012 at 5:06 PM, Zero Piraeus wrote:
> What are people's preferred strategies for dealing with lines that go
> over 79 characters? A few I can think of off the bat:
>
> 1. Say "screw it" and go past 79, PEP8 be damned.
>
> 6. Realise that if it's that long, it probably shouldn't ha
character in my string representation. As
> this is not a valid json notation now.
If you want JSON, then *use the freakin' `json` std lib module*!
http://docs.python.org/library/json.html
repr(...) != JSON
[It's similar only coincidentally, and only to a degree.]
Regards,
Chris
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, Oct 18, 2012 at 8:07 PM, Hans Mulder wrote:
>
> if looks_like_it_might_be_spam(
> some_longer_variables,
> here_and_here, and_here_also):
> logger.notice("might be spam")
> move_to_spam_folder(some_longer_variables)
> update_spam_statistics(here_and_here)
>
This wants
On Thu, Oct 18, 2012 at 8:22 PM, wrote:
> On Thursday, October 18, 2012 10:42:56 AM UTC+2, Zero Piraeus wrote:
>> That is exactly what a webserver does. Is there some reason you don't
>> want to use e.g. Apache to handle the requests?
>
> no reason at all. so i guess the solution is much easier t
On Thu, Oct 18, 2012 at 7:22 PM, Anatoli Hristov wrote:
> It does not work the result is "0"
>
> And I don't find any documentation about it :(
Microsoft's official documentation can usually be found at the other
end of a web search. In this case:
http://msdn.microsoft.com/en-us/library/windows/
On Thu, Oct 18, 2012 at 10:41 PM, lars van gemerden
wrote:
> NameError: name 'function' is not defined
>
> which seems an odd error, but i think some global variable is necessary for
> this to work (if i put in globals() instead of {}, it works).
The def statement simply adds a name to the curre
On Fri, Oct 19, 2012 at 1:07 AM, lars van gemerden wrote:
> Thanks, Chris,
>
> That works like a charm (after replacig "return ns.function" with "return
> ns['function']" ;-) ).
Err, yes, I forget sometimes that Python doesn't do that. Jav
On Fri, Oct 19, 2012 at 2:00 AM, lars van gemerden wrote:
> I get your point, since in this case having the custom code option makes the
> system a whole lot less complex and flexible, i will leave the option in. The
> future customer will be informed that they should handle the security around
On Fri, Oct 19, 2012 at 2:49 AM, Dan Stromberg wrote:
> In fact, I tend to do lots of "otherwise pointless" variables, because I
> want to be able to quickly and easily insert print statements/functions
> without having to split up large commands, during debugging.
When will we next have a langu
On Fri, Oct 19, 2012 at 3:13 AM, Neil Cerutti wrote:
> Though technology has moved along swiftly, keeping your code
> accessible to the guy using a crummy old console xterm might
> still be worthwhile, and it makes printouts easy to create.
And keeping your interface accessible to someone who can
On Fri, Oct 19, 2012 at 3:16 AM, Evan Driscoll wrote:
>Python isn't as bad as C++ though (my main other language), where
>80 characters can go by *very* quickly.
>
> 2. Backslash continuations are *terrible*. I hate them with a firery
>passion. :-) A line could be 1000 characters long
On Thu, Oct 18, 2012 at 9:47 AM, Dave Angel wrote:
> On 10/18/2012 12:26 PM, Chris Angelico wrote:
> > On Fri, Oct 19, 2012 at 3:16 AM, Evan Driscoll
> wrote:
> >>Python isn't as bad as C++ though (my main other language), where
> >>80 characters ca
On Fri, Oct 19, 2012 at 9:02 PM, Gilles wrote:
> 1. Mongoose must be told in the shebang file where to locate the
> interpreter, but ActivePython 2.5.1 comes with fours files that look
> like the interpreter (actually, two files, since the other two have
> the same size so they are probably left o
On Fri, Oct 19, 2012 at 12:03 PM, Pradipto Banerjee
wrote:
>
> Thanks, I tried that. Still got MemoryError, but at least this time python
> tried to use the physical memory. What I noticed is that before it gave me
> the error it used up to 1.5GB (of the 2.23 GB originally showed as available)
On Sat, Oct 20, 2012 at 4:08 AM, Pradipto Banerjee
wrote:
> I am trying to read a file into memory. The size of the file is around 1 GB.
> I have a 3GB memory PC and the Windows Task Manager shows 2.3 GB available
> physical memory when I was trying to read the file. I tried to read the file
> as
On Sat, Oct 20, 2012 at 10:43 AM, lars van gemerden
wrote:
> Do you have any ideas about to what extend the "lambda" version of the code
> (custom code is only the 'body' of the lambda function) has the same issues?
The lambda version definitely has the same issues. You can do pretty
much anythi
On Sat, Oct 20, 2012 at 9:22 AM, Pradipto Banerjee
wrote:
> Dennis,
>
> 1. Yes, .readlines() work where .read() fails. Thanks for the suggestion -
> this has really given a big boost to the size of the data I can read.
If at all possible, consider reading the file iteratively and
retaining only
On Sun, Oct 21, 2012 at 7:07 PM, Steven D'Aprano
wrote:
> On Sat, 20 Oct 2012 14:18:47 +, Grant Edwards wrote:
>> True, but nobody prints source code out on paper do they?
>
> I do.
>
> There's nothing better than spreading out a dozen sheets of source code
> over a table to get a good, high-l
On Sun, Oct 21, 2012 at 9:00 PM, Steven D'Aprano
wrote:
> Er, no. Note spelling of "source code" vs "souce code". Hence the grin.
Ahh. I totally didn't see that, I'm way too used to reading past
typos. Sure. Printing out *source* code, that's altogether different.
Me, though, I don't print anyth
On Mon, Oct 22, 2012 at 6:11 AM, Steven D'Aprano
wrote:
> On Sun, 21 Oct 2012 22:43:07 +1100, Chris Angelico wrote:
>
>> On Sun, Oct 21, 2012 at 9:00 PM, Steven D'Aprano
>> wrote:
>>> Er, no. Note spelling of "source code" vs "souce code&qu
On Mon, Oct 22, 2012 at 7:19 AM, Roy Smith wrote:
> Of course, the same can happen in Python. I could do:
>
> foo = "default value"
> if blah == 47:
>fooo = "some other value"
> print foo
>
> No syntax error, no NameError, just the wrong thing printing.
Yeah, that's the worst kind of bug. No
On Mon, Oct 22, 2012 at 5:30 PM, Steven D'Aprano
wrote:
> For languages without static types, what other reasons for declaring
> variables are there?
The main one is scope nesting. Compare a few different languages.
Python: If you don't declare, it's global if you don't rebind it, but
local if y
tters and
numbers isn't completely arbitrary, some further improvements are also
possible.
Some relevant docs:
http://docs.python.org/library/stdtypes.html#string-methods
http://docs.python.org/tutorial/datastructures.html#list-comprehensions
Cheers,
Chris
P.S.: I'm guessing you obtained `L` from file.readlines() or similar;
it is worth noting for future reference that the readlines() method is
considered somewhat deprecated.
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Oct 24, 2012 at 9:37 PM, Morten Engvoldsen wrote:
> I am facing issue with input() of Python 2.7. When i run the program it
> doesn't display any line to take user input . Below is the code:
>
> But the above print function doesn't display the out put in same way. I am
> new to Python and
On Wed, Oct 24, 2012 at 11:11 PM, inshu chauhan wrote:
> print " Adding twice of %4.2f gives " % (y.addtwice())
>
>
> Error is :
>
> Traceback (most recent call last):
> File "Z:\learning Python\learn5.py", line 35, in
> print " Adding twice of %4.2f gives " % (y.addtwice())
> TypeError: ad
On Thu, Oct 25, 2012 at 12:02 AM, inshu chauhan wrote:
> I changed the programme to this :
> def addtwice(self, x):
> self.add(x)
> self.add(x)
> return x
> y = Bag()
> print y.addtwice(4)
>
> Now its not showing any error but result is same as the number passed for
On Thu, Oct 25, 2012 at 1:02 AM, inshu chauhan wrote:
> ok.. This was an example i was trying to run from
> http://docs.python.org/tutorial/classes.html ...
I would strongly recommend going back a bit in the tutorial and
reading about functions:
http://docs.python.org/tutorial/controlflow.html
On Thu, Oct 25, 2012 at 2:14 AM, Zero Piraeus wrote:
> By the way ... while Bag.addtwice() is legal Python [and I understand
> that you're just playing around here], a method that both "does
> something" [changes the object] and "gives something" [returns a
> useful value] when that's not strictly
On Thu, Oct 25, 2012 at 3:10 AM, Zero Piraeus wrote:
> On 24 October 2012 11:18, Chris Angelico wrote:
>> On Thu, Oct 25, 2012 at 2:14 AM, Zero Piraeus wrote:
>>> [... on return values and side effects ...]
>>
>> Side point: It's not that it's *bad* code
On Thu, Oct 25, 2012 at 9:26 AM, Cameron Simpson wrote:
> If I could write this as:
>
> if re_FUNKYPATTERN.match(test_string) as m:
> do stuff with the results of the match, using "m"
Then you'd be right there with C-like languages where assignment is an
expression :)
while (tok = strtok(b
On Wed, Oct 24, 2012 at 9:27 PM, seektime wrote:
> On Tuesday, October 23, 2012 11:07:29 PM UTC-7, Chris Rebert wrote:
>> P.S.: I'm guessing you obtained `L` from file.readlines() or similar;
>> it is worth noting for future reference that the readlines() method is
&g
On Thu, Oct 25, 2012 at 12:15 PM, Steven D'Aprano
wrote:
> I don't believe that there is any
> way to jump back to the line of code that just failed (and why would you,
> it will just fail again)
There are several reasons to retry something after an exception,
mainly if some external state gets c
On Fri, Oct 26, 2012 at 2:25 AM, Christian Heimes wrote:
> Simple, easy, faster than a Python loop but not very elegant:
>
>bin(number).count("1")
Unlikely to be fast.
What you may want is some sort of hybrid loop/lookup approach. Do you
know what your highest bit number is going to be? For
On Fri, Oct 26, 2012 at 2:31 AM, Hans Mulder wrote:
> This seems to work; I'm not sure how robust it is:
>
> import signal
>
> def handler(signum, frame):
> while True:
> q = raw_input("This will quit the program, are you sure? [y/N]")
> if q[:1] in "yY":
> raise Ke
On Fri, Oct 26, 2012 at 3:17 AM, rusi wrote:
> On Oct 25, 8:57 pm, Steven D'Aprano [email protected]> wrote:
>> py> min(t.repeat(number=1, repeat=7))
>> 0.6819710731506348
>> py> min(t.repeat(number=100, repeat=7))
>> 4.141788959503174
>>
>> That makes the "inelegant" solution u
On Fri, Oct 26, 2012 at 5:06 PM, Paul Rubin wrote:
> Dan Loewenherz writes:
>> In this case, profile_id is "None" when the loop breaks. It would be
>> much more straightforward (and more Pythonic, IMO), to write:
>>
>> client = StrictRedis()
>> while client.spop("profile_ids") as profile_
On Sat, Oct 27, 2012 at 3:23 AM, Steven D'Aprano
wrote:
> In real life, you are *much* more likely to run into these examples of
> "insanity" of floats than to be troubled by NANs:
>
> - associativity of addition is lost
> - distributivity of multiplication is lost
> - commutativity of addition is
On Sat, Oct 27, 2012 at 10:19 AM, Devin Jeanpierre
wrote:
> On Fri, Oct 26, 2012 at 2:23 AM, Chris Angelico wrote:
>> while (client.spop("profile_ids") as profile_id) is not None:
>> print profile_id
>>
>> Why is everyone skirting around C-style assign
On Sun, Oct 28, 2012 at 12:13 AM, Shaojun Li wrote:
> nothing
Step aside, 'import this', we've found the true Zen of Python!
ChrisA
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, Oct 28, 2012 at 1:42 AM, wrote:
> Hi Guys,
>
> I have a DLL which written in C language, one of the function is to allocate
> a structure, fill the members and then return the pointer of the structure.
>
> After Python called this function, and done with the returned structure, I
> woul
On Sun, Oct 28, 2012 at 2:40 AM, Ken Chen wrote:
> Yes, I agree writing a corresponding API to free the memory is the best
> practice and best bet.
> Sometimes, the third party API may not provide that.
Then that's a majorly dangerous third party API. The only time it's
safe to provide a half-on
On Sun, Oct 28, 2012 at 4:57 PM, Devin Jeanpierre
wrote:
> What if he wants to avoid both downsides A and B? What solution does
> he use then?
He switches to a language whose BDFL is not Steven D'Aprano. :)
No offense meant Steven...
ChrisA
--
http://mail.python.org/mailman/listinfo/python-lis
consider using SQLite (or some other database) if you will
be doing queries over the data that would be amenable to SQL or
similar.
http://docs.python.org/2/library/sqlite3.html
Cheers,
Chris
P.S. The verbose disclaimer at the end of your emails is kinda annoying...
--
http://mail.python.org/ma
On Sun, Oct 28, 2012 at 6:12 PM, F.R. wrote:
>
> How about:
>
> line = True
> while line:
>
> line = function(x, y, z)
> do something with(line)
>
> ?
That's going to go through the body of the loop with a false line
before breaking out. In some situations that's not a problem, bu
use a class variable like
> this? What would be the dot notation?
All of the following would work:
Contact.all_contacts # as in the example
self.__class__.all_contacts
self.all_contacts # probably not advisable
Which one you ought to use becomes complicated when you consider the
general cas
plementable code.
Actually, it's quite workable. It's enough to paste into the
interactive interpreter and play with. That's one of Python's best
features - it's really easy to play with. And if you put parentheses
around your print argument, it'll be fully Python 3 compatible (though
when you run it in Python 2, you get an old-style class - but since
the book's assuming Py3, new-style is what you want anyway).
>>> for i in Contact.all_contacts:
print(i.name + ' ' + i.email)
Hope that helps!
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
.
It has nothing to do with implicit casting between strings and numbers
(which, as a general rule, Python does not do).
From the same linked section as before:
"CPython implementation detail: Objects of [incompatible types] are
ordered by their type names"
So ints come before strs
On Mon, Oct 29, 2012 at 10:51 AM, Mark L. Hotz wrote:
> At the IDLE prompt, when I enter “b” > 99, it responds True. In fact, it
> doesn’t matter which number is entered here, “b” is always greater (e.g. “b”
>> 1 == True; “b” > 10 == True, or “b” < 99 = False).
To Python, different object typ
On Mon, Oct 29, 2012 at 3:30 PM, Evan Driscoll wrote:
> On 10/28/2012 7:18 PM, Chris Angelico wrote:
>> Which means that strings will ALWAYS be compared as strings, and
>> numbers will ALWAYS be compared as numbers, and ne'er the twain shall
>> conflict. I can trust Py
Python 3.2.3?
They are compatible.
http://scipy.github.com/faq.html#do-numpy-and-scipy-support-python-3-x :
"The first release of NumPy to support Python 3 was NumPy 1.5.0."
Cheers,
Chris
--
http://mail.python.org/mailman/listinfo/python-list
the more general case, the slice syntax thus produces a
`slice` rather than an `xrange`.
Doubtlessly, there are also historical issues involved. As implied by
the ugliness of its name, `xrange` was added to the language
relatively later.
Cheers,
Chris
--
http://mail.python.org/mailman/listinfo/python-list
by* Google Groups;
they just happen to carry our posts.
Personally, I'd suggest using our mailing list mirror instead:
http://mail.python.org/mailman/listinfo/python-list
Or use some other, better newsgroup provider that also carries us.
[1]: http://en.wikipedia.org/wiki/Usenet
Regards,
Chri
rn value from `a.__getitem__( slice(1,5) )`
(or, equivalently, from `[1,2,3,4,5][1:5]`). It is not the result of
"print item"; that line of code is never executed since you never used
the RangedSlicer class at all.
Regards,
Chris
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, Oct 29, 2012 at 10:19 PM, Steven D'Aprano
wrote:
>> In 'C', where Python is written,
>
> That's a popular misapprehension. Python is written in Java, or Lisp, or
> Haskell, or CLR (dot Net), or RPython, or Ocaml, or Parrot. Each of those
> languages have, or had, at least one Python implem
On Mon, Oct 29, 2012 at 3:52 PM, Andrew Robinson
wrote:
> I am curious as to how quickly it constructs the result compared to a slice
> operation.
>
> Eg:
> a[1:5]
> vs.
> [ a[i] for i in xrange[1:5] ]
For the most part, don't concern yourself with performance. Go with
functionality and readabili
1601 - 1700 of 20008 matches
Mail list logo