Steven D'Aprano wrote:
> On Wed, 05 Apr 2006 16:15:12 +0200, Georg Brandl wrote:
>
>> [EMAIL PROTECTED] wrote:
>>> hi John,
>>> Python doesn't provide for loop like C / C++ but using Range() or
>>> Xrange() you can achive all the functionaliti
ted bytecodes to
> answer questions like this one. I want to be cool too. Where can I find
> information about how to get a bytecodes listing for my compiled Python?
The "dis" module.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
2, 3, 4]
>>> xrange(5)
xrange(5)
>>>
range is giving you a real list, while xrange is giving you an xrange object.
Have you tried to slice an xrange object? Or using .append on it?
Georg
--
http://mail.python.org/mailman/listinfo/python-list
Alan Morgan wrote:
>>range is giving you a real list, while xrange is giving you an xrange object.
>>Have you tried to slice an xrange object? Or using .append on it?
>
> No, I hadn't. I presume these could all be defined.
How would xrange(100).remove(1) work?
Georg
--
t I've missed ?
class C():
is meant to be synonymous with
class C:
and therefore cannot create a new-style class.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
Peter Hansen wrote:
> Georg Brandl wrote:
>> class C():
>>
>> is meant to be synonymous with
>>
>> class C:
>>
>> and therefore cannot create a new-style class.
>
> I think "looping" understands that, but is basically asking why any
looping wrote:
> Peter Hansen wrote:
>> Georg Brandl wrote:
>> > class C():
>> >
>> > is meant to be synonymous with
>> >
>> > class C:
>> >
>> > and therefore cannot create a new-style class.
>>
>> I think &
x.title();
> print x;
> Here'S My Title!
>
> Notice the capitalization -- "Here'S".
> Any feedback on this issue is much appreciated.
str.title() isn't very sophisticated. It can't really make a difference
between an apostroph and a single quote.
If yo
x27;s also one in the Python Cookbook, at
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/438823
HTH,
Georg
--
http://mail.python.org/mailman/listinfo/python-list
7;d still like to
> read a description of what to do, if one exists somewhere (can't find
> one at all, though), but at this point I'd be happy with the next URL so
> I can just move on. I've been stagnating for a few days and I need to
> use Python again! :)
Have y
John Salerno wrote:
> Georg Brandl wrote:
>
>> Have you found the file? You'll have to distribute that file bytewise
>> in 5 "piles".
>
> No, I haven't figured out anything for this puzzle. It seems I might
> have to change the filename of the im
John Salerno wrote:
> Just wrote:
>> In article <[EMAIL PROTECTED]>,
>> John Salerno <[EMAIL PROTECTED]> wrote:
>>
>>> Georg Brandl wrote:
>>>
>>>> Have you found the file? You'll have to distribute that file bytewise
>>&
e best
>> examples from this thread and turn it into a PEP?
>
> What are the usual arguments against adding it?
That there should be one obvious way to do it.
Yes, I know that it can be debated whether "del x[:]" is obvious, and
fortunately I'm not the one to decide .
wing what the 'data'
> is I need to move on to the next step of the puzzle. I now have 3
> images, along with gfx file.
The images are perfect images, so there are chances there's no additional data
hidden in them.
The gfx file, however, isn't viewable yet. Hint, hint ;)
Georg
--
http://mail.python.org/mailman/listinfo/python-list
list or clear it completely' would be a good change for 3.1.4.
I added two examples of clearing a list to the section about slice assignment
and del.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
e found at:
http://docs.python.org/3.2/
Please consider trying Python 3.2 with your code and reporting any bugs
you may notice to:
http://bugs.python.org/
Enjoy!
- --
Georg Brandl, Release Manager
georg at python.org
(on behalf of the entire python-dev team and 3.2's contributors)
g/
Enjoy!
- --
Georg Brandl, Release Manager
georg at python.org
(on behalf of the entire python-dev team and 3.2's contributors)
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.16 (GNU/Linux)
iEYEARECAAYFAkz9WcgACgkQN9GcIYhpnLBRYwCeMmH1GMmKOx9fVk8a/F0/TOzj
Vp0AoIHYBNcxV/U0AXIwMGWFHi1bAB+a
=KB
g/
Enjoy!
- --
Georg Brandl, Release Manager
georg at python.org
(on behalf of the entire python-dev team and 3.2's contributors)
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
iEYEARECAAYFAk0Q/aAACgkQN9GcIYhpnLDf8gCgkLGAsE+T3R505jZc1RxXDYsa
NSsAnRGaFjeTm9o2Z5O8FuIzTUG8t1PT
=hH
der trying Python 3.2 with your code and reporting any bugs
you may notice to:
http://bugs.python.org/
Enjoy!
- --
Georg Brandl, Release Manager
georg at python.org
(on behalf of the entire python-dev team and 3.2's contributors)
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.
der trying Python 3.2 with your code and reporting any bugs
you may notice to:
http://bugs.python.org/
Enjoy!
- --
Georg Brandl, Release Manager
georg at python.org
(on behalf of the entire python-dev team and 3.2's contributors)
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.
ing Python 3.2 with your code and reporting any bugs
you may notice to:
http://bugs.python.org/
Enjoy!
- --
Georg Brandl, Release Manager
georg at python.org
(on behalf of the entire python-dev team and 3.2's contributors)
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.
notice to:
http://bugs.python.org/
Enjoy!
- --
Georg Brandl, Release Manager
georg at python.org
(on behalf of the entire python-dev team and 3.2's contributors)
--
http://mail.python.org/mailman/listinfo/python-list
r code and reporting any bugs
you may notice to:
http://bugs.python.org/
Enjoy!
- --
Georg Brandl, Release Manager
georg at python.org
(on behalf of the entire python-dev team and 3.2's contributors)
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.
python.org/3.2/
Please consider trying Python 3.2 with your code and reporting any bugs
you may notice to:
http://bugs.python.org/
Enjoy!
- --
Georg Brandl, Release Manager
georg at python.org
(on behalf of the entire python-dev team and 3.2's contributors)
-BEGIN PGP SIGNATURE-
http://docs.python.org/3.2/
Please consider trying Python 3.2 with your code and reporting any bugs
you may notice to:
http://bugs.python.org/
Enjoy!
- --
Georg Brandl, Release Manager
georg at python.org
(on behalf of the entire python-dev team and 3.2's contributors)
-BEGI
maths of a problem completely unambiguously.
TIA
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
far(i)
Highlighting tends to break starting from `else', and indentation breaks
at the second or third level.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 8 Apr 2011 05:22:01 -0700 (PDT), Jim
wrote:
: On Apr 7, 2:09 pm, Hans Georg Schaathun wrote:
: > Has anyone found a good system for literate programming in python?
:
: Are you aware of pyweb http://sourceforge.net/projects/pywebtool/ ?
Interesting tool, but it solves only part
ight
code and markup programming concepts (methods/classes/variables)?
If I may ask ...
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
What features?
Standardised and well thought-out markup for functions/methods/classes etc.,
as well as highlighting.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
rmance is much better for apples, as I do not waste any time
peeling. For similar reasons, I get much better performance out of
python than I get with Java ...
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
, the bottleneck is likely to be deeply embedded in some
library like numpy or scipy already.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
only one of which I am root.) Thus, the standard solution
of binding to whatever socket.gethostname() returns does not work.
Has anyone found a simple solution that can be administered without
root privileges? I mean simpler than passing the ip address
manually :-)
TIA
--
:-- Hans Georg
--
http
was not mentioned in the tutorial I used ...
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 25 Apr 2011 21:14:51 +0100, Hans Georg Schaathun
wrote:
: : The way you talk of "the" external interface, I'm assuming this
: : computer has only one. Is there a reason for not simply binding to
: : INADDR_ANY aka 0.0.0.0?
:
: Ah. That's what I really wante
he lack of detail.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
Now,
understanding the parallelisable subproblems better, I could try again,
if I can trust that these libraries can robustly handle lost clients.
That I don't know if I can.
Any ideas?
TIA
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
stood even by readers with no experience
with python.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
I get the
client/server parallellisation working, I shall be able to reuse it at
negligible cost on other subproblems, whereas the profiling and C
reimplementation would cost almost as much time for every subsystem.
Does that answer your question, Chris?
--
:-- Hans Georg
--
http://mail.python.org
On Tue, 26 Apr 2011 13:37:40 -0700, Ethan Furman
wrote:
: 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 wa
new, massively more
sophisticated MPI library around now, I would certainly have to
do my own code to cope with lost clients.
Hadoop sounds intresting. I had encountered it before, but did not
think about it. However, the liveCD is clearly not an option. Thanks
for the tip; I'll read u
remembering for any fully-funded project in the future.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
regular ping messages from the client.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 27 Apr 2011 23:35:06 +1000, Chris Angelico
wrote:
: On Wed, Apr 27, 2011 at 10:21 PM, Hans Georg Schaathun
: wrote:
: > That's correct. And the client initiates the connection. At the
: > moment, I use one thread per connection, and don't really want to
:
is that it works, so why change it?
But, I am aware that some more technical adept programmers think
otherwise, and I am quite happy with that :-)
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
loosing the version history would ...
I am particularly interested in git, not because of any qualities it
may have but because that's what my colleague pushes, and he seems
to be pushing our students into it, so it would be useful for me to be
familiar with it.
--
:-- Hans Georg
--
then push changesets back
: up when they have a patch they're happy with.
I am not sure I get the implications right. Are you suggesting that
I could keep my svn server, switch to a DVCS client, and reap the
benefits?
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
true nightmare when directories
are involved. The rumour is that git handles this much better.
I call it a rumour not because I doubt it (I don't), but because
I have not seen for myself.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
re efficient in being O(n) whereas OP had
(I think) O(2^n), but that's not a property of iteration. You can
make a recursive implementation which is O(n). Any undergraduate
textbook teaching recursion in any depth is likely to give it as an
example; see e.g. Simon Thompson's Haskell
late. You need time to learn the thinking.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
nt it without
recursion within python.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
winding of the recursion to a
: loop, but the code is typically less clear.
Sure. And you have to live with your less clear code when you maintain
the system later.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
would think that if you can fit the data in memory,
then you can also fit the call stack. I can also /imagine/ that one
might run into a limit, but I cannot see any concrete examples where
it is likely.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
sly, since it measures the number of items on the
stack and not their size.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
than because the recursion gets to deep. Consequently, because recursion
is usually a clearer form of expression than iterative loops, recursion
may actually be /less/ dangerous.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
nto python
without further ado. In order to express the one-liner in python,
as iteration, you need to introduce additional elements, namely
a state (index variable). Hence, recursion is clearer by being
close to the language you would normally use to describe the
problem.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
e same page.
And it is becoming increasingly clear how bizarre this discussion is in
a python context. The overhead which may be caused by recursion in
hardware is only one of many sources of overhead which one accepts when
opting to use python in order to gain other benefits.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
se cases as you do.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
o leave for the compiler.
:and 3) Python has a better way to
: process collections that removes essentially all the boilerplate in the
: recursive-call and while-loop versions:
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
t it is not an issue. Sometimes it isn't,
but sometimes it is.
The other arguments are valid. And they make me lean more towards
more static, compiled languages without the excessive run-time
dynamism of python.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
language for you.
It isn't the trade-off per se which bothers me, but certain features
which seem to make compilation harder without making development any
easier.
But then, it probably depeds on what kind of development you are doing.
--
:-- Hans Georg
--
http://mail.python.org/mailman/
#x27;ll produce better code. THAT is what distinguishes the
: master from the novice.
That depends on /what/ your career is, and what you need to master.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
t my hand around exactly what this means:
Simula has three ways of transmitting arguments, namely transmission
by name, by value, and by reference. Is transmission by name the same
as call by object? Anyway, I have never seen anyone counting more than
three ways of doing this ...
--
:-- Hans
n different ways.
Whether you use C or Simula, transmission by reference, that is what
python appears to be doing, seems to be the normal approach for any
composite data type. Thus python does not seem to do anything out of
the ordinary at all.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
l mutually exclusive though.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
sharing in Wikipedia. What Wikipedia
calls call by reference is transmission by name in the Simula context.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
inking in this model for years. Maybe
: I'm brainwashed. :)
You are. You explain Python in terms of C. That's useful when you
talk to other speakers of C.
If you want to explain the language to a broader audience, you should
use terminology from the language's own level of abst
make sense. And pass-by-value where the value
is a reference is just confusing.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
table.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
lid for that one
interpreter.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 04 May 2011 14:33:34 -0500, harrismh777
wrote:
: Hans Georg Schaathun wrote:
: > In C it is pass by value, as the pointer
: > is explicit and do whatever you want with the pointer value.
:
: You clearly are not a C programmer.
I am not really a programmer period. I am many
e, this is useful as /one/ way to consider python variables.
As long as one is aware that this is just an example, one approach out
of many, then it enhances understanding. If one blindly extrapolates
from one implementation, it enhances misunderstanding.
--
:-- Hans Georg
--
http://mail.python.o
function.
Well, call-by-name is not the same as transmission by name either.
Transmission by name is what most posters here call call by
reference, and transmission by reference is what this thread calls
object sharing or call by object.
No wonder I started off confused :-) It is better now.
--
the better result, but
relying on human input when the work can be automated is ridiculously
expensive.
Now, python is only one level above C in abstraction, but that's a
different matter.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 04 May 2011 20:11:02 -0500, harrismh777
wrote:
: A reference is a pointer (an address).
:
: A value is memory (not an address).
Sure, and pointers (from a hardware or C perspective) are memory,
hence pointers are values.
--
:-- Hans Georg
--
http://mail.python.org/mailman
You cannot reference nor manipulate a
reference in python, and that IMHO makes them more abstract.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
ned by the languagedefined by the
language.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
7;t perfect, is that it creates the illusion
that references are boxes (objects) just like data objects, leading
the reader to think that we could have a reference to a reference.
If they are all boxes, by can't we make reference thereto?
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
text.
Analogies, even imperfect ones, are good when we are clear about the
fact that they are analogies. Using C pointers to illustrate how to
use bound names in python may be useful, but only if we are clear about
the fact that it is an analogy and do not pretend that it explains it in
full.
--
:-- Hans
and
the information could be passed through the return value instead.
Exceptions is a very flexible, but also rather expensive means of
communications. You can, actually, write any program using raise
instead of return. That would be overuse.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinf
don't
have universal meanings.
:-)
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
types (as in
haskell or ada)?
I think there are too many meanings and too few words ...
That's why some languages support overloading.
I am afraid we just need to cope with it, overloading I mean.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
st painful.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
alls may be circular or otherwise convolved
in a way that does not allow consistent sorting of caller before/after
callee.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
and
much more flexible. Just x is as generic as it gets, but depends
on python's convolved rules for duck processing and if you aim at
legibility it is better avoided.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
of an arbitrary object as a boolean
is peculiar for python. An empty list is a real, existing object, and
the supposition that [] be false is counter-intuitive. It can be
learnt, and the shorthand may be powerful when it is, but it will
confuse many readers.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
oping ideas in a large
and complex community, where perfect universal mastery of one language
is not an option, because half the community do not normally use that
language or aren't really programmers at all. The less you assume about
the skill of the reader, the better it is.
--
:-- Hans Geor
amming.
The audience I am concerned about is the ones who are over-educated
into using and having used a score of different meanings of the same
symbols. They will be used to their intuition being wrong when they
move into a new context. Being explicit will help them.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
reader and not the writer.
What could elif mean other than else: if?
if x could, for instance, mean "if x is defined".
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
needs to see your program is a python
programmer, then your approach works as well as mine.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
knows how the computation has to be done
without specialising in talking to the computer.
: This discussion is giving me some insight into some of the crap
: programming I see these days.
I wonder if you would do a better job at programming the software
to crack equations from quantum physics th
ing theory is reading this? I better dumb it down."
That depends on the purpose of that particular paper, but the real
question is, who writes the software to test that string theory
empirically? Please tell.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
ntial, one would simply not be able to keep up with
the application discipline.
If all you do is to write software for computer illiterate users, YMWV.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
ndeed, so why don't we exploit the revolution
and write the programs to be as accessible as possible?
(Although, python is not the most revolutionary in this respect.)
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 11 May 2011 10:31:59 -0600, Ian Kelly
wrote:
: (x + 3 for x in xs if x % 2 == 1)
Interesting. Thanks. That might come in handy some time.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
: I may not have made the point well, but I cannot see any advantage
: for trying to program for the lowest common denominator.
Common to what? I'd try the lowest common denominator of
legibility and effictiveness.
It is just KISS.
--
:-- Hans Georg
--
http://mail.python.org/mailma
tion or is expected to learn enough Python to understand it.
That's fair enough. You know your code, so it is probably true.
It would not be true for the code I am writing.
--
:-- Hans Georg
--
http://mail.python.org/mailman/listinfo/python-list
t oriented programming is to bestow the
objects with properties reflecting known properties from the
domain being modelled. Lists do not have truth values in the
application domain, and therefore truth values in the
implementation domain is complicated.
--
:-- Hans Georg
--
http://mail.python.o
stitute functional/logical/whatever for imperative.
You would not be completely clueless moving to
ada/fortran/C/pascal/simula. There may be new concepts,
and some concepts which must be adapted to another level of
abstraction, but you do have a clue about the core concepts.
--
:-- Hans Georg
--
On 11 May 2011 21:47:27 GMT, Steven D'Aprano
wrote:
: On Wed, 11 May 2011 20:13:35 +0100, Hans Georg Schaathun wrote:
: > One principle of object oriented programming is to bestow the objects
: > with properties reflecting known properties from the domain being
: > modelled. Lis
301 - 400 of 459 matches
Mail list logo