Re: Where do they tech Python officialy ?

2007-07-30 Thread Star
MIT's freshman survey, EECS 1 is taught in Python and Scheme, soon to be 
just Python.


-Star

On Wed, 25 Jul 2007, Bruno Desthuilliers wrote:


Omari Norman a écrit :

On Mon, Jul 23, 2007 at 10:48:10PM -0700, Paul Rubin wrote:



If you're having trouble with Python because you're new at
programming, I can sympathize--I don't think it's the most
beginner-friendly of languages despite the efforts in that direction
by the designers.



Just curious--what language would you recommend as most
beginner-friendly?


C ?-)

(sorry, just kidding.)


My previous programming experience was with BASIC--and I think it is
true that BASIC will, in many ways, rot your brain.


So will Java.

I learned programming with Hypertalk (MacIntosh's Hypercard scripting
language, which more or less gave birth to AppleTalk), then RealBasic
(Mac's Better VB-like), then VB, then Java, then C, then bits of Pascal,
then Python, and this is where I started to see the light. But I had
hard time unlearning all those java-ish anal-retentive stupidities and
arbitrary overcomplexifications before I really enjoyed Python. Playing
with Lisp (Common Lisp and Scheme) and Smalltalk helped getting rid of
mental pollution wrt/ declarative static typing. To be honest, playing
with Haskell and O'Caml also helped me understanding that static typing
is not necessarily bad by itself.


I had used QBasic
and, later, a little VBA and some PHP. It took some time to unlearn some
bad things (object orientation in VBA seems to be mostly a hack, for
example, while PHP seems to be a big hack generally)


Well... this is not exactly a scoop !-)


but it seems to me
that Python helped me learn my first modern programming language.



I think Python is not used in university programs very much.  Look for
one that uses SICP (Scheme) or CTM (Mozart/Oz) or a functional
language like Haskell, in preference to the ones that use Java (the
Cobol of the 1990's).  With some reasonable experience in Scheme or
Mozart or Haskell, plus a Python manual, you'll be well on your way.



I had heard of these languages, but learning them is a bit discouraging
because (Java excepted) they don't seem to get much practical use.


Before considering practical use (FWIW, Python was pretty far from
mainstream 7 year ago), you should ask yourself how learning one of
these languages will affect the way you thing about programming. While
mostly in the imperative/OO camp, Python stole quite a lot from
functional languages, and this is obviously a GoodThing(tm).

My 2 cents
--
http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list

Python Training in Bangalore

2018-06-19 Thread sandy star
 Python Training in Bangalore Best Python Training Courses in Bangalore –  
Marathahalli, BTM Layout, Rajajinagar & Jaya Nagar. We train the students from 
basic level to advanced concepts with a real-time environment. We are the Best 
Python Training Institute in bangalore.


URL : 
https://www.besanttechnologies.com/training-courses/python-training-institute-in-bangalore
-- 
https://mail.python.org/mailman/listinfo/python-list


Python Training in Chennai

2018-07-17 Thread sandy star
Python Training in Chennai with expert guidance and fully hands-on classes. 
Python is a high-level programming language sometimes it also denoted as the 
scripting language as it provides rapid & fast development and easy of use.

url : 
https://www.besanttechnologies.com/training-courses/python-training-institute-in-chennai
-- 
https://mail.python.org/mailman/listinfo/python-list


Python 32 bit error

2015-10-26 Thread Joshua Star
I am running a 32 bit computer, (Windows XP) and when I finish with the 
installer program, I try to run either of the two executable files that are put 
on my computer and they both come up with the message "python.exe is not a 
valid Win32 application"

Also, in the installer program, some of the buttons are invisible.

>From Joshua.-- 
https://mail.python.org/mailman/listinfo/python-list


Re: wxPython vs. Tkinter event loops

2007-07-11 Thread star . public
On Jul 11, 11:17 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote:

> No again. wxPython provides a Process class for executing external
> applications and providing events in response to input, app exit, and
> similar. You can also implement it in a similar way to your Tkinter
> implementation, but backwards - poll the pipe repeatedly using
> wx.CallAfter or wx.CallLater calls.

You can also set up a callback on the idle event and do a little
processing every time it's called, though that can be odd because it
tends to e.g. update more often when the mouse is moving over the
window and such. There may be other ways, too, I don't have access to
my docs or the demo here (just poked my head in because I'm waiting
for my work program to stop being frozen ...).

-Weaver

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: New guy help with setup

2007-07-12 Thread star . public
On Jul 12, 5:55 pm, meg99 <[EMAIL PROTECTED]> wrote:

> got the >>> prompt


Type fun things at the >>> prompt, such as:

>>> print 'Some Obligatroy Greeting Like "Hello World."'

or

>>> [x*5 for x in [1,2,3,4,5]]

or

>>> import os
>>> os.listdir('.')
>>> [os.isdir(x) for x in os.listdir('.')]

Also, you should now be able to make .py files in a text editor and
run them by double-clicking them. (Hint: If you're just doing print
statements and such, stick a raw_input() at the end of the file so
that the window stays around when you double-click it ...)

But all in all, the .configrue[1] stuff is only for unix-like systems
and stuff like cygwin, windows dosn't usally need to worry about it.

[1] I saw this typo, then decided to leave it as some kind of scary
obscure bad zork pun thing.

--
Weaver

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pass by reference or by value?

2007-07-13 Thread star . public
On Jul 13, 3:10 pm, Robert Dailey <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I noticed in Python all function parameters seem to be passed by
> reference. ... [And later otherwise, etc, snip]

Heya. Go read through the thread from yesterday, title starts with
"Understanding Python Functions" -- they go through the whole pass by
object, mutable vs immutable stuff pretty well in there.

Short possibly bad version: Assigning (inclding to a function var)
makes a new name for an object, reassigning (x=...) only changes what
the indvidual name (x) means, but changing the object itself
(x[n]=..., x.n=..., etc) affects anything that has a name for that
object. Names are names, not variables.

--
Weaver[0]=Star

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Fetching a clean copy of a changing web page

2007-07-17 Thread star . public
On Jul 16, 4:50 am, Stefan Behnel <[EMAIL PROTECTED]> wrote:
> Diez B. Roggisch wrote:
> > John Nagle wrote:
> >>I'm reading the PhishTank XML file of active phishing sites,
> >> at "http://data.phishtank.com/data/online-valid/";  This changes
> >> frequently, and it's big (about 10MB right now) and on a busy server.
> >> So once in a while I get a bogus copy of the file because the file
> >> was rewritten while being sent by the server.
>
> >>Any good way to deal with this, short of reading it twice
> >> and comparing?
>
> > Apart from that - the only thing you could try is to apply a SAX parser
> > on the input stream immediatly, so that at least if the XML is non-valid
> > because of the way they serve it you get to that ASAP.
>
> Sure, if you want to use lxml.etree, you can pass the URL right into
> etree.parse() and it will throw an exception if parsing from the URL fails to
> yield a well-formed document.
>
> http://codespeak.net/lxml/http://codespeak.net/lxml/dev/parsing.html
>
> BTW, parsing and serialising it back to a string is most likely dominated by
> the time it takes to transfer the document over the network, so it will not be
> much slower than reading it using urlopen() and the like.
>
> Stefan

xml.etree.ElementTree is in the standard lib now, too. Also,
xml.etree.cElementTree, which has the same interface but is blindingly
fast. (I'm working on a program which needs to read/recreate the
(badly designed, horrible, evil) iTunes Library XML, of which mine is
about 10mb, and cEtree parses it in under a second and 60mb of ram
(whearas minidom takes like two minutes and 600+mb to do the same
thing).)

(I mean really -- the playlists are stored as five megs of lists with
elements that are dictionaries of one element, all looking exactly
like this: \nTrack ID4521\n
\n --- )

--
star

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: In a dynamic language, why % operator asks user for type info?

2007-07-17 Thread star . public
On Jul 17, 2:19 am, Paddy <[EMAIL PROTECTED]> wrote:
> On Jul 17, 1:10 am, Karthik Gurusamy <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Hi,
>
> > The string format operator, %, provides a functionality similar to the
> > snprintf function in C. In C, the function does not know the type of
> > each of the argument and hence relies on the embedded %
> > specifier to guide itself while retrieving args.
>
> > In python, the language already provides ways to know the type of an
> > object.
>
> > So in
>
> > output = '%d foo %d bar" % (foo_count, bar_count),
> > why we need to use %d? I'm thinking some general common placeholder,
> > say %x (currently it's hex..) could be used.
>
> > output = '%x foo %x bar" % (foo_count, bar_count).
> > Since % by definition is string formatting, the operator should be
> > able to infer how to convert each of the argument into strings.
>
> > If the above is the case, we could've avoided all those exceptions
> > that happen when a %d is specified but say a string is passed.
>
> > Thanks,
> > Karthik
>
> '%s' might be what your after as a more 'general purpose' moifier.
>
> - Paddy.- Hide quoted text -
>
> - Show quoted text -

It is good for that; I generally use %s until I decide that something
needs picky formatting.

--
a = '%s Weaver' % random.choice(['Lani','Star','Azure'])
a += 'is strange.'

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: From D

2007-07-25 Thread star . public
On Jul 25, 1:22 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> So, spaces will no longer be delimiters? Won't that cause
> much wailing and gnashing of teeth?
>

I can't think of a circumstance in which

48 1906

is valid, so . . .

I like it, too :)

--
Star Weaver

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Imported globals?

2007-07-27 Thread star . public
On Jul 27, 1:30 pm, Valentina Vaneeva <[EMAIL PROTECTED]> wrote:

> Thank you, Gary, but I still have one question. What happens in the
> second case? If I add a call to change_value() to module_a, the value
> in module_b is imported changed. Why? What exactly does the import
> statement import in my example?

Because then by the time you import the thing, that action has been
carried out. Consider:

from module_a import change_value
change_value()
from module a import value
print value

It's not significantly different from this:

-
class NotaModule(object):
  pass

nota = NotaModule()
nota.a = 1

def change_it():
  global nota # not even sure you need this
  nota.a = 2

a = nota.a
change_it()
print a, nota.a
--

Modules and (singleton) objects are rather similar from the outside,
afaik.

Also consider that this is yet another case where if value or A was a
list and you appended to it, both prints would show the change,
mutable objects, etc.

--
Tired Weaver

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to write GUI and event separately in wxPython??

2007-07-30 Thread star . public
On Jul 30, 11:42 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote:

> > > On Mon, 30 Jul 2007 06:32:55 -0400, Steve Holden wrote:
>
> > >>  >>> [x for x in xrange(0, 101)] == [y for y in xrange(101)]
> > >> True

> nitpick: list(xrange(42)) == list(xrange(42)) is slightly more concise
> than the list comp..

Not that it has anything to do with this topic anymore, but I find the
list comp a bit clearer for expressing the thought 'each element in
one is the same as the coresponding element in the other, or: the
sequences are identical' -- the list() version would proabably have
had me going 'huh?' even longer ^_^.
--
[star for star in weaver]



-- 
http://mail.python.org/mailman/listinfo/python-list


OOP / language design question

2006-04-25 Thread cctv . star
I was wondering, why you always have to remember to call bases'
constructors explicitly from the derived class constructor? Why hasn't
this been enforced by the language?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OOP / language design question

2006-04-25 Thread cctv . star
Diez B. Roggisch wrote:
> I have another question for you: why does JAVA enforce that a constructor of
> a base-class must be called prior to everything else in the derived class's
> constructor?
Well, I can imagine it's done to make sure that the base(s) are
properly constructed. Sound s sensible to me.

> No way to do some computing for parameters that I want to pass
> to the parent constructor...

Try this:

Derived::Dreived() : Base(calcParam1(), calcParam2())
...

> Besides, this automatically base-constructor-calling only happens for the
> most trivial of cases - the no-argument-constructors.

Well, the language can at least ensure that theconstructor is called -
i.e. either call it automatically if it can be called without
parameters, or fail with error.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OOP / language design question

2006-04-25 Thread cctv . star

Heiko Wundram wrote:
> Because sometimes you don't want to call the base classes constructors?
Sounds strange to me at the moment, but I'll try to adjust to this
thought.

> Python zen says: "Better explicit than implicit," and in this case it hits
> the nail on the head. Better to see right away what your code does (the
> explicit call to the base class), than to have to work around calling a bases
> constructor if you don't want to call it.
Thanks, that explains it somehow - at least, it's consistent with
explicit "self".
I think I'll need some shift in thinking after C++.

-- 
http://mail.python.org/mailman/listinfo/python-list


A way to convert RTF to HTML?

2009-12-27 Thread Star Glider
Hi,

I'm converting an application to Python/PyQt, one of the tasks is to
retrive data from a database and show it, no problem,
the problem is that the one of the fields as text in rich text format,
and it needs to be display without the RTF markup, of course.
Is there any way to convert RTF to HTML?

Thank you in advance.
-- 
http://mail.python.org/mailman/listinfo/python-list