In article <5031bb2f$0$29972$c3e8da3$54964...@news.astraweb.com>,
Steven D'Aprano wrote:
> > So it may be with utf-8 someday.
>
> Only if you believe that people's ability to generate data will remain
> lower than people's ability to install more storage.
We're not talking *data*, we're talki
In article ,
Michael Torrie wrote:
> Python generally tries to follow unicode
> encoding rules to the letter. Thus if a piece of text cannot be
> represented in the character set of the terminal, then Python will
> properly err out. Other languages you have tried, likely fudge it
> somehow.
In article ,
Walter Hurry wrote:
> It is difficult to think of a sensible use for os.chdir, IMHO.
It is true that you can mostly avoid chdir() by building absolute
pathnames, but it's often more convenient to just cd somewhere and use
names relative to that. Fabric (a very cool tool for writ
In article ,
Michael Torrie wrote:
> > And if you want the "fudge it somehow" behavior (which is often very
> > useful!), there's always http://pypi.python.org/pypi/Unidecode/
>
> Sweet tip, thanks! I often want to process text that has smart quotes,
> emdashes, etc, and convert them to plain
In article ,
Chris Angelico wrote:
> On Tue, Aug 21, 2012 at 10:20 AM, alex23 wrote:
> > On Tue, Aug 21, 2012 at 12:01 AM, Levi Nie wrote:
> >> Does Polymorphism mean python can create object?
> >
> > No. This isn't D&D. Polymorphism has a distinct meaning in computer
> > science, one which yo
In article
<5203ee16-5a80-4cd9-9434-ee2efb645...@kg10g2000pbc.googlegroups.com>,
Anonymous Group wrote:
> What books do you recomend for learning python? Preferably free and/or
> online.
I would start with http://docs.python.org/tutorial/
--
http://mail.python.org/mailman/listinfo/python-list
In article <6b0299df-bc24-406b-8d69-489e990d8...@googlegroups.com>,
Tigerstyle wrote:
> Hi.
>
> I need help with an assignment and I hope you guys can guide me in the right
> direction.
> [code elided]
> 1. The test_1() method includes code to verify that the test directory
> contains only th
ur deployment to using virtualenv (with
--no-site-packages), but we're not fully there yet. And even when we get
there, there will still be opportunities to make these sorts of mistakes.
---
Roy Smith
r...@panix.com
--
http://mail.python.org/mailman/listinfo/python-list
On Thursday, August 23, 2012 1:29:19 PM UTC-4, Terry Reedy wrote:
> One can start with a set rather than tuple of file names.
> filenames = {"this.txt", "that.txt", "the_other.txt"}
Yeah, that's even cleaner. Just be aware, the set notation above is only
available in (IIRC), 2.7 or abo
In article ,
Evan Driscoll wrote:
> > In fact, Python doesn't have variables not as C or Java programmers
> > would understand the term. What it has instead are references to objects
> > (with names as one kind of reference).
>
> OK, I've seen this said a few times, and I have to ask: what do
On Sunday, July 29, 2012 12:01:00 PM UTC-4, lipska the kat wrote:
> How is python used in the real world.
songza.com is pretty close to 100% python. The only significant non-python
code on the server side are mongodb, haproxy, and nginx.
> What sized projects are people involved with
We've got
In article ,
Chris Angelico wrote:
> On Sun, Aug 26, 2012 at 3:45 PM, Evan Driscoll wrote:
> > Third, and more wackily, you could technically create a C implementation
> > that works like Python, where it stores variables (whose addresses aren't
> > taken) in a dict keyed by name, and generates
In article <503a2804$0$6574$c3e8da3$54964...@news.astraweb.com>,
Steven D'Aprano wrote:
>>> The mapping of name:address is part of the *compilation* process --
>>> the compiler knows that variable 'x' corresponds to location
>>> 12345678
Just to pick a nit, the compiler probably doesn't know
In article <503f0e45$0$9416$c3e8da3$76491...@news.astraweb.com>,
Steven D'Aprano wrote:
> The only thing which is innovative here is that instead of the Python
> compiler declaring that "all strings will be stored in UCS-2", the
> compiler chooses an implementation for each string as needed. S
In article ,
MRAB wrote:
> What don't you ask Python? I'm sure you'' get something like this:
>
> >>> type(s)
>
BTW, this points out one of the really powerful aspects of Python. The
combination of introspection and a handy interactive interpreter makes
it easy to "just ask the computer".
In article <503f8e33$0$30001$c3e8da3$54964...@news.astraweb.com>,
Steven D'Aprano wrote:
> On Thu, 30 Aug 2012 07:02:24 -0400, Roy Smith wrote:
> > Is the implementation smart enough to know that x == y is always False
> > if x and y are using differen
In article ,
Mark Lawrence wrote:
> On 02/09/2012 13:00, Serhiy Storchaka wrote:
> > On 02.09.12 12:52, Peter Otten wrote:
> >> Ian Kelly wrote:
> >>
> >>> Rewriting the example to use locale.strcoll instead:
> >>
> >> sorted(li, key=functools.cmp_to_key(locale.strcoll))
> >>
> >> There is a
In article <50440de2$0$29967$c3e8da3$54964...@news.astraweb.com>,
Steven D'Aprano wrote:
> > Indexing is O(0) for any string.
>
> I think you mean O(1) for constant-time lookups.
Why settle for constant-time, when you can have zero-time instead :-)
--
http://mail.python.org/mailman/listinfo/p
There's been a bunch of threads lately about string implementations, and
that got me thinking (which is often a dangerous thing).
Let's assume you're testing two strings for equality. You've already
done the obvious quick tests (i.e they're the same length), and you're
down to the O(n) part of
In article <-9cdnaqjtk6nktvnnz2dnuvz_gedn...@westnet.com.au>,
Neil Hodgson wrote:
> The memcpy patch was controversial as it broke Adobe Flash
An added benefit!
--
http://mail.python.org/mailman/listinfo/python-list
In article ,
charvigro...@gmail.com wrote:
> Hi Guys,
>
> Finally I have decided to put best interview question and answers.
>
> Please visit http://www.f2finterview.com/web/CorePython/ for core python and
> http://www.f2finterview.com/web/PythonAdvanced/ for advanced python
I was going to co
In article ,
Ian Kelly wrote:
> It's a bit sad that these are touted as answers to interview
> questions. I wouldn't hire anybody who gave answers like these.
Over time, I've become convinced that most interview questions are crap.
The best programming interview questions always start with,
In article ,
Ian Kelly wrote:
> My mistake. I didn't even know there was a two-arg form of LIMIT.
> Must be a MySQL thing. :-)
What are you talking about? SQL is an ISO Standard. Therefore, all
implementations work the same way. Didn't you get the memo?
--
http://mail.python.org/mailman/l
In article <50485fca$0$29977$c3e8da3$54964...@news.astraweb.com>,
Steven D'Aprano wrote:
> In any case, the *worst* case for string equality
> testing is certainly O(N) (every character must be looked at), and the
> *best* case is O(1) obviously (the first character fails to match).
The best
In article <50484643$0$29977$c3e8da3$54964...@news.astraweb.com>,
Steven D'Aprano wrote:
> On Wed, 05 Sep 2012 14:27:44 -0400, Terry Reedy wrote:
>
> > On 9/5/2012 8:48 AM, Ramchandra Apte wrote:
> >
> > > and "a==True" should be automatically changed into memory comparison.
> >
> > I have n
In article , John Nagle
wrote:
> In Python 2.7:
>
>I want to parse standard ISO date/time strings such as
>
> 2012-09-09T18:00:00-07:00
>
> into Python "datetime" objects. The "datetime" object offers
> an output method , datetimeobj.isoformat(), but not an input
> parser. There o
In article ,
Dave Angel wrote:
> For working with datetime, see
> http://docs.python.org/library/datetime.html#datetime.datetime
>
> and look up datetime.strptime()
strptime has two problems.
One is that it's a pain to use (you have to look up all those
inscrutable %-thingies every time
In article <9s4nh9-8dr@chris.zbmc.eu>, tinn...@isbd.co.uk wrote:
> I want to print a series of list elements some of which may not exist,
> e.g. I have a line:-
>
> print day, fld[1], balance, fld[2]
>
> fld[2] doesn't always exist (fld is the result of a split) so the
> print fails whe
In article ,
Token Type wrote:
> I wrote the following function to solve it. However, it pops up
> "AttributeError: 'list' object has no attribute 'lower'". Quite confused, I
> supposed [synset.lemma_names for synset in synset_list] has made all the
> lemma into a list, hasn't it?
I'm not fa
In article , John Nagle
wrote:
> This really should be handled in the standard library, instead of
> everybody rolling their own, badly.
+1
--
http://mail.python.org/mailman/listinfo/python-list
In article ,
Thomas Jollans wrote:
> The ISO date/time format is dead simple and well-defined.
Well defined, perhaps. But nobody who has read the standard could call
it "dead simple". ISO-8601-2004(E) is 40 pages long.
Of course, that fact that it's complicated enough to generate 40 pages
In article <43a68990-d6cf-4362-8c47-b13ce780b...@googlegroups.com>,
Token Type wrote:
> Thanks very much for all of your tips. Take noun as an example. First, I need
> find all the lemma_names in all the synsets whose pos is 'n'. Second, for
> each lemma_name, I will check all their sense numb
In article ,
Token Type wrote:
> > structures are simple, just plain print will work, but for more
> >
> > complicated structures, pprint.pprint() is a life saver.
> >
>
> I did try . However,
>
> >>> pprint.pprint(lemma_list)
>
> Traceback (most recent call last):
> File "", line 1, in
In article ,
Chris Angelico wrote:
> On Tue, Sep 11, 2012 at 7:46 AM, Rhodri James
> wrote:
> > On Sun, 09 Sep 2012 13:14:30 +0100, Roy Smith wrote:
> >
> >> In article ,
> >> Thomas Jollans wrote:
> >>
> >>> The ISO date/time
The atexit docs (http://docs.python.org/library/atexit.html) are very
confusing. In one place they say, "The order in which the functions are
called is not defined". In another place, "all functions registered are
called in last in, first out order". Which is correct?
Also, it's not clear ho
In article ,
Terry Reedy wrote:
> On 9/12/2012 8:58 PM, Roy Smith wrote:
> > The atexit docs (http://docs.python.org/library/atexit.html) are very
> > confusing. In one place they say, "The order in which the functions are
> > called is not defined". I
In article ,
> i see you try to extract only the 1st element of the list, i tried that too
> but it gives me now this weird message:
>
> if you visit my website http://superhost.gr
Do you realize that the hosting service you're using (HostGator) is so
mis-configured that it is exposing your so
In article ,
Íéêüëáïò Êïýñáò wrote:
> I cant beleive that my source code can be seen form ANYONE this easily
Which is why I pointed it out. I mean no disrespect, but you appear to
be in over your head. That's fine (we're all in over our heads at some
point, that's how we learn new thing
In article <4f9d9a0b-539a-4b6a-af3e-b02d1f400...@googlegroups.com>,
Íéêüëáïò Êïýñáò wrote:
> Iam sorry i didnt do that on purpose and i dont know how this is done.
>
> Iam positng via google groups using chrome, thats all i know.
>
> Whats a mailing list?
Is it September already?
--
http://
In article
<6c732de0-b10f-4d40-853c-f62682970...@rg9g2000pbc.googlegroups.com>,
alex23 wrote:
> On Sep 16, 11:18 pm, Ben Finney wrote:
> > Using Google Groups for posting to Usenet has been a bad idea for a long
> > time, but now it just seems to be a sure recipe for annoying the rest of
> > u
In article ,
Ian Kelly wrote:
> On Mon, Sep 17, 2012 at 7:08 PM, David Smith wrote:
> > How do I "indent" if I have something like:
> > if (sR=='Cope'): sys.exit(1) elif (sR=='Perform') sys.exit(2) else
> > sys.exit(3)
>
> How about:
>
> if sR == 'Cope':
> sys.exit(1)
> elif sR == 'Perfor
In article ,
Andriy Kornatskyy wrote:
> I have run recently a benchmark of a trivial 'hello world' application for
> various python web frameworks (bottle, django, flask, pyramid, web.py,
> wheezy.web) hosted in uWSGI/cpython2.7 and gunicorn/pypy1.9... you might find
> it interesting:
>
> ht
In article ,
Kevin Walzer wrote:
> the comments of those who say "the only
> language I need to know is Python" strike me as a bit limited.
I have been convinced that "X is the only language I need to know", for
many different values of X over the years.
--
http://mail.python.org/mailman/lis
In article ,
Hannu Krosing wrote:
> You can get only so far using "sales". At some point you have to deliver.
But, by that time, the guy who closed the sale has already cashed his
bonus check, bought his new BMW, and moved on to another company.
And around that time, some poor schmuck of a de
In article <2e8a9e88-9e7e-43f7-a070-ea9054e62...@googlegroups.com>,
Jayden wrote:
> In learning Python, I found there are two types of classes? Which one are
> widely used in new Python code? Is the new-style much better than old-style?
> Thanks!!
If you're just learning Python 2.x, you might
In article <34va6856ocuas7jpueujscf3kdt7k44...@4ax.com>,
Gilles wrote:
> Hello
>
> I've seen both shebang lines to run a Python script on a *nix host:
>
> #!/usr/bin/env python
> #!/usr/bin/python
>
> What's the difference?
The first one looks through your PATH to find the right python
inte
In article ,
Chris Angelico wrote:
> there's no efficient and reliable way to change/reload code in a
> running application (not often an issue).
What we do (largely cribbed from django's runserver) is start up a
thread which once a second, looks at all the modules in sys.modules,
checks to
In article ,
Chris Angelico wrote:
> On Mon, Oct 1, 2012 at 12:23 AM, Roy Smith wrote:
> > In article ,
> > Chris Angelico wrote:
> >
> >> there's no efficient and reliable way to change/reload code in a
> >> running application (not often an issu
In article ,
Chris Angelico wrote:
> you can't, for instance, retain a "socket connection object" across
> that sort of reload.
Yeah, that's a problem. There's nothing fundamental about a TCP
connection endpoint which precludes it being serialized and passed
around. The amount of state inv
In article
<4806a0b7-818a-4844-8286-f1b891a3c...@rj6g2000pbc.googlegroups.com>,
rusi wrote:
> Here's a test to help you decide: How do you respond to the word
> 'magic'? If positive you will like Ruby, if not you may prefer
> Python.
Some might say that magic underscores a lot of the really
In article ,
Peter Otten <__pete...@web.de> wrote:
> >> Another is to remove it from the global namespace with
> >>
> >> del TestBase
When I had this problem, that's the solution I used.
--
http://mail.python.org/mailman/listinfo/python-list
In article ,
Chris Rebert wrote:
> But at any rate:
> shortfall = 4 - len(your_tuple)
> your_tuple += (None,) * shortfall # assuming None is a suitable default
> a, b, c, d = your_tuple
>
> If you also need to handle the "too many items" case, use slicing:
> a, b, c, d = your_tuple[:4]
I usual
In article <507170e9$0$29978$c3e8da3$54964...@news.astraweb.com>,
Steven D'Aprano wrote:
> I've just looked at one of my classes, picked randomly, and the largest
> method is twelve lines, the second largest is eight, and the average is
> three lines.
I took a look at a subtree of the project
In article ,
Terry Reedy wrote:
> On 10/8/2012 3:28 PM, mooremath...@gmail.com wrote:
> > What's the best way to accomplish this? Am I over-complicating it? My gut
> > feeling is there is a better way than the following:
> >
> import itertools
> x = [1, 2, 3]
> y = list(itertoo
In article <50741ffe$0$6574$c3e8da3$54964...@news.astraweb.com>,
Steven D'Aprano wrote:
> On Tue, 09 Oct 2012 04:59:49 -0700, argbsk wrote:
>
> > below is the text file i have How to create Facility as a key and then
> > assign multiple values to it
>
> To use Facility as a key in a dict:
>
>
In article
<1krpdak.u0qy9e1a4knspn%real-not-anti-spam-addr...@apple-juice.co.uk>,
real-not-anti-spam-addr...@apple-juice.co.uk (D.M. Procida) wrote:
> Mark Lawrence wrote:
>
> > On 09/10/2012 14:24, D.M. Procida wrote:
> > > What exactly is the point of a private method? Why or when would I wa
In article ,
moo...@yahoo.co.uk wrote:
> I need to define some configuration in a file that will be manually created.
> [...]
> json seemed a quick an easy way of achieving this
JSON would not be my first choice for a file which needs to be
maintained by hand.
I've only recently started using
In article <507a3365$0$6574$c3e8da3$54964...@news.astraweb.com>,
Steven D'Aprano wrote:
> Remember using PEEK and POKE commands with BASIC back in
> 1978? Pretty much impossible in Python.
But, trivial to implement as an extension :-)
--
http://mail.python.org/mailman/listinfo/python-list
In article ,
MRAB wrote:
> Which codepoint is it? What is the codepoint's name?
>
> Here's how to find out:
>
> >>> hex(ord("?"))
> '0x190'
> >>> import unicodedata
> >>> unicodedata.name("?")
> 'LATIN CAPITAL LETTER OPEN E'
Wow, I never knew you could do that. I usually just google for
In article ,
Dennis Lee Bieber wrote:
> Classically, NNTP did not have "attachments" as seen in MIME email.
NNTP (Network News Transport Protocol) and SMTP (Simple Mail Transfer
Protocol) are both just ways of shipping around messages. Neither one
really knows about attachments. In bo
In article <1b8tk9-un9@chris.zbmc.eu>, tinn...@isbd.co.uk wrote:
> The function producing the error is:-
>
> def get_text(self, idx): # override !
> node = self.items[idx]
>
> a= [
> ", ".join(node.tags),
> node.comment,
>
In article ,
Dennis Lee Bieber wrote:
> For routine database /access/ (that is, someone has created the
> database user account that will be used), MySQLdb is the Python adapter
> to connect to the server. For using THAT, you basically need to know SQL
> (MySQL's flavor in particular), along wit
In article
,
rusi wrote:
> On Oct 15, 9:00 pm, John Gordon wrote:
> > In Debashish Saha
> > writes:
> >
> > > how to insert random error in a programming?
> >
> > Open the program source file and replace the Nth character with a random
> > character.
>
> I'm reminded of a description of vi
In article <1s42l9-9al@satorlaser.homedns.org>,
Ulrich Eckhardt wrote:
> Hi!
>
> I noticed yesterday that a single HTTP request to localhost takes
> roughly 1s, regardless of the actually served data, which is way too
> long. After some digging, I found that the problem lies in
> socket.
In article ,
Ulrich Eckhardt wrote:
> Some updates on the issue:
>
> The etc/hosts file contains the following lines:
>
> # localhost name resolution is handled within DNS itself.
> # 127.0.0.1 localhost
> # ::1 localhost
>
> As I understand it, those effectively
In article <5081d0c3$0$30003$c3e8da3$54964...@news.astraweb.com>,
Steven D'Aprano wrote:
> Some code might be more conveniently written as a single long line. But I
> would argue that nearly never is code more easily *read* as a single long
> line, and since code is read much more than it is w
In article ,
Grant Edwards wrote:
> On 2012-10-21, 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". Hence the grin.
> >>
> >>
In article <5084e819$0$29897$c3e8da3$54964...@news.astraweb.com>,
Steven D'Aprano wrote:
> On Mon, 22 Oct 2012 07:22:18 +1100, Chris Angelico wrote:
>
> > On Mon, Oct 22, 2012 at 6:11 AM, Steven D'Aprano
> > wrote:
>
> >>> Ahh. I totally didn't see that, I'm way too used to reading past
> >>>
I have a url from which I can get an image. I want to use PIL to
manipulate that image. Getting the image is easy:
>>> import requests
>>> r = requests.get(url)
There's a bunch of factory functions for Image, but none of them seem
to take anything that requests is willing to give you. Image.ne
In article ,
Kushal Kumaran wrote:
> On 23 Oct 2012 14:06:59 -0400, r...@panix.com (Roy Smith) wrote:
> > I have a url from which I can get an image. I want to use PIL to
> > manipulate that image. Getting the image is easy:
> >
> > >>> import r
In article ,
Schneider wrote:
> Hi Folkz,
> how can i create a SSH-Connection with python? I have to send some
> commands to the remote host and parse their answers.
> greatz Johannes
At a low level, you want to look at the paramiko library. Built on top
of that, and adding hoards of neat fu
In article ,
Gelonida N wrote:
> Another problem is, that paramiko depends on pycrypto 2.1+
> which doesn't exist as binary release for python 2.7
I'm running paramiko-1.7.6 with python 2.7.3 on my Ubunto Precise box.
I'm reasonably sure all I did was "pip install paramiko".
On the other han
In article ,
Gelonida N wrote:
> The sh module looks intersting, but it's not supported for Windows
> platforms.
"The X module looks interesting but it's not supported for Windows" is
true for many values of X. It's all part of the TCO of using a
brain-dead operating system.
--
http://mail
In article ,
Andrew Robinson wrote:
> Show me an example where someone would write a slice with a negative and
> a positive index (both in the same slice);
> and have that slice grab a contiguous slice in the *middle* of the list
> with orientation of lower index to greater index.
It's possib
In article ,
Gelonida N wrote:
> On 10/29/2012 02:10 PM, Roy Smith wrote:
> > In article ,
> > Gelonida N wrote:
> >
> >> The sh module looks intersting, but it's not supported for Windows
> >> platforms.
> >
> > "The X module look
In article ,
Ian Kelly wrote:
> On Mon, Oct 29, 2012 at 9:42 AM, Andrew Robinson
> wrote:
> > The list was generated in a single pass by many .append() 's, and then
> > copied once -- the original was left in place; and then I attempted to slice
> > it.
>
> Note that if the list was generated
In article ,
Ian Kelly wrote:
> On Mon, Oct 29, 2012 at 5:24 PM, Roy Smith wrote:
> > I think you're missing the point of "amortized constant time". Yes, the
> > first item appended to the list will be copied lg(20,000,000) ~= 25
> > times, because the
In article <50932111$0$29967$c3e8da3$54964...@news.astraweb.com>,
Steven D'Aprano wrote:
> Huh. If you're messing about with ancient[1] languages like Java, C# and
> especially C, you're not a real programmer. Real programmers use modern,
> advanced languages like D, Erlang, Go or Haskell.
D
In article ,
Andriy Kornatskyy wrote:
> 'Z05738521581'
> 'Z17888279480'
> 'Z07395350007'
>
> Short, human readable and satisfy original requirements.
>
> Andriy
If you really want human readable, it's better to chunk the data up into
3 or 4 digit groups. So, instead of Z05738521581, maybe
In article <50959154$0$6880$e4fe5...@news2.news.xs4all.nl>,
Hans Mulder wrote:
> That's a matter of perspective: in my book, the primary advantage of
> working with interned strings is that I can use 'is' rather than '=='
> to test for equality if I know my strings are interned. The space
> sav
In article <5096202c$0$29967$c3e8da3$54964...@news.astraweb.com>,
Steven D'Aprano wrote:
> On Sat, 03 Nov 2012 22:19:19 -0700, Aahz wrote:
>
> > In article <509441cb$0$29967$c3e8da3$54964...@news.astraweb.com>, Steven
> > D'Aprano wrote:
> >>On Fri, 02 Nov 2012 04:20:20 -0700, Jason Benjamin
Environment:
Python-2.7.3
Ubuntu Precise
mongoengine 0.6.20
I have a class which includes a __unicode__() method:
class User(mongoengine.Document):
def __unicode__(self):
return self.username
If I create an instance of this class by calling the constructor
directly, self.usern
In article ,
Roy Smith wrote:
> >>> print u.__unicode__()
> None
>
> >>> print unicode(u)
> Traceback (most recent call last):
> File "", line 1, in
> TypeError: coercing to Unicode: need string or buffer, NoneType found
>
> What
In article ,
Chris Angelico wrote:
> It's nothing to do with operating system. File names are names, and
> spaces in them are seldom worth the hassle unless you manipulate those
> files solely using a GUI.
That's a very ascii-esqe attitude. In a fully unicode world, I could
easily see using U
In article <50989a16$0$29980$c3e8da3$54964...@news.astraweb.com>,
Steven D'Aprano wrote:
> Shell do not [quote strings, etc] because they
> are designed for lazy users and merely aim to be "good enough".
Well, sort of. Or, perhaps more correctly, "Yes, but that's a good
thing".
Shells are d
In article <5099ec1d$0$21759$c3e8da3$76491...@news.astraweb.com>,
Steven D'Aprano wrote:
> On Wed, 07 Nov 2012 00:23:44 +, MRAB wrote:
>
> >> Incorrect. Python uses what is commonly known as call-by-object, not
> >> call-by-value or call-by-reference. Passing the list by value would
> >>
In article ,
Gregory Ewing wrote:
> Steven D'Aprano wrote:
> > The downside is that if spaces are not argument separators, then you need
> > something else to be an argument separator. Or you need argument
> > delimiters. Or strings need to be quoted. Programming languages do these
> > things
In article <509ab0fa$0$6636$9b4e6...@newsspool2.arcor-online.net>,
Alexander Blinne wrote:
> I don't know the best way to find the current size, I only have a
> general remark.
> This solution is not so good if you have to impose a hard limit on the
> resulting file size. You could end up having
In article ,
Demian Brecht wrote:
> On 2012-11-07, at 3:17 PM, Smaran Harihar wrote:
> > Any idea where am I going wrong?
>
> Looks like you're missing a closing parenthesis:
What I find is useful in situations like this is to just let emacs
auto-indent the code. When it starts indenting (o
In article <18134e77-9b02-4aec-afb0-794ed900d...@googlegroups.com>,
bruceg113...@gmail.com wrote:
> Is there a simpler way to modify all arguments in a function before using the
> arguments?
>
> For example, can the below code, in the modify arguments section be made into
> a few statements?
I'm trying to pull down tweets with one of the many twitter APIs. The
particular one I'm using (python-twitter), has a call:
data = api.GetSearch(term="foo", page=page)
The way it works, you start with page=1. It returns a list of tweets.
If the list is empty, there are no more tweets. If t
In article ,
Ian Kelly wrote:
> On Sat, Nov 10, 2012 at 7:13 PM, Chris Angelico wrote:
> > I would not assume that. The origin is a point, just like any other.
> > With a Line class, you could deem a zero-length line to be like a
> > zero-element list, but Point(0,0) is more like the tuple (0,0
In article ,
Peter Otten <__pete...@web.de> wrote:
> deque(
> imap(
> process,
> chain.from_iterable(
> takewhile(bool, imap(partial(api.GetSearch, term), count(1),
> maxlen=0)
>
> ;)
If I wanted STL, I would still be writing C++ :-)
--
http://mail.pyth
In article ,
Mark Lawrence wrote:
> On 12/11/2012 00:31, Oscar Benjamin wrote:
> >
> > Plain wrong. Vectors are not defined *from any origin*.
> >
>
> So when the Captain says "full speed ahead, steer 245 degrees", you
> haven't the faintest idea where you're going, because you have no origin?
In article ,
Oscar Benjamin wrote:
> But then I'm assuming you meant that 245 degrees was a bearing
> relative to North. Was it supposed to be relative to my current angle?
> Truthfully I wouldn't know what to do without asking the captain a
> couple more questions.
Granted, this requires some
In article <0692e6a2-343c-4eb0-be57-fe5c815ef...@googlegroups.com>,
Richard wrote:
> Hello,
>
> I want to create a URL-safe unique ID for URL's.
> Currently I use:
> url_id = base64.urlsafe_b64encode(url)
>
> >>> base64.urlsafe_b64encode('docs.python.org/library/uuid.html')
> 'ZG9jcy5weXRob24u
In article <1ce88f36-bfc7-4a55-89f8-70d1645d2...@googlegroups.com>,
Richard wrote:
> So the use case - I'm storing webpages on disk and want a quick retrieval
> system based on URL.
> I can't store the files in a single directory because of OS limitations so
> have been using a sub folder str
In article ,
w...@mac.com wrote:
> I need to time the operation of a command-line utility (specifically
> nslookup) from within a python program I'm writing.
Ugh. Why are you doing this? Shelling out to nslookup is an incredibly
slow and clumsy way of doing name translation. What you really
In article ,
William Ray Wing wrote:
> On Nov 13, 2012, at 11:41 PM, Roy Smith wrote:
>
> > In article ,
> > w...@mac.com wrote:
> >
> >> I need to time the operation of a command-line utility (specifically
> >> nslookup) from within a python progr
I wrote:
>> Oh, my. You're using DNS as a replacement for ping? Fair enough. In
>> that case, all you really care about is that you can connect to port 53
>> on the server...
>>
>> s = socket.socket()
>> s.connect(('8.8.8.8', 53))
In article ,
Chris Angelico wrote:
>That assumes that (a) the
201 - 300 of 2530 matches
Mail list logo