On Fri, Nov 9, 2012 at 10:17 AM, danielk wrote:
> I'm converting an application to Python 3. The app works fine on Python 2.
>
> Simply put, this simple one-liner:
>
> print(chr(254))
>
> errors out with:
>
> Traceback (most recent call last):
> File "D:\home\python\tst.py", line 1, in
> pr
On Fri, Nov 9, 2012 at 2:46 PM, danielk wrote:
> D:\home\python>pytest.py
> Traceback (most recent call last):
> File "D:\home\python\pytest.py", line 1, in
> print(chr(253).decode('latin1'))
> AttributeError: 'str' object has no attribute 'decode'
>
> Do I need to import something?
Ramit
On Sat, Nov 10, 2012 at 3:58 PM, Roy Smith wrote:
> 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 twe
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) which
> is definitely True.
It's more
On Sat, Nov 10, 2012 at 7:53 PM, Roy Smith wrote:
> 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 dee
On Sat, Nov 10, 2012 at 11:43 PM, Ian Kelly wrote:
> Where I wrote "(0,0) is the origin" above I was not referring to a
> point, not a tuple, but I can see how that was confusing.
What I meant to say is I *was* referring to a point. Gah!
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, Nov 11, 2012 at 3:24 PM, Cantabile wrote:
> I'd like to do something like that instead of the 'for' loop in __init__:
>
> assert[key for key in required if key in params.keys()]
A list evaluates as true if it is not empty. As long as at least one
of the required parameters is present, th
On Fri, Nov 9, 2012 at 6:36 AM, Steven D'Aprano
wrote:
> (I think... I really don't actually know if Zooey Deschanel can sing or
> not. Just go along with the example.)
Not only does she sing, she's in a band.
http://en.wikipedia.org/wiki/She_%26_Him
I take your point about the "looks like" ter
On Mon, Nov 12, 2012 at 6:00 PM, Cleuson Alves wrote:
> Hello, I need to solve an exercise follows, first calculate the inverse
> matrix and then multiply the first matrix.
> I await help.
> Thank you.
> follows the code below incomplete.
So what is the specific problem with the code that you're
On Mon, Nov 12, 2012 at 8:08 PM, Mark Lawrence wrote:
> http://stackoverflow.com/questions/tagged/python
>
> "Python has two major versions (2 and 3) in use which have significant
> differences."
>
> I believe that this is incorrect. The warts have been removed, but
> significant differences, not
On Tue, Nov 13, 2012 at 3:31 AM, andrea crotti
wrote:
> but it's a bit ugly. I wonder if I can use the subprocess PIPEs to do
> the same thing, is it going to be as fast and work in the same way??
It'll look something like this:
>>> p1 = subprocess.Popen(cmd1, shell=True, stdout=subprocess.PIPE
On Tue, Nov 13, 2012 at 9:07 AM, Ian Kelly wrote:
> It'll look something like this:
>
>>>> p1 = subprocess.Popen(cmd1, shell=True, stdout=subprocess.PIPE,
>>>> stderr=subprocess.PIPE)
>>>> p2 = subprocess.Popen(cmd2, shell=True, stdin=
On Tue, Nov 13, 2012 at 9:25 AM, Ian Kelly wrote:
> Sorry, the example I gave above is wrong. If you're calling
> p1.communicate(), then you need to first remove the p1.stdout pipe
> from the Popen object. Otherwise, the communicate() call will try to
> read data from it and
On Tue, Nov 13, 2012 at 11:05 PM, Kushal Kumaran
wrote:
> Or, you could just change the p1's stderr to an io.BytesIO instance.
> Then call p2.communicate *first*.
This doesn't seem to work.
>>> b = io.BytesIO()
>>> p = subprocess.Popen(["ls", "-l"], stdout=b)
Traceback (most recent call last):
On Thu, Nov 15, 2012 at 12:33 PM, Andriy Kornatskyy
wrote:
>
> A lazy attribute is an attribute that is calculated on demand and only once.
>
> The post below shows how you can use lazy attribute in your Python class:
>
> http://mindref.blogspot.com/2012/11/python-lazy-attribute.html
>
> Comments
On Thu, Nov 15, 2012 at 12:33 PM, Andriy Kornatskyy
wrote:
>
> A lazy attribute is an attribute that is calculated on demand and only once.
>
> The post below shows how you can use lazy attribute in your Python class:
>
> http://mindref.blogspot.com/2012/11/python-lazy-attribute.html
>
> Comments
On Fri, Nov 16, 2012 at 12:28 AM, wrote:
> Can someone explain the below behavior please?
>
re1 = re.compile(r'(?:((?:1000|1010|1020))[ ]*?[\,]?[ ]*?){1,3}')
re.findall(re_obj,'1000,1020,1000')
> ['1000']
re.findall(re_obj,'1000,1020, 1000')
> ['1020', '1000']
Try removing the gro
On Fri, Nov 16, 2012 at 2:44 PM, wrote:
> Latin1 has a block of 32 undefined characters.
These characters are not undefined. 0x80-0x9f are the C1 control
codes in Latin-1, much as 0x00-0x1f are the C0 control codes, and
their Unicode mappings are well defined.
http://tools.ietf.org/html/rfc134
On Fri, Nov 16, 2012 at 4:27 PM, wrote:
> They are indeed undefined: ftp://std.dkuug.dk/JTC1/sc2/wg3/docs/n411.pdf
>
> """ The shaded positions in the code table correspond
> to bit combinations that do not represent graphic
> characters. Their use is outside the scope of
> ISO/IEC 88
On Fri, Nov 16, 2012 at 5:33 PM, Nobody wrote:
> If you need to support either, you can parse it as ISO-8859-1 then
> explicitly convert C1 codes to their Windows-1252 equivalents as a
> post-processing step, e.g. using the .translate() method.
Or just create a custom codec by taking the one in
L
On Fri, Nov 16, 2012 at 6:30 PM, Steven D'Aprano
wrote:
> Does anyone use StandardError in their own code? In Python 2, I normally
> inherit from StandardError rather than Exception. Should I stop and just
> inherit from Exception in both 2 and 3?
According to the docs, StandardError is for built
On Sat, Nov 17, 2012 at 11:08 AM, Ian Kelly wrote:
> On Sat, Nov 17, 2012 at 9:56 AM, wrote:
>> "should" is a wish. The reality is that documents (and especially URLs)
>> exist that can be decoded with latin1, but will backtrace with cp1252. I see
>&
On Sat, Nov 17, 2012 at 9:56 AM, wrote:
> "should" is a wish. The reality is that documents (and especially URLs) exist
> that can be decoded with latin1, but will backtrace with cp1252. I see this
> as a sign that a small refactorization of cp1252 is in order. The proposal is
> to change thos
On Sun, Nov 18, 2012 at 7:42 PM, Mark Lawrence wrote:
> To throw a chiseldriver into the works, IIRC a tuple is way faster to create
> but accessing a list is much faster. The obvious snag is that may have been
> Python 2.7 whereas 3.3 is completely different. Sorry but I'm currently
> wearing m
On Mon, Nov 19, 2012 at 7:30 AM, Roy Smith wrote:
> In article <50a9e5cf$0$21863$c3e8da3$76491...@news.astraweb.com>,
> Steven D'Aprano wrote:
>>
>> By the way, based on the sample data you show, your script is possibly
>> broken. You don't record either the line number that raises, or the
>> ex
On Mon, Nov 19, 2012 at 4:15 PM, Dennis Lee Bieber
wrote:
> On Sun, 18 Nov 2012 17:52:35 -0800 (PST), su29090 <129k...@gmail.com>
> declaimed the following in gmane.comp.python.general:
>
>>
>> I all of the other problems but I have issues with these:
>>
>> 1.Given a positive integer n , assign T
at all, doing this would be a complete waste of the reader's
time.
Skimming through a few more chapters, I don't see anything else that
sets my spidey sense tingling. I hope that what I've written above
gives you some things to consider, though.
Cheers,
Ian
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Nov 20, 2012 at 1:02 AM, Pavel Solin wrote:
> There is an ongoing discussion but we are not sure.
> Are there any reasons except for the print () command
> and division of integers?
The big one is that Python 3 holds the future of Python development.
There are no more feature releases pla
On Tue, Nov 20, 2012 at 10:29 AM, Marco wrote:
> Because when I call an instance the __call__ method is called, and because
> the classes are instances of type, I thought when I call a Foo class this
> imply the call type.__call__(Foo), and so this one manages the Foo.__new__
> and Foo.__init__ ca
On Tue, Nov 20, 2012 at 12:09 PM, Kevin T wrote:
> #if re.search( "rsrvd", sigName ) : #version a
> #if re.search( "rsrvd", sigName ) == None : #version b
> if re.search( "rsrvd", sigName ) is None : #version bb
>print sigName
>newVal = "%s%s" % ('1'*signal['bits'] , newVal )
> #else
On Tue, Nov 20, 2012 at 12:37 PM, Ian Kelly wrote:
> On Tue, Nov 20, 2012 at 12:09 PM, Kevin T wrote:
>> #if re.search( "rsrvd", sigName ) : #version a
>> #if re.search( "rsrvd", sigName ) == None : #version b
>> if re.search( "rsrvd", si
On Tue, Nov 20, 2012 at 7:58 AM, Daniel Klein wrote:
> If you try to expand any of the paths in the Path Browser (by clicking the +
> sign) then it not only closes the Path Browser but it also closes all other
> windows that were opened in IDLE, including the IDLE interpreter itself.
>
> I did a G
On Tue, Nov 20, 2012 at 2:49 PM, Daniel Klein wrote:
> With the assistance of this group I am understanding unicode encoding issues
> much better; especially when handling special characters that are outside of
> the ASCII range. I've got my application working perfectly now :-)
>
> However, I am
On Wed, Nov 21, 2012 at 3:58 PM, Dave Angel wrote:
> Some don't realize that one very powerful use for the .format style of
> working is that it makes localization much more straightforward. With
> the curly brace approach, one can translate the format string into
> another language, and if the p
On Wed, Nov 21, 2012 at 4:21 PM, Joshua Landau
wrote:
> "{}".format() is a blessing an "" % () should go. "%" has no relevance to
> strings, is hard to "get" and has an appalling* syntax. Having two syntaxes
> just makes things less obvious, and the right choice rarer.
>
> str.format is also reall
On Thu, Nov 22, 2012 at 5:24 AM, Colin J. Williams wrote:
> From my reading of the docs, it seems to me that the three following should
> be equivalent:
>
> (a) formattingStr.format(values)
> with
> (b) format(values, formattingStr)
> or
> (c) tupleOfValues.__format__(formattingStr
>
> Examp
On Fri, Nov 23, 2012 at 9:57 AM, Peng Yu wrote:
> Hi,
>
> The empty() returns True even after put() has been called. Why it is
> empty when there some items in it? Could anybody help me understand
> it? Thanks!
>
> ~/linux/test/python/man/library/multiprocessing/Queue/empty$ cat
> main.py
> #!/usr
On Fri, Nov 23, 2012 at 11:46 AM, Roy Smith wrote:
> My command either takes two positional arguments (in which case, both
> are required):
>
> $ command foo bar
>
> or the name of a config file (in which case, the positional arguments
> are forbidden):
>
> $ command --config file
>
> How can I re
On Sat, Nov 24, 2012 at 4:14 AM, Alasdair McAndrew wrote:
> I can resize a 2d image "im" with a command something like:
>
> r,c = shape(im)
> im2 = resize(im,(r//2,c//2))
>
> However, resize doesn't seem to work with an RGB image:
>
> r,c,n = shape(im) # returns, say 500 600 3
>
> I then need to
On Mon, Nov 26, 2012 at 9:56 AM, Nobody wrote:
> In a dynamically-typed language such as Python, the set of acceptable
> types for an argument is determined by the operations which the function
> performs on it. This is in direct contrast to a statically-typed language,
> where the set of acceptab
On Mon, Nov 26, 2012 at 2:58 PM, Dave Angel wrote:
> Not how I would put it. In a statically typed language, the valid types
> are directly implied by the function parameter declarations,
As alluded to in my previous post, not all statically typed languages
require parameter type declarations to
On Wed, Nov 28, 2012 at 12:39 PM, Kevin T wrote:
> with other languages i always expand tabs to spaces. the vi plugin does
do this properly. if i change all indents to be spaces only will python
behave? i inherited a good deal of the code that i am using, which is tab
based.
Yes, it's best to
On Wed, Nov 28, 2012 at 2:34 PM, Ricky wrote:
>
> Hi all,
>
> I am doing a project on traffic simulation. I want to introduce
> exponential arrival distribution to precede this task. Therefore I want
> write a code in python for exponential arrival distribution. I am very new
> for programming an
On Wed, Nov 28, 2012 at 5:20 PM, Dennis Lee Bieber wrote:
> On 28 Nov 2012 21:39:03 GMT, Steven D'Aprano
> declaimed the following in
> gmane.comp.python.general:> py> if True:
> > ... if True: # tab
> > ... pass # tab, then four spaces
> > ... pass # two spaces, tab, four s
On Thu, Nov 29, 2012 at 9:07 AM, lars van gemerden wrote:
> > PS: this is somewhat simpler than the actual case i've encountered, and
> i haven't tested this exact case, but for now i hope this is enough to get
> some of your insight.
>
> I know for sure that the imports both import the same file,
On Mon, Dec 3, 2012 at 10:37 AM, wrote:
> if found_0 == True or found_1 == True:
>
Not related to your problem, but this line would be more pythonic as:
if found_0 or found_1:
My puzzle two-fold. First: how could that code generate an "index our of
> range" error, and second: lin
On Mon, Dec 3, 2012 at 3:17 PM, Peng Yu wrote:
> Hi,
>
> I'm not able to find the documentation on what locale is used for
> sorted() when the 'cmp' argument is not specified. Could anybody let
> me what the default is? If I always want LC_ALL=C, do I need to
> explicitly set the locale? Or it is
On Tue, Dec 4, 2012 at 11:48 AM, Alexander Blinne wrote:
> Am 04.12.2012 19:28, schrieb DJC:
> (i for i,v in enumerate(w) if v.upper() != v).next()
> > Traceback (most recent call last):
> > File "", line 1, in
> > AttributeError: 'generator' object has no attribute 'next'
>
> Yeah, i saw
On Tue, Dec 4, 2012 at 12:04 PM, wrote:
> Dear Group,
>
> I am trying to use the cluster module as,
> >>> from cluster import *
> >>> data = [12,34,23,32,46,96,13]
> >>> cl = HierarchicalClustering(data, lambda x,y: abs(x-y))
> >>> cl.getlevel(10)
> [[96], [46], [12, 13, 23, 34, 32]]
> >>> cl.get
On Wed, Dec 5, 2012 at 7:34 AM, Neil Cerutti wrote:
> Well, shoot! Then this is a job for groupby, not takewhile.
The problem with groupby is that you can't just limit it to two groups.
>>> prod_desc("CAPSICUM RED fresh from QLD")
['QLD', 'fresh from']
Once you've got a false key from the group
On Wed, Dec 5, 2012 at 6:45 AM, Chris Angelico wrote:
> On Wed, Dec 5, 2012 at 12:17 PM, Nick Mellor wrote:
>>
>> takewhile mines for gold at the start of a sequence, dropwhile drops the
>> dross at the start of a sequence.
>
> When you're using both over the same sequence and with the same
> co
On Wed, Dec 5, 2012 at 10:34 AM, Steven D'Aprano
wrote:
> The difference is almost certain between the LOAD_CONST and the
> LOAD_GLOBAL.
>
> As to *why* there is such a difference, I believe that's a leftover from
> early Python days when None was not a keyword and could be reassigned.
I think th
On Wed, Dec 5, 2012 at 11:18 AM, Ian Kelly wrote:
> On Wed, Dec 5, 2012 at 10:57 AM, Daniel Doo
> wrote:
>> I am new to Python. Is there a method to “join” two pipe delimited files
>> using a unique key that appears in both files? I would like to implement
>> somet
On Wed, Dec 5, 2012 at 10:57 AM, Daniel Doo
wrote:
> I am new to Python. Is there a method to “join” two pipe delimited files
> using a unique key that appears in both files? I would like to implement
> something similar to the Unix join command.
If the files are small enough to fit in virtual
On Wed, Dec 5, 2012 at 9:48 AM, rh wrote:
> I have argparse working with one exception. I wanted the program to print out
> usage when no command line options are given. But I only came across
> other examples where people didn't use argparse but instead printed out
> a separate usage statement. S
On Wed, Dec 5, 2012 at 8:03 PM, Joseph L. Casale
wrote:
> I get a list of dicts as output from a source I need to then extract various
> dicts
> out of. I can easily extract the dict of choice based on it containing a key
> with
> a certain value using list comp but I was hoping to use dict comp
On Thu, Dec 6, 2012 at 11:03 PM, INADA Naoki wrote:
> The reference says:
>
> The truth of x==y does not imply that x!=y is false.
> Accordingly, when defining __eq__(), one should also
> define __ne__() so that the operators will behave as expected.
>
> (http://docs.python.org/3/reference/d
On Fri, Dec 7, 2012 at 12:41 AM, Markus Christen
wrote:
> good morning
>
> i am using pyodbc 3.0.6 for win32 python 2.7.3
> i used it to connect with a MsSql db. Now i have a little problem with the
> umlaut. i cant change anything in the db and there are umlauts like "ä", "ö"
> and "ü" saved. s
On Sat, Dec 8, 2012 at 2:32 PM, Graham Fielding wrote:
> Hey, all!
>
> I've managed to get my project to a semi-playable state (everything
> functions, if not precisely the way I'd like it to). One small issue is
> that when the player movs from one level to the next, the items and monsters
> in
d preferably only one --obvious way to do it.'
Lastly, you have several bare "except" clauses in the code. Bare
excepts are almost always incorrect. I appreciate that it's not easy
to predict exactly what exceptions might turn up here (although I
posit that for all of these, subsets of (TypeError, KeyError,
AttributeError, IndexError) are sufficient), but at the very minimum
you should specify "except Exception", so that you're not
inadvertently catching things like SystemExit and KeyboardInterrupt.
Cheers and hope this is helpful,
Ian
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Dec 11, 2012 at 1:57 PM, Dave Cinege wrote:
> On Tuesday 11 December 2012 01:41:38 Ian Kelly wrote:
>> Second, in __getitem__ you start a loop with "for i in
>> range(len(l)):", and then you use i as an index into l several times.
>> It would be cleaner
On Tue, Dec 11, 2012 at 2:53 PM, Ian Kelly wrote:
> and then I ran the examples, and the output was unchanged. As Steven
> pointed out, I don't see how that first branch could succeed anyway,
> since self.data is never defined.
It occurs to me that the UserDict class does have a
On Wed, Dec 12, 2012 at 10:22 AM, wrote:
> Well, I did some modifications and got a hollow square, but the columns
> aren't perfectly aligned with the rows (at least if input is 5. Thanks for
> the help :)
>
> rows = int(input())
> s1="* "*rows
> s2="*"+(rows-2)*" "+"*"
> print(s1)
> for s in r
On Wed, Dec 12, 2012 at 12:20 PM, Dave Cinege wrote:
> On Tuesday 11 December 2012 01:41:38 Ian Kelly wrote:
>
>> I have a few critiques on the code. First, you might want to use
>> __getattribute__ instead of __getattr__. Otherwise you'll end up
>
> File
On Wed, Dec 12, 2012 at 1:53 PM, MRAB wrote:
> You could try a non-blocking semaphore:
>
> def __init__(self):
> self.cameraActive = Semaphore()
Why a Semaphore and not just a plain old Lock?
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Dec 12, 2012 at 3:20 PM, Dave Cinege wrote:
> On Wednesday 12 December 2012 15:42:36 Ian Kelly wrote:
>
>> def __getattribute__(self, name):
>> if name.startswith('__') and name.endswith('__'):
>> return super(Thesaurus, sel
On Thu, Dec 13, 2012 at 3:26 AM, Alexander Blinne wrote:
> I have a general question about this kinds of things. I see that the
> above is a common use case for some kind of lock which does this
> testing/locking atomically. But the question is: if I know for sure that
> there is no other thread t
On Thu, Dec 13, 2012 at 1:39 PM, Daniel Fetchinson
wrote:
>> If you know the sequence has at least n items, you
>> can do a, b, c = seq[:3]
>
> Yeah, that's probably the simplest, without all the fancy stuff :)
That only works for sequences, though. Not all iterables are
sequences. The islice v
On Sun, Dec 16, 2012 at 10:32 AM, Kwpolska wrote:
> On Sun, Dec 16, 2012 at 6:25 PM, wrote:
>> On Sunday, December 16, 2012 10:09:53 AM UTC-7, Kwpolska wrote:
>>>[...]
>>> PS. please do not use pastebin.com.
>>
>> Why?
>
> http://news.ycombinator.com/item?id=2595066 should answer this very quest
On Sun, Dec 16, 2012 at 9:30 PM, Nick M. Daly wrote:
> It's very unlikely that multiple inheritance would go horribly wrong, as
> long as classes adopt class-specific argument naming conventions.
> However, ever since bug 1683368 [0] was fixed, it's now impossible to
> cleanly create arbitrary inh
On Wed, Dec 19, 2012 at 8:40 AM, Chris Angelico wrote:
> You may not be familiar with jmf. He's one of our resident trolls, and
> he has a bee in his bonnet about PEP 393 strings, on the basis that
> they take up more space in memory than a narrow build of Python 3.2
> would, for a string with lot
On Wed, Dec 19, 2012 at 1:55 PM, wrote:
> Yes, it is correct (or can be considered as correct).
> I do not wish to discuss the typographical problematic
> of "Das Grosse Eszett". The web is full of pages on the
> subject. However, I never succeeded to find an "official
> position" from Unicode. T
On Wed, Dec 19, 2012 at 2:18 PM, wrote:
> latin-1 (iso-8859-1) ? are you sure ?
Yes.
sys.getsizeof('a')
> 26
sys.getsizeof('ab')
> 27
sys.getsizeof('aé')
> 39
Compare to:
>>> sys.getsizeof('a\u0100')
42
The reason for the difference you posted is that pure ASCII strings
have a
On Wed, Dec 19, 2012 at 5:07 PM, Terry Reedy wrote:
> That says that my browser, Firefox 17, does not support HTML5. Golly gee. I
> don't think any browser support5 all of that moving target, and Gecko
> apparently supports about as large a subset as most.
> https://en.wikipedia.org/wiki/Compariso
On Thu, Dec 20, 2012 at 5:50 AM, wrote:
> Brought my laptop out of hibernation to do some work this morning. I
> attempted to run one of my ETLs and got the following error. I made no
> changes since it was running yesterday.
>
>
>
> [swright@localhost app]$ python etl_botnet_meta.py --mode dev
On Thu, Dec 20, 2012 at 12:19 PM, wrote:
> The first (and it should be quite obvious) consequence is that
> you create bloated, unnecessary and useless code. I simplify
> the flexible string representation (FSR) and will use an "ascii" /
> "non-ascii" model/terminology.
>
> If you are an "ascii"
Short answer: Use the POST method on the form instead of GET. Depending how
you process the form you might need to make a few changes to the script
that answers the request.
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Dec 21, 2012 at 9:16 AM, Pierre Quentel
wrote:
>> <= is a comparison expression operator, which is completely different.
>> It is just wrong for this usage. I am 99.9% sure you will come to regret
>> it eventually. Better to make the change now than in Brython2 or Brython3.
>
> I am 99.99%
On Fri, Dec 21, 2012 at 1:59 PM, Pierre Quentel
wrote:
>> By the way, what is Brython actually doing when you append a child to
>> the document itself like that? Usually I would expect a div to be
>> appended to the body or to another div. The above looks like it would
>> attach the new div as a
On Fri, Dec 21, 2012 at 3:52 PM, Chris Angelico wrote:
> On Sat, Dec 22, 2012 at 3:36 AM, Pierre Quentel
> wrote:
>>
>>> Hmm. So when that gets added into a DIV, it has to get parsed for
>>> tags? How does this work? This seems very odd. I would have expected
>>> it to remain as DOM objects.
>>
>
On Fri, Dec 21, 2012 at 4:45 PM, Ian Kelly wrote:
> In Brython, the str builtin does not return strings?
Oh, and repr is just a synonym of str, which makes it useless.
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Dec 21, 2012 at 4:45 PM, Ian Kelly wrote:
> In my playing around with it just now, the addition doesn't seem to
> actually return a string.
>From the code, it appears that adding two nodes together *actually*
returns a $AbstractTag object, which seems to be just a container
On Sat, Dec 22, 2012 at 1:31 PM, Dan Sommers wrote:
> So why are we all so comfortable with using "*" as the operator for
> multiplication? I'm sure that a new programming language that dared to
> use U+00D7 or U+2715 for multiplication would be instantly rejected on
> the grounds that it was con
On Dec 24, 2012 9:37 AM, "Pander Musubi" wrote:
> > >>> ''.join(sorted(random.sample(cs, 20), key=d.get))
> >
> > '5aAàÀåBCçËÉíÎLÖøquùx'
>
> This doesn't work for words with more than one character:
Try this instead:
def collate(x):
return list(map(d.get, x))
sorted(data, key=collate)
I w
On Tue, Dec 25, 2012 at 8:40 PM, Ramchandra Apte wrote:
> On Monday, 24 December 2012 08:08:12 UTC+5:30, Robert Montgomery wrote:
>> I am writing a script that will send an email using an account I set up
>>
>> in gmail. It is an smtp server using tls on port 587, and I would like
>>
>> to use a
On Wed, Dec 26, 2012 at 4:21 PM, wrote:
> Thank you very much for your reply. I actually just deleted this post as you
> were replying! I had figured out a few things and then got confused about a
> few others :/ If you have a chance, can you look at the other post? Thank
> you!!
You can'
On Thu, Dec 27, 2012 at 7:44 AM, Joseph L. Casale
wrote:
> I am writing a class to provide a db backed configuration for an application.
>
> In my programs code, I import the class and pass the ODBC params to the
> class for its __init__ to instantiate a connection.
>
> I would like to create a fu
On Thu, Dec 27, 2012 at 11:50 AM, Steven W. Orr wrote:
> Really? I thought that the whole idea of using "rb" or "wb" was something
> that was necessitated by WinBlo$e. We're not doing IO on a text file here.
> It's a tar file which by definition is binary and it's not clear to me why
> unicode has
On Thu, Dec 27, 2012 at 12:25 PM, Ian Kelly wrote:
> You're correct that it makes no sense to open a tar file in binary
> mode,
Of course that should have read: "it makes no sense to open a tar file
in text mode."
--
http://mail.python.org/mailman/listinfo/python-list
Some would argue that vim is always good enough, especially with its plugin
system.
I bounce between vim and Sublime Text 2, and recently bought PyCharm went
it went on sale a week ago.
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, Dec 27, 2012 at 1:16 PM, Joseph L. Casale
wrote:
> When you use optional named arguments in a function, how do you deal with with
> the incorrect assignment when only some args are supplied?
>
> If I do something like:
>
> def my_func(self, **kwargs):
>
> then handle the test cases wit
On Thu, Dec 27, 2012 at 1:47 PM, Joseph L. Casale
wrote:
>> Don't use kwargs for this. List out the arguments in the function
>> spec and give the optional ones reasonable defaults.
>
>> I only use kwargs myself when the set of possible arguments is dynamic
>> or unknown.
>
> Gotch ya, but when t
On Thu, Dec 27, 2012 at 3:17 PM, Terry Reedy wrote:
>> PS Py 3.3 warranty: ~30% slower than Py 3.2
>
>
> Do you have any actual timing data to back up that claim?
> If so, please give specifics, including build, os, system, timing code, and
> result.
There was another thread about this one a whil
On Thu, Dec 27, 2012 at 5:33 PM, Gnarlodious wrote:
> Graham Dumpleton has informed me that the the relevant bug reports are:
>
> http://bugs.python.org/issue8098
> http://bugs.python.org/issue9260
>
> To quote:
>
> All the problems derive from a stupid function in Python internals called
> PyImp
On Wed, Jan 2, 2013 at 7:32 AM, Chris Angelico wrote:
> Okay, I have to ask... why? Does it have an exception for names of classes?
Yes, and for module-level functions.
> I don't like linters that enforce too much style. Catch things that
> might be mis-coded (like C's classic "if (x = 1)"), but
On Wed, Jan 2, 2013 at 10:57 AM, Chris Angelico wrote:
> Yeah, same applies to most linters I think. You end up disagreeing
> with the author on half the points. Oh well. Doesn't make the tool
> useless, just means you need to fiddle with it to get it how you want
> it.
It's a lot less work to di
On Wed, Jan 2, 2013 at 4:52 PM, Steven D'Aprano
wrote:
> If pylint says that global variables should be named like "__variable__",
> that is explicitly going against PEP 8.
It doesn't say that anywhere. It includes dunder names in the regex
so that you don't get spurious warnings from pylint abo
On Wed, Jan 2, 2013 at 7:24 PM, someone wrote:
> 1) class somethingWork: Invalid name "somethingWork" (should match
> [A-Z_][a-zA-Z0-9]+$), I'm not that good at regular exps, but I suppose it
> wants my class name to start with a capital letter ?
Yes, PEP-8 recommends CamelCase for class names.
On Thu, Jan 3, 2013 at 2:27 AM, Andrew Berg wrote:
> Does 'from __future__ import barry_as_FLUFL' do anything? Despite PEP
> 401, using print as a statement still raises a SyntaxError.
I think it only replaces the != operator with <>.
> Where is 'from __future__ import braces' implemented in CPy
On Sat, Jan 5, 2013 at 8:57 AM, Chris Angelico wrote:
> You miss my point, though. I went for simple Pythonic code, and never
> measured its performance, on the expectation that it's "good enough".
> Written in C, the state machine is probably WAY faster than splitting
> and then iterating. My C++
601 - 700 of 3945 matches
Mail list logo