On 09.09.2015 19:55, Steven D'Aprano wrote:
On Wed, 9 Sep 2015 11:09 am, Mario Figueiredo wrote:
You know, it is a pointless exercise to try and downplay programming
languages (any programming language) that has proven its worth by being
generally adopted by the programming community. Adoption
On 09.09.2015 21:00, Chris Angelico wrote:
Suppose it's possible, somehow, to design the perfect language. (It
isn't, because the best language for a job depends on the job, but
suppose it for the nonce.) It is simultaneously more readable than
Python, more ugly than Perl, more functional than Ha
http://stackoverflow.com/questions/2356399/tell-if-python-is-in-interactive-mode
On 10.09.2015 19:54, Steven D'Aprano wrote:
I have a function which is intended for use at the interactive interpreter,
but may sometimes be used non-interactively. I wish to change it's output
depending on the con
is the reason for this special behavior?
On 10.09.2015 20:03, Sven R. Kunze wrote:
http://stackoverflow.com/questions/2356399/tell-if-python-is-in-interactive-mode
On 10.09.2015 19:54, Steven D'Aprano wrote:
I have a function which is intended for use at the interactive
interpreter,
bu
On 10.09.2015 20:12, Ben Finney wrote:
First thing in the morning I will purchase a head of cabbage and store
it in a warm place to make it rot, on the off chance you find some
obscure way to achieve your benighted goal, just so I can be first in
line to throw it as you pass.
Well, go ahead. An
On 10.09.2015 20:14, Ben Finney wrote:
"Sven R. Kunze" writes:
http://stackoverflow.com/questions/2356399/tell-if-python-is-in-interactive-mode
I'm pretty sure Steven knows full well the answer to that question,
which is not anything like the one he asked. Would you care to re
On 10.09.2015 20:34, Sven R. Kunze wrote:
You are right. I turned out to me harder that I first thought.
My initial guess was like: use AST. But now I see, it would be hard to
get the source code.
So, what actually could work, would be faking the interactive
interpreter wrapping it up and
Oops, missing print:
On 10.09.2015 20:45, Sven R. Kunze wrote:
On 10.09.2015 20:34, Sven R. Kunze wrote:
You are right. I turned out to me harder that I first thought.
My initial guess was like: use AST. But now I see, it would be hard
to get the source code.
So, what actually could work
On 16.09.2015 18:16, Marko Rauhamaa wrote:
Chris Angelico :
Far as I can see, the only operator that you might want to disallow
chaining on is 'in' (and its mate 'not in', of course). It isn't
common, but "x is y is z is None" is a perfectly reasonable way to
ascertain whether or not they're al
On 16.09.2015 18:57, Random832 wrote:
I think that chaining should be limited to:
A) all operators are "="
B) all operators are "is"
C) all operators are either >= or >
D) all operators are either <= or <
That certainly would be a fine guideline. Only use it with all operators
the same.
Eve
On 16.09.2015 19:33, Steven D'Aprano wrote:
On Thu, 17 Sep 2015 01:40 am, Random832 wrote:
"in" suggests a relationship between objects of different types (X and
"something that can contain X") - all the other comparison operators are
meant to work on objects of the same or similar types.
`is`
On 16.09.2015 19:36, Random832 wrote:
I just had another thought on *why* the other cases make me so uneasy.
The reason this is reasonable for simple cases like a > b > c or a < b
<= c is that, in their normal meanings, these operations are transitive.
a > b and b > c implies a > c. a < b and b
On 16.09.2015 19:39, Steven D'Aprano wrote:
node = left <= ptr => right
Wow. I have absolutely no idea what this is supposed to mean. Do you
care to elaborate?
Best,
Sven
--
https://mail.python.org/mailman/listinfo/python-list
On 16.09.2015 19:46, Grant Edwards wrote:
On 2015-09-16, Steven D'Aprano wrote:
node = left <= ptr => right
Exactly. I've no clue what that means. ;)
Modern art. ;)
Best,
Sven
--
https://mail.python.org/mailman/listinfo/python-list
On 16.09.2015 22:55, Random832 wrote:
On Wed, Sep 16, 2015, at 16:38, Mark Lawrence wrote:
On 16/09/2015 18:41, Sven R. Kunze wrote:
On 16.09.2015 19:33, Steven D'Aprano wrote:
And with operator overloading, < <= > and => could have any meaning you
like:
graph = a =&
On 16.09.2015 21:47, Grant Edwards wrote:
On 2015-09-16, Sven R. Kunze wrote:
On 16.09.2015 19:46, Grant Edwards wrote:
On 2015-09-16, Steven D'Aprano wrote:
node = left <= ptr => right
Exactly. I've no clue what that means. ;)
Modern art. ;)
Ah, well I know that _tha
On 16.09.2015 23:30, Mark Lawrence wrote:
Barry John art is also art. So, why does Python not have Barry John
art to define graphs and diagrams?
Too colorful for a grammer?
--
https://mail.python.org/mailman/listinfo/python-list
On 17.09.2015 08:39, Gregory Ewing wrote:
Sven R. Kunze wrote:
Btw. ASCII art is also art. So, why does Python not have ASCII art to
define graphs and diagrams?
Nowadays it would have to support Unicode art. Mustn't
leave out all the world's non-English-speaking artists!
How
Well, I would be interested in seeing such a module as well.
Most modules and frameworks, I know, providing REST and interacting with
REST are more like traditional SOAP-like web services. You got your
functions which have a 1-to-1 correspondence with some resource URLs and
that's it.
Actual
On 17.09.2015 23:38, Marko Rauhamaa wrote:
Random832 :
It being *easier to implement* to have comparison operators be a
single class and have chaining apply equally to all of them may be an
excuse for the language to allow it, but it's certainly not an excuse
for *actually* using it from a stan
On 17.09.2015 23:26, Tim Chase wrote:
On 2015-09-17 22:46, Sven R. Kunze wrote:
Btw. ASCII art is also art. So, why does Python not have ASCII
art to define graphs and diagrams?
Nowadays it would have to support Unicode art. Mustn't
leave out all the world's non-English-speaking art
On 18.09.2015 17:28, Joseph L. Casale wrote:
So a design pattern I use often is to create Python objects to represent
objects returned from what ever api I am abstracting. For example I
might create named tuples for static data I dont intend to change or
for an object I can both query for and cre
Hi Joseph,
the basic wiring instances together is done via the assignment operator:
"=". Like: queue._api = foo. Now, the "queue" knows about its API instance.
Question now is, when do you do "="?
On 18.09.2015 23:43, Joseph L. Casale wrote:
This is where I am going, but how do you perform d
Hmm, why not. :D
On 22.09.2015 20:43, Python_Teacher via Python-list wrote:
you have 10 minutes😂 Good luck!!
1. What is PEP8 ?
A PEP.
2. What are the different ways to distribute some python source code ?
unison, rsync, scp, ftp, sftp, samba, http, https, mail, git,
2 Lists
Let's
On Fri, 15 Feb 2013 22:52:57 -0500, Mitya Sirenef
wrote:
>On 02/15/2013 10:22 PM, eli m wrote:
>> Any small program ideas? I would prefer to stick to command line ones.
>> Thanks.
>
>How about these two:
>
> - simulation of a street crossing with green/red lights allowing cars
>and pedestrians
On Fri, 15 Feb 2013 19:57:35 -0800 (PST), eli m
wrote:
>On Friday, February 15, 2013 7:52:57 PM UTC-8, Mitya Sirenef wrote:
>> On 02/15/2013 10:22 PM, eli m wrote:
>>
>> > Any small program ideas? I would prefer to stick to command line ones.
>> > Thanks.
>>
>>
>>
>> How about these two:
>>
It's lexigraphic (order by first letter, but if those are the same,
compare the second, but if those are same compare the third, ... if
one ends while the other continues, it's considered 'lower') on the
character's ASCII (binary encoding values):
http://www.asciitable.com/
Note that all the uppe
his:
> [x[::3] for x in y[1:5:2]]
>
> Best,
> Wolfgang
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
---
Wim R. Cardoen, PhD
Staff Scientist,
Center for High Performance Computing
University of Utah
(801)971-4184
*μὴ μου τοὺς κύκλους τάραττε! (Ἀρχιμήδης)*
---
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Apr 23, 2013 at 6:36 PM, Peng Yu wrote:
> Hi,
>
> I'm wondering if it possible to use pandoc instead of rst to document
> python. Is there a documentation system support this format of python
> document?
Pandoc is a converter while rst is a format so they're not directly
comparable; pando
On Wed, Apr 24, 2013 at 12:14 AM, Peng Yu wrote:
> I currently use sphinx to generate the doc (in rst). How to figure it
> to support pandoc's markdown?
If I understand the desired workflow, it's just 1) write in markdown;
2) then run pandoc to convert to rst; 3) then run Sphinx to render
html or
Tobiah:
>From the standpoint of implementation, I don't see much of a difference
unless you are specifically interested in the more limited functionality
of a module (vs. a class instance). If you aren't, then you can simply
instantiate your borg class and then insert it into sys.modules early in
Assuming your setting the target directory to the overwatch folder, and you are
starting the interactive session in your home directory, this is what is
happening. The folder containing your package must be in the python path, not
the folder itself. Try "PYTHONPATH=/home/directory python test.py
"Iain King" <[EMAIL PROTECTED]> wrote in news:1155827943.041208.51220
@i3g2000cwc.googlegroups.com:
> I'm confused - I thought Xah Lee loved Perl? Now he's bashing it?
> Huh?
That's his other personality.
--
---
Google has a cool new service.
http://www.google.com/codesearch
You can use regular expressions!
(I found at least 13 distinct utilities that used the idiom.)
Nils
--
http://mail.python.org/mailman/listinfo/python-list
TWiki, written in perl, makes extensive use of versioning/diff
functionality you mention through the use of RCS, which, IIRC, is the
basis for CVS. This method eliminates the need for the repository as
such, and merely requires the presence of the RCS files (and RCS).
Unless you _want_ to host
I've been doing some work on a didiwiki-like program written in Python.
Since Python is embedded in browsers, the didwiki approach make sense:
write the server in your language of choice (didwiki uses C), and lay
the necessary (simple) wiki code on top of the server. Roll the entire
thing in
That should have said "Since Python _isn't_ embedded in browsers"!
Rick
R. P. Dillon wrote:
> I've been doing some work on a didiwiki-like program written in Python.
> Since Python is embedded in browsers, the didwiki approach make sense:
> write the server in you
Hello,
I'm writing a C extension for cygwin python to access a vendor supplied DLL
that allows one to set the general purpose IO (gpio) pins of the Silicon
Labs' cp2103 USB/serial chip. We communicate to the device using the
vendor's virtual com port driver, but the gpio pins allow us access t
Hi: am a Newbie and this is my first script:
We were recently burgled and had our computers stolen. Easy to replace,
but the data that was lost is years and years of work. I've
investigated offsite data backup but it seems expensive. In any case,
the data we have is not volumous.
Rather, would like
r package *is* and does, at the top of all such
announcements?
Cheers,
-- jra
--
Jay R. Ashworth[EMAIL PROTECTED]
Designer Baylink RFC 2100
Ashworth & AssociatesThe Things I Think
Atom questions and comments:
[EMAIL PROTECTED]
P.S. Should I publish this to the Cheese Shop?
http://cheeseshop.python.org/
--
Steve R. Hastings"Vita est"
[EMAIL PROTECTED]http://www.blarg.net/~steveha
--
http://mail.python.org/mailman/listinfo/python-list
in the Python core.
I said I intend to donate it to PSF. I didn't say they would do anything
with it... :-) That's up to them, of course.
> Good job :)
Thank you.
--
Steve R. Hastings"Vita est"
[EMAIL PROTECTED]http://www.blarg.net/~steveha
--
http://mail.python.org/mailman/listinfo/python-list
. Now that it's done I
want to share it, but I didn't study PEP 8 very much before I started it.
Thank you for the feedback.
--
Steve R. Hastings"Vita est"
[EMAIL PROTECTED]http://www.blarg.net/~steveha
--
http://mail.python.org/mailman/listinfo/python-list
I have edited PyAtom, and now it should be in better conformance with the
PEP 8 guidelines. It is available from the same place as before:
http://www.blarg.net/~steveha/pyatom.tar.gz
--
Steve R. Hastings"Vita est"
[EMAIL PROTECTED]http://www.blarg.net/~steveha
s a safe way to
create a list of three 0 values.
When you have a list that contains three references to the same mutable,
and you change the mutable, you get the results you discovered.
--
Steve R. Hastings"Vita est"
[EMAIL PROTECTED]http://www.blarg.net/~steveha
--
http://mail.python.org/mailman/listinfo/python-list
I suggest you should build your list using a list comprehension:
>>>a = [[0]*3 for i in range(3)]
>>>a
[[0, 0, 0], [0, 0, 0], [0, 0, 0]]
>>>a[0][1] = 1
[[0, 1, 0], [0, 0, 0], [0, 0, 0]]
--
Steve R. Hastings"Vita est"
[EMAIL PROTECTED]ht
it just to fail there and not let
me raise an exception that isn't subclassed beneath
Exception.
--
Stephen R. Laniel
[EMAIL PROTECTED]
Cell: +(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Jun 15, 2007 at 07:11:56AM -0700, HMS Surprise wrote:
> Could you recommend an html parser that works with python (jython
> 2.2)?
I'm new here, but I believe BeautifulSoup is the canonical
answer:
http://www.crummy.com/software/BeautifulSoup/
--
Stephen R. Laniel
[EMAIL PROT
tima.com/intv/strongweakP.html
--
Stephen R. Laniel
[EMAIL PROTECTED]
Cell: +(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Jun 20, 2007 at 12:59:28PM -0700, [EMAIL PROTECTED] wrote:
> Then you should use another language.
This is what I meant about knowing how Internet discussions
go.
--
Stephen R. Laniel
[EMAIL PROTECTED]
Cell: +(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.
, I reasoned, use this information at compile
time?
Of course I understand the virtue of writing code with good
doctests, etc. But my question is why we can't get some more
static typing as well. Given the tools that'll be in Python
3.0, that doesn't seem unreasonable to ask.
A
it?
--
Stephen R. Laniel
[EMAIL PROTECTED]
Cell: +(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, Jun 21, 2007 at 01:42:03PM +, linuxprog wrote:
> that should work for you ?
I reproduced the original poster's problem by adding one
extra space after the final "'" on each line. I'd vote that
that's the problem.
--
Stephen R. Laniel
[EMAIL PROT
lowup clarified something
that I should have included in the original.
"Use another language" is not a technical answer. "Python
could not adopt static typing without substantially changing
the language and destroying what everyone loves about it,
and here are examples of where the
On Thu, Jun 21, 2007 at 10:11:57AM -0400, Stephen R Laniel wrote:
> "Use another language" is not a technical answer. "Python
> could not adopt static typing without substantially changing
> the language and destroying what everyone loves about it,
> and here are ex
ing inotify. So I guess I answered my own question.
I've not thought about it much, but how about using Twisted?
Something like the LineReceiver class seems appropriate
here.
http://twistedmatrix.com/documents/current/api/twisted.protocols.basic.LineReceiver.html
--
Stephen R. Laniel
[EMAIL
On Sun, Jun 24, 2007 at 02:52:25PM -0500, Zachary Manning wrote:
> I want to send some hex characters as a string literal to port 7142 and
> to a specific ip address. How do I do that in python?
Does this cover what you want to do?
http://docs.python.org/lib/socket-example.html
--
Ste
python.org/lib/os-procinfo.html
--
Stephen R. Laniel
[EMAIL PROTECTED]
Cell: +(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key
--
http://mail.python.org/mailman/listinfo/python-list
# things one does if the user said 'fine'
Alternately, you could just use rfind():
http://docs.python.org/lib/string-methods.html
but regexes are a good tool to get to know. They're overused
(particularly in Perl), but this is just the sort of task
they're good for.
--
Stephen
a
scriptable Python object; I do not.
--
Stephen R. Laniel
[EMAIL PROTECTED]
Cell: +(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key
--
http://mail.python.org/mailman/listinfo/python-list
pect is your friend:
http://docs.python.org/lib/inspect-stack.html
--
Stephen R. Laniel
[EMAIL PROTECTED]
Cell: +(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key
--
http://mail.python.org/mailman/listinfo/python-list
again to Mark-Jason Dominus's
explanation of how strong static typing can be done well:
http://perl.plover.com/yak/typing/notes.html
The example toward the end of how ML actually spots an
infinite loop at compile time seems to me to be "for
programmers" rather than "for compiler
oint
about what static typing is for in general (i.e., not
specific to Python). I thought I'd give examples of how
languages other than Python use it to good effect, and not
just for compiler optimization.
Cheers,
Steve
--
Stephen R. Laniel
[EMAIL PROTECTED]
Cell: +(617) 308-5571
http:/
caller = stack[1][3]
print "I am the slave; my caller was %s" % caller
def main():
master()
if __name__ == '__main__':
main()
--
Stephen R. Laniel
[EMAIL PROTECTED]
Cell: +(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key
--
http://mail.python.org/mailman/listinfo/python-list
x27;t need to be a religious war. Why can't people just
say "When strong typing is done and used well, it's a
useful tool; when it's not, it's not"?
--
Stephen R. Laniel
[EMAIL PROTECTED]
Cell: +(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel
Hello,
I am using the threading module and the Queue module in python to to
send out shipment tracking URL requests.
Is there a way to timeout a thread within a Queue?
I think the way I have it now the thread will wait until something is
returned and will basically wait forever for that somethin
I've decided that Python is a language/environment I'd like to learn
(I've been a professional programmer for 45+ years), but I really don't
know where and how to start! I have a number of books - and am buying
some more - but because of the bewildering number of after-market
packages, envi
Zionist wrote:
> The world have been after Bill Gates for no reason. The richest group
> was and remains the Zionist jew Rothschilds family who own HALF the
> worlds total wealth through numerous frontmen zionists.
>
> google video and youtube have many videos on the family. You can set
> aside par
Zionist wrote:
>> Zionazi obviously tries to shift blame and confuse the picture.
William Hughes wrote:
> One way to recognize a dupe of the Bavarian Illuminati is
> their tendency to characterize everyone as Zionists.
Another way is their tendency to proclaim quite loudly
and emphatically that t
I will be out of the office starting 04/21/2006 and will not return until
04/24/2006.
I will respond to your message when I return.
--
http://mail.python.org/mailman/listinfo/python-list
e a special method __set__
called when an expression is being assigned somewhere; that would make
this trivial.
What is the friendliest and most Pythonic way to write a Pipe class for
iterwrap?
P.S. I have experimented with overloading the | operator to allow this
syntax:
newlist = Pipe(mylist)
d it:
if bool(0) == False:
pass # always executed
Do this:
if not 0:
pass # always executed
if 1:
pass # always executed
To convert a random value into a boolean value, you could use either
"bool()" or you could use "not not":
a = not not 0
b = bool(0)
&
mostly with generator expressions:
any(v for v in seq if v) # true if any v evaluates true
all(v for v in seq if v) # true if *all* v evalute true
Or a better example:
any(is_green(x) for x in lst) # true if any value in list is green
--
Steve R. Hastings"Vita est"
[EMAIL PROTECTED]http://www.blarg.net/~steveha
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 02 May 2006 21:20:48 +0200, Boris Borcic wrote:
> Steve R. Hastings wrote:
>> So, don't test to see if something is equal to True or False:
>>
>> if 0 == False:
>> pass # never executed; False and 0 do not directly compare
>
> of course they
On Tue, 02 May 2006 12:58:14 -0700, Roger Miller wrote:
> Steve R. Hastings wrote:
>
>> a = 0
>> b = 0
>> a is b # always true
>
> Is this guaranteed by the Python specification, or is it an artifact of
> the current implementation?
I believe it's an
love to find them.
If you are using email, then as I said above, your email client should
have an SMTP server filled in already, and you are already using it every
time you send email. So I suggest you use that.
--
Steve R. Hastings"Vita est"
[EMAIL PROTECTED]http://www.blarg.net/~steveha
--
http://mail.python.org/mailman/listinfo/python-list
mp.lang.python; I
called my version of it tally().
d = tally(bool(x) for x in seq)
print d[True] # prints how many true values in seq
print d[False] # prints how many false values in seq
tally() is in my iterwrap.py module, which you can get here:
http://home.blarg.net/~steveha/iterwrap.tar.gz
g
left over is assumed to be the LT.
Now, we have all the data; it's easy enough to rearrange it.
We can convert the XC string into a list of page ranges just by calling
.split(";"), which will split on semicolons. Loop over this list,
printing each time, and there you go.
I'
hain()".
newlist = Chain(mylist, sort, uniq, list)
I did kind of want a way to make a "reusable pipe". If you come up with a
useful chain, it might be nice if you could use it again with convenient
syntax. Maybe like so:
sort_u = [sort, uniq, list]
newlist = Chain(mylist, sort_u)
Thank you very much for making a helpful suggestion!
--
Steve R. Hastings"Vita est"
[EMAIL PROTECTED]http://www.blarg.net/~steveha
--
http://mail.python.org/mailman/listinfo/python-list
he server, part of
what the conversation includes will be to whom you wish to send the email.
Please Google for information on SMTP. You can also start here:
http://en.wikipedia.org/wiki/SMTP
--
Steve R. Hastings"Vita est"
[EMAIL PROTECTED]http://www.blarg.net/~steveha
--
htt
ip()
xc = m.group(3).replace(s_space, s_empty)
s = pat_sc.sub(s_empty, s, 1)
m = pat_lt.search(s)
if m:
lt = m.group(1)
lt = lt.strip()
s = pat_lt_remove.sub(s_empty, s, 1)
tup = (before, title, xc, lt)
lst.append(tup)
for before, title, xc, lt in lst:
On Wed, 03 May 2006 17:51:03 +, Edward Elliott wrote:
> Steve R. Hastings wrote:
>> You could also use a function that counts all different values in a list,
>> reducing the list to a dictionary whose keys are the unique values from
>> the list.
>
> Wouldn'
43:58)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
As you can see, I'm running Python 2.4.3. Make sure you aren't running an
old version of Python, and that cod
I won't say more, since Alex Martelli already pointed out that Google is
doing big things with Python and it seems to scale well for them.
--
Steve R. Hastings"Vita est"
[EMAIL PROTECTED]http://www.blarg.net/~steveha
--
http://mail.python.org/mailman/listinfo/python-list
for fn in filenames:
for line in open(fn):
if line[0] in digits:
ProcessLine(line)
break
--
Steve R. Hastings"Vita est"
[EMAIL PROTECTED]http://www.blarg.net/~steveha
--
http://mail.python.org/mailman/listinfo/python-list
On Dec 15, 1:29 pm, feba wrote:
> 6; can anyone think of anything else to add on to/do with this game?
> With the minr/maxr display, multiplayer, score keeping, and
> automation, I'm just about all of ideas. All I can think of left to
> add is 3 and 4 player modes, or a fork where player 2 can't
roblems of the new io package),
I think the only reason not to move to python3 will be any
dependency one might have on 3rd party packages that haven't
themselves made the switch yet. Of course, that will be a big
issue for some time to come for many people.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
sort of mechanism for a site
to say "I'm not claiming anything about my identity, I'm just
providing you an https channel over which to talk to me
securely".
I fault the designers of https for this oversight.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
.timeit('for res in myset: break', 'myset=range(100)')
> 0.3293300797699
>
> I'd never expect that for-loop assignment is even faster than a
> precreated iter object (the second test)... but I don't think this
> for-looping variable leaking behavior is guaranteed, isn't it?
My guess would be that what's controlling the timing here is
name lookup. Three in the first example, two in the second,
and one in the third.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
7;B' does not yet have any
value in either the local namespace of class A or the global namespace
of the module.
To figure out how to write code like this that does what you want,
you need to understand how Python namespaces work. A search on
'python namespace' should get you goo
M R A Barnett wrote:
> Aaron Brady wrote:
> [snip]
> > However, in my (opined) interpretation, 'list.append(...) is an in-
> > place operation' is a factual error. In-place operations -also-
> > rebind their 'argument' (FLOBW for lack of better words).
ke sense to me to do it that way. It does allow you to use class
variables as default values for instance variables, as long as you are
careful when using mutable objects. But you could argue that it should
behave in a way analogous to local/global. It would be interesting to
see that argument
n the other hand, it is one of the, well,
bugs, that is avoided by the 'format' method in 3.x.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
o.x
> 1000
>
> I notice that the first example's instance doesn't have a __dict__.
> Is the second way the idiom?
The lack of a __dict__ is why you can't set the attribute.
I've occasionally wanted to use instances of object as holders of
arbitrar
to work with binary byte
streams, you want to use the 'bytes' type. Bytes contstants are
written with a leading 'b', so the code snipped above would become
self.out.write(b'BM')
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
str converted over to binary bytes to
> write to bmp file.
(I reformatted your message slightly to make the code block stand out more.)
A byte array is an array of bytes, and it understands integers as input.
Check out the PEP (the official docs leave some things out):
http://www.p
mattia wrote:
> Hi all, can you tell me why the module urllib.request (py3) add extra
> characters (b'fef\r\n and \r\n0\r\n\r\n') in a simple example like the
> following and urllib2 (py2.6) correctly not?
>
> py2.6
> >>> import urllib2
> >>> f
equest
> >>> url = "http://feeds2.feedburner.com/jquery/";
> >>> handler = urllib.request.urlopen(url)
> >>> data = handler.read(1000)
> >>> print("""Content :\n%s \n%s \n%s""" % ('=' * 100, data, '=' * 100))
&
with 46229 bytes ? Or is it something else ?
>
> That's just a bug in urllib in Python 3.0.
What makes you say that's a bug? Did I miss something? (Which is entirely
possible!)
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
mattia wrote:
> Il Tue, 17 Mar 2009 10:55:21 +0000, R. David Murray ha scritto:
>
> > mattia wrote:
> >> Hi all, can you tell me why the module urllib.request (py3) add extra
> >> characters (b'fef\r\n and \r\n0\r\n\r\n') in a simple example like the
>
901 - 1000 of 1188 matches
Mail list logo