global name 'self' is not defined

2006-12-02 Thread Evan
x27;:29.15,'lon':-15.667,'place':'ESTOC'} return estoc Why is it that the first call works fine, but the second tells me 'global name 'self' is not defined'? What I want is to have the dictionary 'estoc' available in my calling scr

Re: global name 'self' is not defined

2006-12-02 Thread Evan
the new one, and no problem. I don't know why it worked with one and not the other when they are identical, but I have what I want now. Thanks for your replies. -Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: global name 'self' is not defined

2006-12-04 Thread Evan
[97]: %run call 8 --- exceptions.NameError Traceback (most recent call last) /home/evan/python/mapping/call.py 2 3 sum=canp.addme(3,5) 4 print sum > 5 estoc=canp.estocStn() 6 pri

Re: global name 'self' is not defined

2006-12-05 Thread Evan
#x27;t found an explanation for it so far? Also, as I understand , the .pyc files should be updated every time you change and run the equivalent .py file? Thanks, Evan -- http://mail.python.org/mailman/listinfo/python-list

remove matching pairs

2006-12-14 Thread Evan
so I want to remove one of each pair. Many thanks, Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: remove matching pairs

2006-12-14 Thread Evan
That's great, thank you, the caveats are no matter! -Evan -- http://mail.python.org/mailman/listinfo/python-list

first and last index as in matlab

2006-12-17 Thread Evan
= [3,5,7,2,4,7,8,24] In [691]: ind[0]Out[691]: 3 In [692]: ind[-1:] Out[692]: [24] In [693]: ?? How do I pull out multiple indices as in matlab? Thanks, Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: first and last index as in matlab

2006-12-18 Thread Evan
Thanks for all the replies, it's much clearer now. -Evan -- http://mail.python.org/mailman/listinfo/python-list

What is the difference about "pycap" and "pylibpcap"?

2007-07-29 Thread Evan
Hi, I'm a new hire with python program, I want to write script for changing/moniter/filter the network packet, it seems there are two extensions in python, pycap and pylibcap. I was confused, what is the difference about pycap and pylibpcap? Differnet user interface only? Thanks, -- http://mai

Where can I get a complete user interface about pylibpcap?

2007-07-30 Thread Evan
A web-link would do, becuase of I don't know how many parameters I need to use in function about pylibpcap. Or what kind of parameters I need to use/transfer? I'm very gratefully if you can help on this question. Thanks, -- http://mail.python.org/mailman/listinfo/python-list

How can I work on VIM for python code such as cscope for C code?

2007-09-12 Thread Evan
Hi, guys ~~ How can i work on VIM for python code? I use cscope plugin on VIM for C code before, it helps me to different function and search C variable where it is defined. I'm now starting to learn python, and I'd like to know how works on VIM. I saw that the VIM is support python such as sy

problem with quote and single-quote when using "subprocess"

2008-11-03 Thread Evan
(["goest",'-f \'\"%s %s\" name addr\' ', 'file_name'], shell=True) It always failed. I also try like so: p = subprocess.Popen(["goest","-f '\"%s %s\" name addr' ", 'file_name'], shell=True) It

problem with single-quote and double-quote when using subprocess.

2008-11-03 Thread Evan
(["goest",'-f \'\"%s %s\" name addr\' ', 'file_name'], shell=True) It always failed. I also try like so: p = subprocess.Popen(["goest","-f '\"%s %s\" name addr' ", 'file_name'], shell=True) It

how to convert from network to host byte order

2009-03-05 Thread Evan
.bin','w+b') >>> e.write(socket.ntohs(struct.unpack('H',st[:2])[0])) Traceback (most recent call last): File "", line 1, in TypeError: argument 1 must be string or read-only buffer, not int + It failed due to the parameter is 'int', not 'str' in write function. but how can i do that? Thanks, Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: how to convert from network to host byte order

2009-03-05 Thread Evan
On Mar 5, 9:50 pm, Philipp Hagemeister wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA512 > > Evan wrote: > >>> inp='\x04\x00' > >>> out = socket.ntohs(struct.unpack('H',inp[:2])[0])) > > Traceback (most recent call last)

how to handle/generate pcap file

2009-04-01 Thread Evan
ckets to a pcap file? such as *.pcap. The problem is I do not want to send these packets, I just want to generate some special packets and then store it in a pcap file (libpcap format), so other guys can check it by tcpdump or wireshark. Thanks, Evan -- http://mail.python.org/mailman/listinfo/p

Re: how to handle/generate pcap file

2009-04-01 Thread Evan
On Apr 2, 6:59 am, "Rhodri James" wrote: > On Wed, 01 Apr 2009 14:53:34 +0100, Evan wrote: > > > Hello - > > > I'm trying to decode thepcapfilewhich is packet capture by tcpdump > > or wireshark.   Is there a python module that I can use it for this >

[SMTPLIB] how to send a "Multiline" mail with smtplib?

2008-06-19 Thread Evan
Hello - I'm new with Python, I try to do a mail problem, the code likes below: + import smtplib import mimetypes from email.Encoders import encode_base64 from email.MIMEAudio import MIMEAudio from email.MIMEBase import MIMEBase from ema

Re: how to send a "Multiline" mail with smtplib?

2008-06-23 Thread Evan
se HTML tag "", it worked: (1) HTML: I use tag "" and " ", and when I reply that mail, I will see "" tag in mail content, it is not a good option. thanks, Evan -- http://mail.python.org/mailman/listinfo/python-list

what is meaning of "@" in pyhon program.

2008-06-27 Thread Evan
HI, When I check example of "cmd2" module (a enhancement of cmd module), I can not understand all, for example: the character "@", + def options(option_list): .. class cmd(...): ... @opt

Re: what is meaning of "@" in pyhon program.

2008-06-27 Thread Evan
cool, thanks, I will check document. -- http://mail.python.org/mailman/listinfo/python-list

Is there a good way to implement file updating? such as lock, update, reload...

2008-07-07 Thread Evan
Hello - My script use a DB file which is written by XML, and the user load this DB file (XML tree in memory), and then do some updating about this tree, such as delete element, generate new element or move element. The thing is, my script is a cmd based program (based on module "cmd"), and there

Re: Is there a good way to implement file updating? such as lock, update, reload...

2008-07-07 Thread Evan
If I get rid of the XML, I have to change my script more and more, it is not easy to do that. :( :( Thanks, -- http://mail.python.org/mailman/listinfo/python-list

Is it possible to create "network conneciton" on windows system?

2008-07-14 Thread Evan
t? which means I do not want to use Window UI (via "control panel"), if it is possible, I can save so many time to create various network connection when I want to do testing in the lab. Thanks very much. Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: Is it possible to create "network conneciton" on windows system?

2008-07-14 Thread Evan
On Jul 15, 6:22 am, Larry Bates <[EMAIL PROTECTED]> wrote: > Evan wrote: > > Hello, > > > one of my PC is window system, and in "control panel ->Network > >Connections", I can see somenetworkconnectionssuch as PPPOE or VPN > > which I created by c

a question about mysqldb

2008-08-14 Thread Evan
a simple problem but I do not know why...:(, could anyone help me? MySQLdb nominally uses just the %s placeholder style, in my script, i got error if you want to use placeholder(%s) for table name: + >>> str="select tID,tNote from %s wher

How to make a "command line basd" interactive program?

2008-04-11 Thread Evan
er a prompt, for example, " - >> ", and then you can execute any commands what you defined in script. Now, in python, are there any common way(class) to finish this work? or does anybody has a example to do that? Thanks, Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: How to make a "command line basd" interactive program?

2008-04-14 Thread Evan
that's great, a custom shell is what I need. Thanks all Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: Is python a interpreted or compiled language?

2012-06-20 Thread Evan Driscoll
retically this isn't necessary) - pure compiled I'd say these categories tend to be qualitative "I know it when I see it" rather than hard divisions. Evan > > java has available a "runtime" environment, for those who don't want or > need the compil

Re: Þ how can I implement "cd" like shell in Python?

2012-06-28 Thread Evan Driscoll
ight thing to the new-directory script, e.g. that it works with whitespace in the arguments and that it isn't including the equivalent to argv[0] in the script. Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: code review

2012-06-30 Thread Evan Driscoll
< is not associative and "a < b < c" is a syntax error. (FWIW this is my favorite approach.) You may also want to put Java in there as well, as < is effectively not commutative in that language. (I didn't try C#.) I've been programming in Python for a few year

Re: code review

2012-06-30 Thread Evan Driscoll
On 6/30/2012 23:45, Evan Driscoll wrote: > You may also > want to put Java in there as well, as < is effectively not commutative > in that language. (I didn't try C#.) I guess you could actually put Lua and Ruby into the roughly same category as Java too. But things get a

Re: Re: code review

2012-07-01 Thread Evan Driscoll
On 7/1/2012 4:54, Alister wrote: > On Sat, 30 Jun 2012 23:45:25 -0500, Evan Driscoll wrote: >> If I had seen that in a program, I'd have assumed it was a bug. > > You would? > I have only been using python for 6 - 12 months but in my past I > programmed microcontrollers

Re: 2 + 2 = 5

2012-07-04 Thread Evan Driscoll
the values of literals by passing them to a function by reference and then modifying the value. Evan signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: 2 + 2 = 5

2012-07-05 Thread Evan Driscoll
On 01/-10/-28163 01:59 PM, Alexander Blinne wrote: 5+0 is actually 4+0, because 5 == 4, so 5+0 gives 4. 5+1 is actually 4+1, which is 5, but 5 is again 4. 5+2 is 4+2 which is 6. Now all I can think is "Hoory for new math, new-hoo-hoo math" :-) Evan -- http://mail.python.org/mailma

Re: Re: Gender, Representativeness and Reputation in StackOverflow

2012-07-23 Thread Evan Driscoll
valuable free data from freely donated time. Leaving aside questions of relevance to the email list and the quality of results from a self-selected survey, the PDF is linked directly from the Google Scholar link in the original post: "[PDF] from tue.nl". Evan -- http://mail.

Re: Re: Objects in Python

2012-08-22 Thread Evan Driscoll
aught up in categorizing everything into "strong" and "weak"; that's a spectrum, and where things fall is a lot more interesting than just "here or there". Really it's even more complex than just a linear spectrum -- Language A can be stronger than Language B in one respect but weaker in another. In particular, it's possible to have rather stronger typing than Python (especially with respect to Booleans, but in some other respects as well). Evan signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: Objects in Python

2012-08-22 Thread Evan Driscoll
On 08/22/2012 02:45 PM, lipska the kat wrote: > On 22/08/12 20:03, Evan Driscoll wrote: >> Second, this concept isn't *so* unfamiliar to you. If I give you the >> following Java code: >> >>void foo(Object o) { ... } >> > looking at this method decla

Re: Re: Objects in Python

2012-08-22 Thread Evan Driscoll
ill call their bindings "variables", e.g. Scheme. Evan signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: Objects in Python

2012-08-23 Thread Evan Driscoll
le Java programming so can't point to any concrete cases if you would (reasonably) reject the example of java.util.collections being used in their non-generic form.) Anyway, the point wasn't that 'foo(Object o)' is common, just that you've probably seen something whi

Re: Objects in Python

2012-08-23 Thread Evan Driscoll
ing "Python doesn't have variables" is, IMO, at least as silly as what Jussi said. To me, dancing around the issue just leads to more confusing terminology and makes things worse. (And this is reinforced by the fact that neither I nor Google seems to have really seen "Python doesn't have classes" ever used, when that statement is at least as true as "Python doesn't have variables".) Evan signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Variables vs names [was: Objects in Python]

2012-08-23 Thread Evan Driscoll
On 08/23/2012 12:56 PM, Steven D'Aprano wrote: > On Thu, 23 Aug 2012 12:17:03 -0500, Evan Driscoll wrote: > >> I definitely *wouldn't* say "Python >> classes aren't really classes" -- even though (I assert) Python classes >> are *far* further

Re: Re: Objects in Python

2012-08-24 Thread Evan Driscoll
t this way. If C removed the & operator -- and thus you couldn't tell what address a variable (or "variable instance", if you prefer) was at -- would "int x;" cease to be a variable? Evan signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: Objects in Python

2012-08-25 Thread Evan Driscoll
y think of variables as naming data, and addresses mostly come into play when thinking about points-to and aliasing information at a more abstract level, much the same as I do in Python. Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: Objects in Python

2012-08-25 Thread Evan Driscoll
ive ranges would wind up in memory.) 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 code that on a variable access looks up the value by accessing that dict using the name of the variable. Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: Algorithms using Python?

2012-09-21 Thread Evan Driscoll
. (I didn't actually look.) > You can probably implement them, but they're not going to be very > efficient. (And never "remove" an element from the linked-list > implementation because Python would shift all the other elements, hence > your "links&q

Re: Re: + in regular expression

2012-10-04 Thread Evan Driscoll
ssive quantifier which Python doesn't support. But that still doesn't explain why my expectation isn't what happened.) In what way is that an unreasonable question? Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: + in regular expression

2012-10-05 Thread Evan Driscoll
a lie in most real-world regex implementations (in part because they're not actually regular expressions) and repeated quantifiers cause problems with the parsing techniques that actually get used? Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: + in regular expression

2012-10-05 Thread Evan Driscoll
On 10/05/2012 10:27 AM, Evan Driscoll wrote: On 10/05/2012 04:23 AM, Duncan Booth wrote: A regular expression element may be followed by a quantifier. Quantifiers are '*', '+', '?', '{n}', '{n,m}' (and lazy quantifiers '*?', '+?&

Re: Re: Providing a Python wrapper to a C++ type.

2012-10-16 Thread Evan Driscoll
#x27;t do it for speed, I did it because it seemed like a reasonable way to get access to those APIs. (ctypes was insufficient for my needs.) So wrapping a C++ class using Cython also seems pretty natural to me, assuming that Cython does OK with C++ and isn't restricted to C (which I have no idea ab

Re: A desperate lunge for on-topic-ness

2012-10-18 Thread Evan Driscoll
se; for mine, I'd say I'm trying to keep subexpressions together in space (both horizontal and vertical). I'm not sure that "drawing boxes" is exactly the right thing to say what I'm doing, but I think it at least serves to illustrate my point in this case. Evan signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: The pty module, reading from a pty, and Python 2/3

2012-10-23 Thread Evan Driscoll
Oh, and a little more information: The log.txt file I create has the message that it's "about to execlp", and the exec() *does* actually happen -- the IOError is raised after the child process quits. Evan On 10/23/2012 09:59 PM, Evan Driscoll wrote: I have the fo

The pty module, reading from a pty, and Python 2/3

2012-10-23 Thread Evan Driscoll
s I've mostly only worked with 2.) I'm not 100% sure how this will come through, so I've also put it at http://pastebin.com/60wjXSF3. Evan import sys import pty import os def get_text(filename): try: ( child_pid, fd ) = pty.fork()# OK except OSError as e:

Re: The pty module, reading from a pty, and Python 2/3

2012-10-23 Thread Evan Driscoll
rious if anyone know why it worked in 2 though. Evan On 10/23/2012 10:03 PM, Evan Driscoll wrote: Oh, and a little more information: The log.txt file I create has the message that it's "about to execlp", and the exec() *does* actually happen -- the IOError is raised after the c

Re: Re: while expression feature proposal

2012-10-24 Thread Evan Driscoll
? I don't think I like 'from' on a couple counts, but there's probably some word that fits. Evan signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: Simple Python question for some

2012-10-28 Thread Evan Driscoll
le in one rather widely-used one. If you are PerHaPs talking about the language I think you are, my favorite fact about that is I'm that I think a while back I saw a bug entry about something like that and they weren't sure how or even if it should be fixed. Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: Immutability and Python

2012-10-29 Thread Evan Driscoll
rth the hassle and have done the __getattribute__/__setattribute__ thing the couple of times I wanted immutability. Evan signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Managing multiple packages

2012-11-20 Thread Evan Driscoll
n the install directory (which will just be overwritten). Evan signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: 10 sec poll - please reply!

2012-11-20 Thread Evan Driscoll
s a noun, not a verb. What does it do? Tell you if its parameters are keystrokes? (gen_keystrokes is fine, though personally I'd probably stick with generate_keystrokes of the two.) Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: How to get a "screen" length of a multibyte string?

2012-11-25 Thread Evan Driscoll
cute accent.) So far the discussion has been on single Unicode code points which appear as a double-wide glyph (I did not know about those!); depending on how you want to look at it, combining characters result in sequences of Unicode code points which result in a single glyph, or combining characters are zero-width code points. Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: Managing multiple packages

2012-11-26 Thread Evan Driscoll
install to a prefix that doesn't exist, says "you want me to MAKE DIRECTORIES?! what are you, some kind of slave driver?!". Admittedly that second reason is not so rational and very occasionally putting up with that in exchange for development mode is plenty worth it, but being a

Re: Re: re.search when used within an if/else fails

2012-11-28 Thread Evan Driscoll
e second level with tabs (consistently), indent from the second to third level with spaces (consistently), and indent from the third to fourth level with tabs (consistently), it should not complain. Or perhaps I should say "it should complain that you're a bad person and should feel ba

Re: Re: Iterating over files of a huge directory

2012-12-17 Thread Evan Driscoll
record and anyone looking for other posts, I'd guess said discussion was on Python-dev. I don't look at even remotely everything on python-list (there's just too much), but I do skim most subject lines and I haven't noticed any discussion on it before now.) Evan signature.a

Re: Iterating over files of a huge directory

2012-12-17 Thread Evan Driscoll
On 12/17/2012 01:50 PM, Oscar Benjamin wrote: > On 17 December 2012 18:40, Evan Driscoll wrote: >> On 12/17/2012 09:52 AM, Oscar Benjamin wrote: >>> https://github.com/benhoyt/betterwalk >> >> This is very useful to know about; thanks. >> >> I actually

Re: Re: Python lists

2012-12-30 Thread Evan Driscoll
it(l2[0], ", ") Um, that doesn't copy the list: >>> l = ["C100, C117", "X7R ..."] >>> l2 = l >>> import string >>> l2[0] = string.split(l2[0], ", ") >>> l [['C100', 'C117'], 'X7R ...

Re: wiki.python.org

2013-01-09 Thread Evan Driscoll
t about the best domain name ever) and it says it's down too. Evan signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Beginner Tutorials

2013-01-18 Thread Evan Driscoll
climbing is very different from why I continued it. And I feel that the same could be said of programming. Just because you don't enjoy parts of programming when you're starting out doesn't mean that you're a lost cause by ANY means. Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: Arent these snippets equivalent?

2013-01-23 Thread Evan Driscoll
will set data again, while the lower one will not. So if what you mean is "are they equivalent no matter what legal Python code you put in the ...", no, they aren't. Evan signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: while True or while 1

2012-01-23 Thread Evan Driscoll
off, I'd hate to see what you do when you learn that Python accepts loops like 'while x' where the condition evaluates to true if x is a non-zero integer and false if x is 0. All that said, I like the 'while "stuff to do"' idea. Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-23 Thread Evan Driscoll
On 1/23/2012 23:57, Rick Johnson wrote: > Of > course, "used to" and "supposed to" will require people to rethink > there lazy and slothful ways. I'll go repent in the corner, over their. signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Where to put data

2012-01-25 Thread Evan Driscoll
I would just like to make a strong plea that you make it possible to install in places other than /usr. Bascially, 'python setup.py install --prefix /some/alternative/place' should work. Evan On 01/25/2012 11:26 AM, bvdp wrote: I'm having a disagreement with a buddy on the

Re: PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Evan Driscoll
: "About as good of an idea as no longer calling PCRE-alikes 'regular expressions', because they aren't." Ahhh, got that out of my system. :-)) Evan signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: copy on write

2012-02-02 Thread Evan Driscoll
On 01/-10/-28163 01:59 PM, 8 Dihedral wrote: If you're working in C++ and overload your operators so that 'a +=' and 'a = + b' have different observable behaviors (besides perhaps time), then either your implementation is buggy or your design is very bad-mannered

frozendict

2012-02-08 Thread Evan Driscoll
which is why it's not already provided. Does anyone know why Python doesn't already come with a frozendict, or why there seem to only be a couple attempts to write one? Evan signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: frozendict

2012-02-08 Thread Evan Driscoll
uiltin, per se. I know how to spell 'import'. :-) Evan signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: frozendict

2012-02-08 Thread Evan Driscoll
d that takes a bunch of functions. I didn't know about the ABTs in 'collections' though, so that helps a bit. However, I'd still prefer something that guaranteed immutability better than that. I might just be fighting the language too much at that point though... Evan

Re: Re: lang comparison: in-place algorithm for reversing a list in Perl, Python, Lisp

2012-02-29 Thread Evan Driscoll
mporary list, which is why this idiom would even fit in pretty well in Scheme. Evan signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: RE: What's the best way to write this regular expression?

2012-03-07 Thread Evan Driscoll
ialog for a "extract .tar.gz files in one go" setting.) Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: Programming D. E. Knuth in Python with the Deterministic Finite Automaton construct

2012-03-17 Thread Evan Driscoll
rk label .A4 # do something if : goto .A1 label .A5 # something more if : goto .A2 Clearly the best solution of all. (Note: do not actually do this.) Evan signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: Python is readable

2012-03-21 Thread Evan Driscoll
27;stack' while #1/2 won't, but even that isn't true of course. For instance, CLOS will let you write '(push stack item)' (which is the direct analogy in that language to #1) and do even more powerful dynamic dispatch than what a language like C++, Java, or Python will let you

Re: RE: Advise of programming one of my first programs

2012-03-27 Thread Evan Driscoll
ever unpickle data received from an untrusted or unauthenticated source. - http://docs.python.org/library/pickle.html Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: "convert" string to bytes without changing data (encoding)

2012-03-28 Thread Evan Driscoll
not a mapping of strings to internal representation is silly, because there is. However, there's nothing you can say about that mapping. Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: Re: "convert" string to bytes without changing data (encoding)

2012-03-28 Thread Evan Driscoll
On 3/28/2012 14:43, Ross Ridge wrote: > Evan Driscoll wrote: >> So yes, you can say that pretending there's not a mapping of strings to >> internal representation is silly, because there is. However, there's >> nothing you can say about that mapping. > >

Re: Re: Re: Re: "convert" string to bytes without changing data (encoding)

2012-03-29 Thread Evan Driscoll
On 01/-10/-28163 01:59 PM, Ross Ridge wrote: Evan Driscoll wrote: People like you -- who write to assumptions which are not even remotely guaranteed by the spec -- are part of the reason software sucks. ... This email is a bit harsher than it deserves -- but I feel not by much. I don'

Re: Re: string interpolation for python

2012-04-02 Thread Evan Driscoll
t;eval from *this dictionary* if you want, which solves Steven D'Aprano's objection that your suggestion is too weak. 4. Languages changes should be viewed suspiciously in general. Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: No os.copy()? Why not?

2012-04-03 Thread Evan Driscoll
oblems with all the other suggestions. Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: Python Gotcha's?

2012-04-05 Thread Evan Driscoll
unorderable: >>> 0 < True True I think it also has bearing on the ' vs " issue. For instance, I totally think it's not at all surprising that one can be accepted and the other not, or that they behave differently. (Though I *do* find it surprising in the c

Re: Re: Re: Python Gotcha's?

2012-04-05 Thread Evan Driscoll
eally work with Python because more stuff is immutable, and Python's behavior is arguably the least-bad solution, but it WAS definitely surprising for me (and others!) when I learned about Python's behavior. In particular, the translation of 'a+=b' to 'temp = a + b; a = te

Re: Python Gotcha's?

2012-04-05 Thread Evan Driscoll
On 4/5/2012 17:11, Evan Driscoll wrote: > In particular, the translation of 'a+=b' to 'temp = a + b; a = temp' is > *not* a very natural one to me. To expand on this point slightly, because of common C++ idioms guided by efficiency, I would be much more likely to thi

Python one-liner?

2012-04-13 Thread Evan Driscoll
rehension or itertools expression or something. At this point I'm asking mostly out of curiosity and less for some code to actually use, so either Python 2 or 3 is acceptable (but I'm writing in 3 at the moment). Evan signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Python one-liner?

2012-04-13 Thread Evan Driscoll
On 4/13/2012 22:33, Evan Driscoll wrote: > d = {} > def appender(e): > d.get(f(e), []).append(e) > map(appender, l) Just in case it isn't clear, the above has at least two problems and won't even come close to working. :-) Though I might as well ask an

Re: Python one-liner?

2012-04-13 Thread Evan Driscoll
On 4/13/2012 22:42, Evan Driscoll wrote: > Though I might as well ask another question... if I have a dict with > values which are lists, what's a good way to say "append x to the list > at key k, creating a list if it's not there"? dict.setdefault seems > potent

Re: Re: How do you refer to an iterator in docs?

2012-04-20 Thread Evan Driscoll
r dismissed it.) Personally though, I'd probably say an iterator *to* Foos. Evan signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Evan Driscoll
vior (in the technical C++ sense of "your program is now allowed to set your cat on fire"). Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: using identifiers before they are defined

2012-06-12 Thread Evan Driscoll
llustrate, in a different manner that doesn't use this "undefined" thing: def foo(): print "Inside the first version of foo" def call_foo(): foo() call_foo() def foo(): print "Inside the second version of foo" call_foo() This prints: Inside t

Re: Mutating an HTML file with BeautifulSoup

2022-08-21 Thread Buck Evan
I've had much success doing round trips through the lxml.html parser. https://lxml.de/lxmlhtml.html I ditched bs for lxml long ago and never regretted it. If you find that you have a bunch of invalid html that lxml inadvertently "fixes", I would recommend adding a stutter-step to your project: p

Re: New Python implementation

2021-02-15 Thread Buck Evan
On Thu, Feb 11, 2021 at 1:49 PM dn via Python-list wrote: > When I first met it, one of the concepts I found difficult to 'wrap my > head around' was the idea that "open software" allowed folk to fork the > original work and 'do their own thing'. My thinking was (probably) > "surely, the original

Explicit vararg values

2018-09-17 Thread Buck Evan
I started to send this to python-ideas, but I'm having second thoughts. Does tihs have merit? --- I stumble on this a lot, and I see it in many python libraries: def f(*args, **kwargs): ... f(*[list comprehension]) f(**mydict) It always seems a shame to carefully build up an object in order

Re: Explicit vararg values

2018-09-22 Thread Buck Evan
Received? On Sun, Sep 16, 2018 at 3:39 PM Buck Evan wrote: > I started to send this to python-ideas, but I'm having second thoughts. > Does tihs have merit? > > --- > I stumble on this a lot, and I see it in many python libraries: > > def f(*args, **kwargs): > .

Binary Sort on Python List __xor__

2020-05-30 Thread evan . schalton
I frequently use binary as bool placeholders and find myself filtering lists based on those bools, this seems to have a similar semantic meaning as the bit wise ^ or __xor__ operator and could add syntactic sugar to the base list class. Use Case: Controlling a stepper at half-step has the follo

  1   2   3   >