> Hi everybody,
>
> I need to downcast an object, and I've read repeatedly that if you
> need to downcast, you did something wrong in the design phase. So,
> instead of asking how do you downcast in python, let me explain my
> situation.
>
> I have a 2-pass parser. 1st pass ends up with a bunch o
> Dear Emmanuel,
>
> Thank you for your reply.
> Actually what I want to do is, at the run time I want to know the location
> of a specific directory.
> Then I will add some file name to the path and load the file.
> The directory can reside in any drive, depending on the user.
Well... If you don
> Seebs writes:
> > On 2010-10-13, Chris Rebert wrote:
> > > For future reference, the significant majority of things in Python
> > > raise exceptions upon encountering errors rather than returning
> > > error values of some sort.
> >
> > Yes. I'm getting used to that -- it's a bit of a shift,
> Dear All,
>
> I want to get the absolute path of the Directory I pass explicitly. Like
>
> functionName("\abcd").
> I should pass the name of the directory and the function should search for
> it in the Hard drives and return me the full path of location on the drive.
> I tried using os.path, b
> On Oct 9, 5:41 pm, Stefan Behnel wrote:
> > "Number of characters" sounds like a rather useless measure here.
>
> What I meant by number of characters was the number of edits happened
> between the two versions..Levenshtein distance may be one way for
> this..but I was wondering if difflib coul
> Is it possible to control any webbrowser from Python ? For example to
> issue http POST and GET command
> Thanks
> Johny
http://docs.python.org/library/webbrowser.html
The control you get is rather limited, though. If your aim is interacting with
a website, though, you can try urllib/urllib2
> Matt Nordhoff wrote:
> > BTW: Checked out optparse? It's bigger and sexier!
If you're doing things with positional arguments, you should consider using
argparse (http://argparse.googlecode.com/svn/tags/r101/doc/index.html). It's
like optparse, but (much) better.
Cheers,
Emm
--
http://mail.
> Emmanuel Surleau a écrit :
> >>>>> It still manages to retain flexibility, but you're basically stuck
> >>>>> with Django's ORM
> >>>>
> >>>> You're by no way "stuck" with Django's ORM -
> Emmanuel Surleau a écrit :
> >> Emmanuel Surleau a écrit :
> >>>> Django : very strong integration, excellent documentation and support,
> >>>> huge community, really easy to get started with. And possibly a bit
> >>>> more mature and s
> On Oct 20, 2009, at 4:59 PM, Emmanuel Surleau wrote:
> > Compared to custom tags in, say, Mako? Having to implement a mini-
> > parser for
> > each single tag when you can write a stupid Python function is
> > needless
> > complication.
>
> I like Mako
> Emmanuel Surleau a écrit :
> >> Django : very strong integration, excellent documentation and support,
> >> huge community, really easy to get started with. And possibly a bit more
> >> mature and stable...
> >
> > One strong point in favour of
> Django : very strong integration, excellent documentation and support,
> huge community, really easy to get started with. And possibly a bit more
> mature and stable...
One strong point in favour of Django: it follows Python's philosophy of
"batteries included", and features a large array of pl
On Saturday 22 August 2009 08:13:33 joy99 wrote:
> On Aug 22, 10:53 am, Stefan Behnel wrote:
> > Rami Chowdhury wrote:
> > >> I am using primarily UTF-8 based strings, like Hindi or Bengali. Can I
> > >> use Python to help me in this regard?
> > >
> > > I can say from experience that Python on Win
> >> I am using primarily UTF-8 based strings, like Hindi or Bengali. Can I
> >> use Python to help me in this regard?
> >
> > I can say from experience that Python on Windows (at least, Python 2.5
> > on 32-bit Vista) works perfectly well with UTF-8 files containing
> > Bangla. I have had trouble
> It's a particular unfair criticism because the critic (Ethan Furman)
> appears to have made a knee-jerk reaction. The "some language in Python"
> behaviour he's reacting to is the common idiom:
>
> for i in range(len(seq)):
> do_something_with(seq[i])
>
>
> instead of the "Python in Python" i
> Dr. Phillip M. Feldman wrote:
[snip]
> > def is_prime(n):
> >for j in range(2,n):
> > if (n % j) == 0: return False
> >return True
> >
> > It seems as though Python is actually expanding range(2,n) into a list of
> > numbers, even though this is incredibly wasteful of memory. Ther
On Saturday 01 August 2009 03:46:12 Steven D'Aprano wrote:
> On Fri, 31 Jul 2009 20:41:12 +0200, Emmanuel Surleau wrote:
> >> We don't actually *declare* that something is constant and then have
> >> that declaration ignored. Python doesn't lie to us,
On Friday 31 July 2009 22:10:45 kj wrote:
> I'm pretty new to Python, and I like a lot overall, but I find the
> documentation for Python rather poor, overall.
>
> I'm sure that Python experts don't have this problem: they have
> internalized some good ways to access the documentation, are
> produc
On Friday 31 July 2009 21:55:11 Terry Reedy wrote:
> Emmanuel Surleau wrote:
> >> Beyond the mutable/hashable distinction, there is an important
> >> philosophical distinction articulated by Guido. He deems tuples to
> >> be useful for struct like groupings of non-ho
On Friday 31 July 2009 19:49:04 Raymond Hettinger wrote:
> On Jul 20, 9:27 am, Phillip B Oldham wrote:
> > Specifically the "differences" between lists and tuples have us
> > confused and have caused many "discussions" in the office. We
> > understand that lists are mutable and tuples are not, but
On Friday 31 July 2009 18:54:23 Tim Rowe wrote:
> 2009/7/31 Steven D'Aprano :
> > On Thu, 30 Jul 2009 18:47:04 +0100, Tim Rowe wrote:
> >> That and the fact that I couldn't stop laughing for long enough to learn
> >> any more when I read in the Pragmatic Programmer's Guide that "Ruby,
> >> unlike l
On Friday 31 July 2009 01:06:31 Robert Kern wrote:
> On 2009-07-30 16:44, r wrote:
> > On Jul 30, 4:29 pm, Emmanuel Surleau
> >
> > wrote:
> >>> 1.) No need to use "()" to call a function with no arguments.
> >>> Python --> "obj
> 1.) No need to use "()" to call a function with no arguments.
> Python --> "obj.m2().m3()" --ugly
> Ruby --> "obj.m1.m2.m3" -- sweeet!
> Man, i must admit i really like this, and your code will look so much
> cleaner.
It has benefits - code does look better. It has also significant cons - it
On Friday 24 July 2009 17:14:06 you wrote:
> Hrvoje Niksic writes:
> > The term "variable" is used in the Python language reference and
> > elsewhere
>
> Yes. It should also be abundantly clear from the constant stream of
> confused newbies on this point that its usage of that term is different
>
On Sunday 26 July 2009 00:42:26 Marcus Wanner wrote:
> On 7/25/2009 10:08 AM, Piet van Oostrum wrote:
> >> Steven D'Aprano (SD) wrote:
> >>
> >> SD> Ambiguity essentially boils down to being unable to reasonably
> >> predict SD> the expectation of the coder. I say "reasonably", because if
> >>
On Monday 27 April 2009 05:01:22 Carbon Man wrote:
> I have a program that is generated from a generic process. It's job is to
> check to see whether records (replicated from another system) exist in a
> local table, and if it doesn't, to add them. I have 1 of these programs for
> every table in th
On Saturday 25 April 2009 08:06:30 Carl Banks wrote:
> In answering the recent question by Mark Tarver, I think I finally hit
> on why Lisp programmers are the way they are (in particular, why they
> are often so hostile to the "There should only be one obvious way to
> do it" Zen).
>
> Say you put
On Monday 20 April 2009 10:55:19 Steven D'Aprano wrote:
> On Mon, 20 Apr 2009 08:05:01 +0200, Emmanuel Surleau wrote:
> > On Monday 20 April 2009 01:48:04 Steven D'Aprano wrote:
> >> It also depends on whether you see the length of a data structure as a
> >> p
> >Allowing for procedural-style programming does not mean that a
language
> >does not implement (even imperfectly) an OO paradigm.
>
> "Allowing" is the wrong term here. Python absolutely encourages a
> straightforward procedural style when appropriate; unlike Java, there is
> no attempt to forc
On Monday 20 April 2009 01:48:04 Steven D'Aprano wrote:
> The problem is, I believe, that people wrongly imagine that there is One
> True Way of a language being "object-oriented", and worse, that the OTW
> is the way Java does it. (If it were Smalltalk, they'd at least be able
> to make the argum
> What makes you think Python is "an OO language"?
Python is a dynamic object-oriented programming language that can be used
for many kinds of software development.
First line on the Python official website. Was this a trick question?
> What kind of OO
> language allows you to do this:
>
> def
On Sunday 19 April 2009 21:46:46 Christian Heimes wrote:
> Emmanuel Surleau wrote:
> > First off, it's pretty commonplace in OO languages. Secondly, given the
> > number of methods available for the string objects, it is only natural to
> > assume that dir("a")
> Perhaps in statically typed languages. Python is dynamic, so a x.length()
> requires a method lookup and that's expensive. len(x) on the contrary, can
> be optimized on a case by case basis -- it DOESN'T translate to
> x.__len__() as some might think.
> See
> http://www.python.org/doc/faq/general
On Sunday 19 April 2009 19:37:59 Gabriel Genellina wrote:
> En Sun, 19 Apr 2009 13:43:10 -0300, Emmanuel Surleau
>
> escribió:
> > Exploring the Python standard library, I was surprised to see that
> > several
> > packages (ConfigParser, logging...) use mixed case f
Hi there,
Exploring the Python standard library, I was surprised to see that several
packages (ConfigParser, logging...) use mixed case for methods all over the
place. I assume that they were written back when the Python styling
guidelines were not well-defined.
Given that it's rather irritati
Hi there, Ruby transfuge too.
> Although I'm not 100% new to Python, most of my experience using high-
> level languages is with Ruby. I had a job doing Rails web development
> a little ways back and I really enjoyed it. At my current workplace
> though, we're looking at using Python and I'm tryin
Hi
> > 1) Is there anything like a Python build tool? (Or do I
> > even need something like that?)
>
> If you're going to run the python source code, you don't need anything.
> Python builds what it needs automagically. Some tools exist to build
> stand-alone executables though, if you'd like to do
Howdy,
> I'm python newbie and i need to write gui for my school work in python.
> I need to write it really quick, because i haven't much time .)
> So question is, which of gui toolkits should i pick and learn? I heard
> PyGTK and Glade are best for quick gui programming? Is it good for
> beginne
On Saturday 11 April 2009 18:00:58 John Yeung wrote:
> On Apr 11, 10:08 am, Emmanuel Surleau
>
> wrote:
> > Having written a few trivial scripts in Python, I'm curious as
> > to how you would sum up the Pythonic philosophy of development.
>
> A couple of others h
Hi there,
I'm starting an exploratory foray into Python, being generally dissatisfied
with the Ruby ecosystem (while the language is wonderful, third party
libraries and documentation are not).
Having written a few trivial scripts in Python, I'm curious as to how you
would sum up the Pythonic
On Saturday 04 April 2009 15:37:44 grkunt...@gmail.com wrote:
> I am a Java developer. There, I said it :-).
>
> When I am writing code, I can rely on the compiler to confirm that
> any methods I write will be called with parameters of the "right"
> type. I do not need to test that parameter #1 re
41 matches
Mail list logo