at the
__file__ attribute. You need to be a bit careful with this; the import
machinery was rewritten for the upcoming 3.3 release, and there were several
changes to the module information.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
On Monday, July 23, 2012 1:59:42 AM UTC-6, Chris Angelico wrote:
On Fri, Jul 20, 2012 at 5:56 PM, levi nie lt;levinie...@gmail.comgt; wrote:
gt; the meaning of r’...‘?
It#39;s a raw string.
http://docs.python.org/py3k/tutorial/introduction.html#strings
Chris Angelico
Since this
()).
It poses the same security risk: acting on unchecked user data.
John Roth
jmf
--
http://mail.python.org/mailman/listinfo/python-list
and cannot be assigned to in the 3.x
series. They weren't locked down in the 2.x series when they were introduced
because of backward compatibility.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
that.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
John Roth johnro...@gmail.com added the comment:
I apologize for not submitting this in patch format, but I don't have a
development system available.
I suggest replacing the entire 6.1.3 section with:
To speed up loading modules, Python caches the compiled version of each module
On Jan 31, 4:43 pm, Terry Reedy tjre...@udel.edu wrote:
On 1/31/2012 3:20 PM, John Roth wrote:
On Jan 30, 3:43 pm, Terry Reedytjre...@udel.edu wrote:
On 1/30/2012 4:30 PM, Roy Smith wrote:
Every so often (typically when refactoring), I'll remove a .py file
and forget to remove
On Jan 30, 3:43 pm, Terry Reedy tjre...@udel.edu wrote:
On 1/30/2012 4:30 PM, Roy Smith wrote:
Every so often (typically when refactoring), I'll remove a .py file
and forget to remove the corresponding .pyc file. If I then import
the module, python finds the orphaned .pyc and happily
for,
and what it isn't good for. That is, as another poster says, language
agnostic.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
.
--
DaveA
Dave's answer is excellent background. I've snipped everything except
the part I want to emphasize, which is to use raw strings. They were
put into Python specifically for your problem: that is, how to avoid
the double and triple backslashes while writing regexes.
John Roth
--
http
On Sep 1, 8:26 am, Ian Kelly ian.g.ke...@gmail.com wrote:
On Thu, Sep 1, 2011 at 6:45 AM, John Roth johnro...@gmail.com wrote:
I personally consider this to be a wart. Some time ago I did an
implementation analysis. The gist is that, if self and cls were made
special variables that returned
On Sep 2, 2:30 pm, Ian Kelly ian.g.ke...@gmail.com wrote:
On Fri, Sep 2, 2011 at 11:51 AM, John Roth johnro...@gmail.com wrote:
I don't see how you could get rid of the wrappers. Methods would
still need to be bound, somehow, so that code like this will work:
methods = {}
for obj
appropriately you could get rid of all of the wrappers and the
attendant run-time overhead.
I've never published the analysis because that train has already left
the shed. The earliest it could be considered would be 4.0, which
isn't even on the horizon.
John Roth
--
http://mail.python.org/mailman
On Jul 27, 8:56 am, Thomas Rachel nutznetz-0c1b6768-bfa9-48d5-
a470-7603bd3aa...@spamschutz.glglgl.de wrote:
Am 27.07.2011 14:18 schrieb John Roth:
Two comments. First, your trace isn't showing attempts to open .py
files, it's showing attempts to open the Curses library in the bash
causing the failing open.
Second, the audit program is an idiot. There are lots of programs
which use the easier to ask forgiveness pattern and test for the
existence of optional files by trying to open them. This may be what
Bash is doing.
John Roth
--
http://mail.python.org/mailman/listinfo
to look at PEP 394:
http://www.python.org/dev/peps/pep-0394/
It can simplify writing scripts which select the version you want.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
to have the definition before the use.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
. Following on with this
idea, loop control would be more of a breakif or continueif statement.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
at doing the same thing for Windows.
Regards,
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
, you can
use Python2 for scripts that require 2.7, and Python3 for scripts that
require 3.2, and they'll eventually be portable to other systems.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
are handled during compilation; the built-in
types are run-time objects.
Python is not a language where a script can change compile-time
behavior. Doing that would make it a very different language, and
would put it into a very different niche in the language ecology.
John Roth
--
http
that is going to be
pretty bogus.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
it. As it turns out, its unicode hex value is
A0, which is indeed a non-breaking space.
This is probably as good as any page: http://en.wikipedia.org/wiki/UTF-8
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
for a class.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
software is a dead end.” —Mark |
_o__) Pilgrim, 2006 |
Ben Finney
You might also want to look at PEP 3152, which was just posted.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
haven't a clue how anyone can think it's similar to Python. Or Java,
for that matter.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
that direct marketing files can be
cleansed to USPS standards.
That said, I don't see any reason why any of the examples in your
first group should be misparsed by a competent parser.
Sorry I don't have any real help for you.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
like it, but I think it needs a bit more work.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
for invoking a method where the object is inserted at the beginning
of the parameter list. IIRC, that's done by wrapping the function
object.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
) of the warts
removed and some more modern features added. Brought to you
by the same people who brought you C and Unix all those years ago.
The use of the Plan 9 toolchain is not a coincidence.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
). If you're
inheriting form it, I suggest you look at the io module's classes.
Nontheless, a warning would be helpful, possibly with some doc.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
come up lacking
big-time. It does a good job in a single domain, but try to build
something that crosses domains and nothing works. There isn't a good
alternative in sight
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
the internal wrappers vanish as well. That
makes problems for anyone who is looking through __dict__ to find
particular kinds of method.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
, an instance method
in a class is simply the function object. Static and
class methods require wrappers, but those are both
built-in functions and they also have decorators.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
and similar external build DSLs. You can
see the difference in fluency.
John Roth
Python FIT
--
http://mail.python.org/mailman/listinfo/python-list
amount of confusion. It also seems like it would be most useful in
large, poorly structured methods, which is exactly the wrong way to
go.
Finally, as Gerhard Haring has said, it's backward incompatible, so
the window for considering it has past: the 3.x series is pretty much
frozen.
John Roth
situation, it might be a whole lot easier to extract a common
superclass that both of your classes could inherit from.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
in PEP
3008. PEP 361 not only gives the schedule but it also gives a lot of
detail on 3.0 features backported to 2.6 and incompatible features
that raise warnings in 3.0
PEP 3000, PEP 3100 and PEP 3099 are also well worth reviewing.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
, check and if it has
the method call it with the operands reversed.
Then if it isn't in either, you can look the actual implementation
method up in a table. When all else fails, raise a type error.
HTH
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
/ ) or a note in the
documentation with a caveat that it's not good practice, but it may be
useful in some circumstances.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
dependencies.
Does the following patch has a chance of being introduced in the
standard python distribution?
I certainly hope not!
John Roth
Python FIT
--
http://mail.python.org/mailman/listinfo/python-list
not want to see the
operator be =.
However, if it's not =, then it opens another can of worms, that is,
what to call it, and where it fits into the precedence structure. --
might work.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
: there is no way of determining what
the corresponding string should be.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
the multi-byte form of your characters. You should just send
it a unicode object.
Second, check the .encoding attribute of the sys.stdout object.
Therein lies enlightenment about what the command prompt window will
accept.
No info on your other problem.
John Roth
If anyone has any thoughts
to determine if each piece was actually executed. Turning it
into an if-else construct would do this nicely.
John Roth
--
\Know what I hate most? Rhetorical questions. -- Henry N. Camp |
`\ |
_o__
instrumentation statements. Then I could wallow in data to my
heart's content.
One last little snark: how many of us keep our statement coverage
above 95%? Statement coverage may be the weakest form of coverage, but
it's also the simplest to handle.
John Roth
--
http://mail.python.org/mailman/listinfo
of starting work on converting Python FIT to 3.0, and
then they posted PEP 3137. I think it's a real good idea, but it shows
that 3.0a1 isn't ready for a conversion effort.
http://www.python.org/dev/peps/pep-3137/
I'll look at it again in a year or so.
John Roth
--
http://mail.python.org
for method attributes (those silly @
things), thus showing that unneeded complexity breeds more unneeded
complexity.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
to look for.
Is there anyone know's how to make the interpreter find instance name
space first?
Or any way to make programmer's life easier?
Guido has already said that this will not change in Python 3.0 See PEP
3099.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
.
There are definitely anti-virus products that are that clueless.
Scream at the vendor.
I doubt if it's Idle, but I'm not in the mood to check the code to see
if it's doing it right.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
translate an arbitrary string into a
valid Python identifier would be helpful. It would be even more
helpful if it could provide a way of converting untranslatable
characters. However, I suspect that the translate (normalize?) routine
in the unicode module will do.
John Roth
Phthon FIT
--
http
is (not quite trivially)
easy - just scan the library and put the right coding comment in the
front.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
line: the c-types module was a lot smaller, in Python, and
completely comprehensible. And while I didn't measure the performance,
I doubt if it was slower.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
it separately.
John Roth
-Tony
--
http://mail.python.org/mailman/listinfo/python-list
to the
item that they're annotating. Parenthetically, I'd note that
adding docstring capabilities to properties was a definite
step forward.
John Roth
Thanks for the feedback from everyone so far,
-Tony
--
http://mail.python.org/mailman/listinfo/python-list
is a mandatory tie
to function/method syntax.
Combined with a convention to identify which annotation
belongs to who, it could be a quite useful mechanism.
I, for one, have no difficulty with the notion of using someone
else's annotations if I can identify them unambiguously.
John Roth
Python FIT
--
http
,
utc1,
utc2, utc3, utc4, utc5, utc6, utc7, utc8, utc9, utc10, utc11,
utc12, st1,
st2, st3, st4, st5, st6, numberOfLabels, dataWord
) = struct.unpack(!H4BH20BHI, strMessage)
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
could be passed
to the extension responsible for interpretation of the old
code.
PEP 3099 - Things that will not change in Python 3000 says:
Python will not have programmable syntax.
It seems Guido has made up his mind.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
,
and there will undoubtedly be others. If any of them fly, they'll
probably be folded into the base in a few years, and that will
diminish the ease of use / large project divide between the
two languages.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
clients.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
. It's a strange subject which I don't
know much about, but that should get you
started.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
to something else, which is why the
error message specifies ascii.
John Roth
TIA for any comments.
Luc Saffre
--
http://mail.python.org/mailman/listinfo/python-list
in the next year or so.
John Roth
Python FIT
- Sloan
--
http://mail.python.org/mailman/listinfo/python-list
of writing this is:
if key not in schema.elements:
whatever...
Unless, of course, your code has to run in a
Python release earlier than 2.2. But then you
wouldn't be testing for the False object anyway.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
it this way.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
they put a method named
should directly on object, for good reason.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
to this?
It's more there should be one, and preferably
only one, obvious way to do something.
John Roth
Regards,
antoine
--
http://mail.python.org/mailman/listinfo/python-list
deeper and look at class
methods, static methods, descriptors and
other stuff, it's a bit more complicated, but
not much.
John Roth
Python FIT
--
http://mail.python.org/mailman/listinfo/python-list
in the
Language reference specifies this exactly.
John Roth
--
Antoon Pardon
--
http://mail.python.org/mailman/listinfo/python-list
any reason
to expand the language to support a data base
product that goes out of its way to make it difficult
for developers.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
Saizan wrote:
John Roth wrote:
The not operator and the bool() builtin produce
boolean results. Since bool is a subclass of int,
all the integer operations will remain integer
operations. This was done for backwards
compatability, and is unlikely to change in the 2.x
series.
Ok
the integer operations will remain integer
operations. This was done for backwards
compatability, and is unlikely to change in the 2.x
series.
I don't remember if this is supposed to change
in 3.0. See PEP 3100 and 3099.
John Roth
John Roth
--
http://mail.python.org/mailman/listinfo/python
NO to that one. Unless
Guido changes his mind, and it's very unlikely, the
answer is in PEP 3099: Things that will not change
in Python 3000. It says: The parser won't be more
complex than LL(1). He does not want to start down
the slippery slope that leads to certain unnamed
languages such as Perl.
John Roth
release, but I have my doubts whether that will reduce
the JVM footprint as far as running Jython is concerned.
The intention is to reduce the initial footprint for runing the
JVM under a browser.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
in guessing the file encoding.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
clearer.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
classes
either.
Once I get answers to these questions, I can finish off the last few
bits of the test suite and have it ready for 2.5-final.
Answers? On this list? I'm not even sure you can get
coherent opinions here.
John Roth
Thanks,
Collin Winter
--
http://mail.python.org/mailman
compatable or easily handable by a conversion program.
The change in the raise statement, for example, can
be handled right now.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
interpreted would come through. As it is,
C++
simply isn't in the speed race for _real_ object oriented programs.
I'm not interested enough to follow the current round of the C++
standardization effort. It might be coming, it might not.
John Roth
Alex
--
http://mail.python.org/mailman
in an obfuscated code
contest.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
. I'd call it an
example of pedantry over usability.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
?
Optional static typing is listed as item # 3 in
PEP 3100 (Python 3.0 plans).
For a timeline, look at PEP 3000.
John Roth
Thanks very much,
Christian
--
Christian Convey
Computer Scientist,
Naval Undersea Warfare Centers
Newport, RI
(401) 832-6824
[EMAIL PROTECTED]
--
http://mail.python.org
in the respective module's namespace.
The general rule is: don't do that. It doesn't work, and the
hoops you have to go through to force it to work are so
complex and bizzare that they're not worth it. Redesign
the modules so you don't have cyclic dependencies.
John Roth
--
http://mail.python.org/mailman
.
And that's one example.
I saw the make statement as a breath of fresh air.
Then it got shot down for what were, to me, totally
trivial reasons. That's a second one.
Sigh.
John Roth
Your thoughts please.
Anton
--
http://mail.python.org/mailman/listinfo/python-list
Peter Hansen [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
John Roth wrote:
It's not going to happen because the Python community is fat and happy,
and is not seeing the competition moving up on the outside.
Characteristics
that make a great language one day make a mediocre one
way: use the global() built-in function.)
John Roth
Regards Paolino
--
http://mail.python.org/mailman/listinfo/python-list
Mike Meyer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
John Roth [EMAIL PROTECTED] writes:
However. I see nothing in the existing Python 3000 PEP that does
anything other than inspire a yawn. Sure, it's a bunch of cleanup, and
some of it is definitely needed.
Actually, that's
better idea would be to fix the underlying
situation that makes the global statement necessary.
I doubt if this is going to happen either, though.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
...
Unit testing usually does not require expensive setups and teardowns,
at least if you're not working on real tangled legacy code.
Acceptance testing does.
Meanwhile, there's a book and two web sites: fit.c2.com and
www.fitnesse.org to look at.
John Roth
Python Fit
-- Christoph
--
http
, and that have absolutely nothing to do with the order
in which each elementary test runs.
When your customers keep asking for something, and you
keep telling them that they really don't want what they're
asking for, who's lisening, and who's being stubborn?
John Roth
Python Fit.
--
Björn Lindström [EMAIL
a global foo
statement, while
foo[bar] = spam
doesn't. The dictionary foo isn't rebound, all that's happening
is that its state is being changed (that is, the key and value is
being added to the dictionary).
HTH
John Roth
Chris
--
http://mail.python.org/mailman/listinfo/python-list
a use for
it.
John Roth
Reinhold
--
http://mail.python.org/mailman/listinfo/python-list
,
and nothing has ever come of it. Starting with an object that
actually does something some people want gives the designers a
chance to look at things in the wild.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
Duncan Booth [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
John Roth wrote:
You have to start somewhere. One of the lessons that's beginning
to seep into people's minds is that getting something that works
out there is almost always preferable to (over) design by committee
as a sequence of path elements makes
perfect sense: I need to descend the directory structure, directory
by directory, looking for specific files and types.
John Roth
Daniel
--
http://mail.python.org/mailman/listinfo/python-list
to change where an element on the call stack will
return to.
Don't ask me to debug such a program unless you
really want my unvarnished opinion of such stupidity.
John Roth
Mage
--
http://mail.python.org/mailman/listinfo/python-list
method calls to the process.
John Roth
--
Thomas
--
http://mail.python.org/mailman/listinfo/python-list
you need to loop over the
contents more than once.
I was wondering about what seemed like an ill-concieved rush to
make everything an iterator. Iterators are, of course, useful but there
are times when you really did want a list.
John Roth
Raymond Hettinger
--
http://mail.python.org
as much effect as spitting into the wind.
Making a piece of functionality less convenient simply to
satisfy someone's sense of language esthetics doesn't seem
to me, at least, to be a really good idea.
John Roth
George
--
http://mail.python.org/mailman/listinfo/python-list
1 - 100 of 220 matches
Mail list logo