Thomas Jollans wrote:
On 30/07/11 20:39, Ethan Furman wrote:
How it works: since the sys.argv object does yet exist, I create an
object and assign it to sys.argv; then, when Python assigns the actual
argv to sys.argv, my object is tossed, and the __del__ method is called;
the __del__ method is
Dennis Lee Bieber wrote:
On Sat, 30 Jul 2011 21:36:41 +1000, Steven D'Aprano
declaimed the following in
gmane.comp.python.general:
Probably because nobody thought about it, but if it had been proposed to
change xrange into an iterator, I'm pretty confident that the suggestion
would have been
Howdy,
I'm going to setup a few linux systems for testing (probably three) as
well as the three FreeBSD, OpenBSD, and (possibly) NetBsd. Oh, and
Windows. ;)
Any recommendations on which linuces to pick?
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Steve Holden wrote:
We would ideally like the last project to to be something that
demonstrates at least some minimal involvement with the Python
community. Something like "get a Python answer upvoted on
StackOverflow", for example, or getting a question answered on c.l.p. At
the same time it
nephish wrote:
Hey all,
I have been trying to get my head around how to do something, but i am
missing how to pull it off.
I am reading a packet from a radio over a serial port.
i have " two bytes containing the value i need. The first byte is the
LSB, second is MSB. Both bytes are BCD-encode
MRAB wrote:
On 04/08/2011 19:26, nephish wrote:
Hey all,
I have been trying to get my head around how to do something, but i am
missing how to pull it off.
I am reading a packet from a radio over a serial port.
i have " two bytes containing the value i need. The first byte is the
LSB, second
Steven D'Aprano wrote:
Eric Snow wrote:
On Mon, Aug 8, 2011 at 6:37 AM, Nick wrote:
Is it possible to put a doc string on a class attribute? Something
like this
You can put a docstring on a property (which is a function):
class Test(object):
@property
def fred(self):
"attrib
Greetings!
Does anyone know/recall the original purpose of __all__?
I had thought it was primarily to specify what would be imported when
`from ... import *` was executed, such as for tk; today, it seems it is
also used to specify the API for the module, and so the help() subsystem
will only
Seebs wrote:
We're fully aware of the tradeoffs of significant indentation.
You are. A couple of other people I've talked to are. Many others
are not.
The times that whitespace indentation has bitten me, it was still not
difficult to fix -- I just had to look and see which line(s)
should/
Paul Woolcock wrote:
The gurus will have to correct me if this is not an accepted practice,
but I know some projects (Fabric is the one that comes to mind) will
define a submodule specifically for the 'from blah import *' situation.
The submodule would be called "api", or something like that, s
Chris Angelico wrote:
Incidentally, in the original expression, it would be slightly more
sane to write it as:
a = x + y) * z
borrowing from the musical concept that a repeat sign with no
corresponding begin-repeat means to repeat from the beginning. But
both of these violate XKCD 859.
Argh!
Ben Finney wrote:
Chris Angelico writes:
On Sun, Aug 14, 2011 at 8:10 AM, Steven D'Aprano
wrote:
Do you get worried by books if the last page doesn't include the
phrase "The End"? These days, many movies include an extra clip
following the credits. When the clip finishes, and the screen go
Gerrat Rickert wrote:
What sayest the Python community about having an explicit warning
against such un-pythonic behaviour (re-assigning builtin names)?
What makes you think this behavior is unpythonic? Python is not about
hand-holding.
~Ethan~
--
http://mail.python.org/mailman/listinfo/pyt
Seebs wrote:
On 2011-08-15, Ethan Furman wrote:
Gerrat Rickert wrote:
What sayest the Python community about having an explicit warning
against such un-pythonic behaviour (re-assigning builtin names)?
What makes you think this behavior is unpythonic? Python is not about
hand-holding.
It
Philip Semanchuk wrote:
On Aug 16, 2011, at 1:15 AM, Steven D'Aprano wrote:
Protecting n00bs from their own errors is an admirable aim, but have you
considered that warnings for something which may be harmless could do more
harm than good?
Isn't the whole point of a warning to highlight behavi
Philip Semanchuk wrote:
On Aug 16, 2011, at 11:41 AM, Ethan Furman wrote:
Philip Semanchuk wrote:
If we are to eschew warnings in
cases where they might be highlighting something harmless, then we would
have no warnings at all.
>>
Sounds good to me. ;) Keep such things in the IDE&
Philip Semanchuk wrote:
I think Python does lots of beneficial hand-holding. Garbage collection
> is a good example. $DIETY knows, people have been struggling with manual
> memory management in C and its ilk for a long time. Even though there
> are good tools to help, memory leaks still happen.
Seebs wrote:
On 2011-08-16, Ethan Furman wrote:
I think warnings should be reserved for language changes and such (like
DeprecationWarning, RuntimeWarning, and FutureWarning), not for possible
programmer mistakes.
I disagree, on the basis of the following:
The quality of C code I have to
Seebs wrote:
On 2011-08-16, Ethan Furman wrote:
What makes you think it's unintentional?
Programming experience.
People *often* do things unintentionally.
Seems to me the real issue is somebody using a builtin, such as str or
int, and that they somehow manage to do this without real
Welcome to my killfile.
*plonk*
--
http://mail.python.org/mailman/listinfo/python-list
Seebs wrote:
On 2011-08-17, Steven D'Aprano wrote:
On Wed, 17 Aug 2011 01:17 pm Seebs wrote:
Hmm. See, I've never reached that, in Python or any other language. I
figure it creates a new potential for confusion, and that I would rather
avoid any ambiguity. I don't *like* ambiguity in code.
Seebs wrote:
Pathological narcissism is scary. If you ever find yourself going longer
than usual without being wrong, start checking your work more carefully. :)
+1 QOTW
--
http://mail.python.org/mailman/listinfo/python-list
Seebs wrote:
On 2011-08-17, Ethan Furman wrote:
Seebs wrote:
On 2011-08-17, Steven D'Aprano wrote:
Ah, well you see the thing is, this is Python. As soon as you call any
function you don't control, you no longer know what your environment is
with any certainty. For all you know, th
gc wrote:
Target lists using comma separation are great, but they don't work
very well for this task. What I want is something like
a,b,c,d,e = *dict()
This isn't going to happen. From all the discussion so far I think your
best solution is a simple helper function (not tested):
def repeat
I have WordPerfect v13 which we are currently using for letter merges.
I would like to automate this with Python instead of learning the WP
Macro language.
Does anyone have any pointers?
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Alec Taylor wrote:
wow, people still use WordPerfect?
Them's fightin' words right there! :)
Yes, we still use Word Perfect, and will as long as it is available.
The ability to see the codes in use (bold, margins, columns, etc) has so
far been unequaled in anything else I have looked at.
~
John Gordon wrote:
I suspect that learning how to integrate python with wordperfect will
end up being much more work than learning wordperfect macros.
Possibly... but I enjoy coding in Python. :)
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Paul Rubin wrote:
Steven D'Aprano writes:
But there's no way to know what that minimum is. Python libraries throw
all sorts of exceptions that their documentation doesn't mention.
Yes, you're absolutely correct. But it's also irrelevant. Most of those
exceptions should not be caught, even if
Seebs wrote:
On 2011-08-23, Roy Smith wrote:
I want to log a string but only the first bunch of it, and add "..."
to the end if it got truncated. This certainly works:
logger.error("FAILED: '%s{50}', '%s', %s, %s" % (message,
route, params, e.code))
does anything like this exis
Seebs wrote:
On 2011-08-23, Ethan Furman wrote:
Seebs wrote:
On 2011-08-23, Roy Smith wrote:
logger.error("FAILED: '%s{50}', '%s', %s, %s" % (message,
route, params, e.code))
does anything like this exist?
%.50s
That's not working in
Michael Hunter wrote:
On Wed, Aug 24, 2011 at 2:50 PM, Terry Reedy wrote:
[...]
You can find it at http://www.radiofreepython.com/ as of this very minute.
>>
What a treat. Thank you. Please announce the next one too.
No, please don't announce the next one. There should be a RSS feed.
But p
Travis Parks wrote:
I wrote a post a few days ago about how I know the syntax and
libraries fairly well, but I don't have the "philosophy". I haven't
seen a lot of tricks and I am never sure what is the "norm" in Python.
I am sure if an experienced Python programmer looked at my code,
they'd imme
Jack Trades wrote:
On Tue, Aug 30, 2011 at 2:37 AM, Rob Williscroft wrote:
If an impementation (as you say up thread) can populate globals
or locals with whatever they want, then how do you know that last
item added was the function definition the user supplied ?
Because the implementation wil
Rob Williscroft wrote:
Ethan Furman wrote in news:4e5d29c8.8010...@stoneleaf.us in
gmane.comp.python.general:
Jack Trades wrote:
On Tue, Aug 30, 2011 at 2:37 AM, Rob Williscroft wrote:
If an impementation (as you say up thread) can populate globals
or locals with whatever they want, then
Rob Williscroft wrote:
Arnaud Delobelle wrote:
That's not an issue. The last statement that is executed will be the
"def" statement.
You don't know that, an implementation may for example set __bultins__
to None, prior to returning, its not an unreasonable thing to do and
the docs don't say
Rob Williscroft wrote:
Arnaud Delobelle wrote:
That's not an issue. The last statement that is executed will be the
"def" statement.
You don't know that, an implementation may for example set __bultins__
to None, prior to returning, its not an unreasonable thing to do and
the docs don't say
I asked a question a couple weeks ago about scripting WordPerfect with
Python, and a couple respondents suggested LaTeX was very good. Where
would I start if I wanted to learn about it?
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano wrote:
On Wed, 23 Feb 2011 13:26:05 -0800, John Nagle wrote:
The IEEE 754 compliant FPU on most machines today, though, has an 80-bit
internal representation. If you do a sequence of operations that retain
all the intermediate results in the FPU registers, you get 16 more bits
Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
--> import base64
--> base64.encodestring(b'this is a test')
__main__:1: DeprecationWarning: encodestring() is a deprecated alias,
use enco
Terry Reedy wrote:
On 2/28/2011 3:51 PM, Ethan Furman wrote:
The deprecation warning has gone away in 3.2,
No, still there:
def encodestring(s):
"""Legacy alias of encodebytes()."""
import warnings
warnings.warn("encodestring() is a
Matt Funk wrote:
Hi,
i have a list of files, some of which end with .hdf and one of them end
with hdf5. I want to filter the hdf5 file. Thereforei set extensions: hdf5
I try to filter as below:
>
-->if (any(filename.endswith(x) for x in extensions)):
What is extensions? A string or a tuple?
Martin De Kauwe wrote:
Hi,
I think this might be obvious? I have a base class which contains X
objects which other classes inherit e.g.
class BaseClass(object):
def __init__(self, something, something_else):
self.something = something
self.something_else = something_else
Peter wrote:
Thanks for the link Malcolm, I'll have a look at it. What is
particularly interesting (at first glance), is that the author has
"mixed" Tkinter with ttk as it suited i.e. look at this line:
f1 = tkinter.Frame(nb, background="red")
If ttk was being used purely (from tkinter import *
peterob wrote:
Im completely confinvalided from email library. When you parse email from
file it creates object Message.
f = open(emailFile, 'r')
msg = email.message_from_file(f)
f.close()
How can I access RAW header of email represented by object msg? I dont
wanna access each header field by
monkeys paw wrote:
I have the following file:
FileInfo.py:
import UserDict
class FileInfo(UserDict):
"store file metadata"
def __init__(self, filename=None):
UserDict.__init__(self)
self["name"] = filename
When i import it like so:
import FileInfo
i get this error
Jon Herman wrote:
Hello all,
I am pretty new to Python and am trying to write data to a file.
However, I seem to be misunderstanding how to do so. For starters, I'm
not even sure where Python is looking for these files or storing them.
The directories I have added to my PYTHONPATH variable (w
Dan Stromberg wrote:
Are you on windows?
You probably should use / as your directory separator in Python, not \.
In Python, and most other programming languages, \ starts an escape
sequence, so to introduce a literal \, you either need to prefix your
string with r (r"\foo\bar") or double yo
John Harrington wrote:
Here's a script that illustrates the problem. Any help would be
appreciated!:
#BEGIN SCRIPT
import re
outlist = []
myfile = "raw.tex"
fin = open(myfile, "r")
lineList = fin.readlines()
fin.close()
for i in range(0,len(lineList)):
lineList[i]=re.sub(r'(\\begin{do
On 3/18/2011 6:25 PM, Dan Stromberg wrote:
On Fri, Mar 18, 2011 at 4:00 PM, Ethan Furman mailto:et...@stoneleaf.us>> wrote:
Dan Stromberg wrote:
Are you on windows?
You probably should use / as your directory separator in Python,
not \. In Python, and most
John Ladasky wrote:
On Mar 28, 2:25 am, Andrea Crotti wrote:
I noticed some time ago in a program that needed speed that deepcopy in
particular is incredibly slow, but I guess is normal since it has to
copy every bit of the data structure.
That may be, but when it already takes several second
John Parker wrote:
I have written the following code so far but get an error.
infile = open("scores.txt", "r")
lines = infile.readlines()
infile.close()
tokens = lines.split(",")
[snip]
error:
Traceback (most recent call last):
File "Score_8.py", line 38, in
tokens = lines.split(",")
harrismh777 wrote:
Chris Rebert wrote:
Yes. py2exe is a tool which generates such Windows executables:
http://www.py2exe.org/
Interesting... but it can't possibly be creating .exe files
(compiling)...
Yes and no. The python program is not being compiled. The Python
system, along with all
Steven D'Aprano wrote:
I have a package with some tests. The tests are not part of the package
Do you mean they are not importable, as in
--> from spam import tests
or they are not distributed? Because it seems to me that distributing
them would be worthwhile to at least some of the folks d
Wehe, Marco wrote:
I am doing a search through a list of files but the text the casing
doesn't match. My list is all upper case but the real files are all
different. Is there a smooth way of searching through the list without
going full on regular expressions?
path = "V:\\Jinsy\\incoming\\ass
Westley Martínez wrote:
On Fri, 2011-04-08 at 01:41 -0500, harrismh777 wrote:
Freedom isn't free... you have to fight for it... always.
Why should a business listen to you? You're not gonna buy any software
anyways.
From a thread a few months back I can say there are a couple companies
wi
r wrote:
The code above implements an interactive session (a REPL). Therefore,
what I'd like to get is an error information printed out at the output
as soon as it becomes available.
Couple ideas:
1) Instead of yielding the error, call some global print function, then
continue on; or
2) Col
candide wrote:
Le 08/04/2011 18:43, Ian Kelly a écrit :
In "bool(x=5)", "x=5" is also not an expression. It's passing the
expression "5" in as the parameter x, using a keyword argument.
>>
You are probably right but how do you deduce this brilliant
interpretation from the wording given in th
Mel wrote:
Python is a pragmatic language, so all the rules come pre-broken.
+1 QOTW
--
http://mail.python.org/mailman/listinfo/python-list
James Mills wrote:
Are we done with this discussion yet ? :)
*sigh* It was a slow day yesterday and I have
a funny feeling it's going to be the same today!
Regardless of anyone's subjective opinions as to what
was clear - I still stand by what I said.
I think I see your point -- the OP said:
-
Westley Martínez wrote:
On Tue, 2011-04-12 at 16:06 -0700, Ethan Furman wrote:
--> def func():
--> var1 = something()
--> var2 = something_else('this')
--> return? var1.hobgle(var2)
--> var3 = last_resort(var1)
--> return var3.wiglat(var2)
Steven D'Aprano wrote:
On Tue, 12 Apr 2011 16:48:31 -0700, Ethan Furman wrote:
Westley Martínez wrote:
On Tue, 2011-04-12 at 16:06 -0700, Ethan Furman wrote:
--> def func():
--> var1 = something()
--> var2 = something_else('this') --> return?
var
James Mills wrote:
On Thu, Apr 14, 2011 at 10:39 AM, rantingrick wrote:
[weapon of mass-snippitude]
James,
*Please* don't re-post his crap.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
geremy condra wrote:
On Wed, Apr 13, 2011 at 10:50 PM, harrismh777 wrote:
>>
My major professor once told me, "You know you've won the argument when they
start calling you names!"
I think your professor should have said "you know you've won the
argument when you can prove it".
If you can
Westley Martínez wrote:
Also, why aren't Opera and Google criticized for their proprietary
browsers (Chrome is essentially a proprietary front-end)? Is it because
their browsers follow web standards, or is it because we have demonized
Microsoft?
My biggest gripe with Microsoft as that they *don
Chris Angelico wrote:
lst=[]
for i in xrange(1,1000): # arbitrary top, don't like this
try:
lst.append(parse_kwdlist(dct["Keyword%d"%i]))
except KeyError:
break
Possibly overkill:
import dbf
table = dbf.from_csv("csvfile") # fields get names f0, f1, f2, ...
table.rename_field
Gerald Britton wrote:
However, I would like a deeper
understanding of why I cannot use "foo" as an unqualified variable
inside the method in the class. If Python allowed such a thing, what
problems would that cause?
8<
"script with possible
Gerald Britton wrote:
For my
final attempt, I add the prefix "a." to my use of "foo"
class a():
... foo = 'foo'
... def g(x):
... return a.foo
...
The first parameter to any method in a class* is going to be the
instance of that class, and is usually named 'self'. So your
Gerald Britton wrote:
I now understand the Python does
not consider a class definition as a separate namespace as it does for
function definitions. That is a helpful understanding.
That is not correct. Classes are separate namespaces -- they just
aren't automatically searched. The only name
chad wrote:
Let's say I have the following
class BaseHandler:
def foo(self):
print "Hello"
class HomeHandler(BaseHandler):
pass
Then I do the following...
test = HomeHandler()
test.foo()
How can HomeHandler call foo() when I never created an instance of
BaseHandler?
Yo
Kyle T. Jones wrote:
Ethan Furman wrote:
chad wrote:
Let's say I have the following
class BaseHandler:
def foo(self):
print "Hello"
class HomeHandler(BaseHandler):
pass
Then I do the following...
test = HomeHandler()
test.foo()
How can HomeHandler ca
Hans Georg Schaathun wrote:
List comprehension is understood even by readers with no experience
with python.
There's nothing magically understandable about a list comp -- the first
time I saw one (which was in Python), I had to learn about them.
~Ethan~
--
http://mail.python.org/mailman/li
For anybody interested in composition instead of multiple inheritance, I
have posted this recipe on ActiveState (for python 2.6/7, not 3.x):
http://code.activestate.com/recipes/577658-composition-of-classes-instead-of-multiple-inherit/
Comments welcome!
~Ethan~
--
http://mail.python.org/mailma
Carl Banks wrote:
That's not what we mean by composition. Composition is when one object
> calls upon another object that it owns to implement some of its behavior.
> Often used to model a part/whole relationship, hence the name.
Hmmm. Okay -- any ideas for a better term? Something that descr
James Mills wrote:
On Fri, Apr 29, 2011 at 11:43 AM, Ethan Furman wrote:
Hmmm. Okay -- any ideas for a better term? Something that describes taking
different source classes and fusing them into a new whole, possibly using
single-inheritance... Frankenstein, maybe? ;)
I'd have to say
Carl Banks wrote:
Here is my advice on mixins:
[snip]
Cool. Thanks!
~Ethan
--
http://mail.python.org/mailman/listinfo/python-list
Ian Kelly wrote:
On Thu, Apr 28, 2011 at 11:15 AM, Ethan Furman wrote:
For anybody interested in composition instead of multiple inheritance, I
have posted this recipe on ActiveState (for python 2.6/7, not 3.x):
http://code.activestate.com/recipes/577658-composition-of-classes-instead-of
Raymond Hettinger wrote:
I'm writing-up more guidance on how to use super() and would like to
point at some real-world Python examples of cooperative multiple
inheritance.
Don't know if you are still looking for examples, but I recently came
across a thread in Python-Dev which had an example u
harrismh777 wrote:
Grant Edwards wrote:
I give up. You don't seem to understand the C language defintion or
what is commonly meant by "pass by reference".
ah, don't give up... here is a link that might help to clarify some of
these semantics... me thinks:
http://en.wikipedia.org/wiki/Pa
Ian Kelly wrote:
On Fri, May 6, 2011 at 1:57 PM, dmitrey wrote:
Unfortunately, it doesn't work, it turn out to be dict_items:
next({1:2}.items())
Traceback (most recent call last):
File "", line 1, in
TypeError: dict_items object is not an iterator
So call iter() on it first:
next(iter(m
harrismh777 wrote:
Steven D'Aprano wrote:
>>> attribution lost wrote:
> and implies in any case that li does not exist
It does nothing of the sort. If li doesn't exist, you get a NameError.
That was the point. 'not' implies something that is not logical;
which is irony extreme sinc
Steven D'Aprano wrote:
But that's wrong! Names (little boxes) can't point to *slots in a list*,
any more than they can point to other names! This doesn't work:
--> L = [None, 42, None]
--> a = L[0]
--> L[0] = 23
--> print(a) # This doesn't work!
23
Minor nitpick -- having a comment saying
James Wright wrote:
Hello,
Howdy!
def create_report_index(report): #Here we are creating a simple
index.html file from data in a text file
newfile = open(report + '.html', 'w') #Create the index file using
report name
for each_value in D4[report]:
[clean_name, _] = each_value
James Wright wrote:
Thank you Ethan,
This is what I see now:
# python render4.py
current each_value is: vsr
Traceback (most recent call last):
File "render4.py", line 115, in
create_report_index(each_item)
File "render4.py", line 26, in create_report_index
[clean_name, _] = each_va
James Wright wrote:
On Mon, May 9, 2011 at 3:36 PM, Ethan Furman wrote:
Change your print line to:
print("D4[%s] = %s" % (report, each_value))
After that, you'll have to track down how D4 is being created to see where
'vsr' is coming from.
It does not appear t
James Wright wrote:
On Mon, May 9, 2011 at 4:04 PM, Ethan Furman wrote:
James Wright wrote:
On Mon, May 9, 2011 at 3:36 PM, Ethan Furman wrote:
>>>>
Change your print line to:
print("D4[%s] = %s" % (report, each_value))
After that, you'll have to track down how
Ian Kelly wrote:
On Fri, May 6, 2011 at 4:49 PM, Ethan Furman wrote:
Anybody care to chime in with their usage of this construct?
You should start with PEP 3106. The main idea is that dict.keys() and
dict.items() can be treated as frozensets, while still being more
lightweight than lists
Hans Georg Schaathun wrote:
On 11 May 2011 13:36:02 GMT, Steven D'Aprano
wrote:
: > In this case, the interpretation of an arbitrary object as a boolean is
: > peculiar for python.
:
: Incorrect. It is widespread among many languages. Programmers have been
: writing conditional tests usi
Hans Georg Schaathun wrote:
On Wed, 11 May 2011 13:50:54 -0400, Prasad, Ramit
wrote:
: I find this argument to be flawed. Should I stop using built-in
: generators instead of range/xrange for looping through lists?
: Certainly for loops with loop counting are understood more widely
: than g
Rodrick Brown wrote:
I'm having a hard time dealing with the following scenario
My class takes a hash like the following:
rdargs =
{'env:'prod','feed':'opra','hostname':'host13dkp1','process':'delta','side':'a','zone','ny'}
All the keys in this hash can be optional.
I'm having a hard time
Chris Angelico wrote:
On Thu, May 12, 2011 at 7:02 AM, Ian wrote:
In the "real world" lists of zero items do not exist.
You don't go shopping with a shopping list of zero items.
Actually, yes you do. You maintain your shopping list between trips;
whenever you need something, you put it on th
Roy Smith wrote:
I recently observed in the "checking if a list is empty" thread that a
list and a subclass of list can compare equal:
class MyList(list):
"I'm a subclass"
l1 = []
l2 = MyList()
print type(l1), type(l2)
print type(l1) == type(l2)
print l1 == l2
Roy Smith wrote:
On May 12, 2011, at 11:30 AM, Eric Snow wrote:
That definitely makes it unclear.
I don't think it's unclear at all. It's very clear. Clearly wrong :-)
While it is wrong (it should have 'built-in' precede the word 'types'),
it is not wrong in the way you think -- a subcla
Andrew Berg wrote:
On 2011.05.12 02:25 PM, MRAB wrote:
You can raise an exception wherever you like! :-)
If I raise an exception that isn't a built-in exception, I get something
like "NameError: name 'HelloError' is not defined". I don't know how to
define the exception.
class HelloError(Exce
Roy Smith wrote:
On May 12, 2:29 pm, Ethan Furman wrote:
While it is wrong (it should have 'built-in' precede the word 'types'),
it is not wrong in the way you think -- a subclass *is* a type of its
superclass.
Well, consider this:
class List_A(list):
"A lis
Steven D'Aprano wrote:
On Thu, 12 May 2011 09:43:23 -0700, Ethan Furman wrote:
MyList is a list -- just a more specific kind of list -- as can be seen
from its mro; this is analogous to a square (2 sets of parallel lines
joined at 90 degree angles, both sets being the same length) also be
In Python 3 one can say
--> huh = bytes(5)
Since the bytes type is actually a list of integers, I would have
expected this to have huh being a bytestring with one element -- the
integer 5. Actually, what you get is:
--> huh
b'\x00\x00\x00\x00\x00'
or five null bytes. Note that this is an
Joe Leonardo wrote:
Totally baffled by this…maybe I need a nap. Writing a small function to
reject input that is not a list of 19 fields.
def breakLine(value):
if value.__class__() != [] and value.__len__() != 19:
print 'You must pass a list that contains 19 fields.'
else:
Felipe Bastos Nunes wrote:
2011/5/17 Ethan Furman wrote:
In Python 3 one can say
--> huh = bytes(5)
Since the bytes type is actually a list of integers, I would have
expected this to have huh being a bytestring with one element -- the
integer 5. Actually, what you get is:
-->
Corey Richardson wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 05/17/2011 02:47 PM, Ethan Furman wrote:
In Python 3 one can say
--> huh = bytes(5)
Since the bytes type is actually a list of integers, I would have
expected this to have huh being a bytestring with one element --
Ian Kelly wrote:
On Tue, May 17, 2011 at 2:20 PM, Ethan Furman wrote:
The big question, though, is would you do it this way:
some_var = bytes(23).replace(b'\x00', b'a')
or this way?
some_var = bytes(b'a' * 23)
Actually, I would just do it this way:
some_var
301 - 400 of 1928 matches
Mail list logo