Intermediate Python user needed help

  • Thread starter John Mordecai Dildy
  • Start date
J

John Mordecai Dildy

Im using Textwrangler and thats the only text editor that im using just saying for everyone
 
R

Roy Smith

Tim Chase said:
"start-point" is not a valid identifier as the "-" isn't permitted
in a variable name. This is the case for just about every language
out there. HTML/XML & CSS are the only languages that come to my
mind in which the dash is considered a valid part of an identifier.

You either mean something like "start_point" (with an underscore
instead of a minus), or you're performing a subtraction of "start
minus point", in which case you'd have to assign those values before
you use them.

Or he meant to pass an optional parameter:

beans, jars, crates = secret_formula(start=point)

or an element access:

beans, jars, crates = secret_formula(start.point)

or a bunch of other possibilities.
 
M

Mark Lawrence

Or he meant to pass an optional parameter:

beans, jars, crates = secret_formula(start=point)

or an element access:

beans, jars, crates = secret_formula(start.point)

or a bunch of other possibilities.

Like it, marks out of 10, 15 :)
 
T

Tim Chase

since when did we start talking about lisp?

Though not a lisper, the Python tie-in was my reply: Python (among
many other languages) doesn't allow a "-" as a character in
identifiers as you appeared to use it in your code. Unlike HTML,
XML, CSS, and apparently lisp and COBOL (thanks, MRAB, for ripping
open that scab after years of trying to repress those COBOL memories
:) where identifiers may contain the dash.

-tkc
 
T

Tim Chase

Or he meant to pass an optional parameter:

beans, jars, crates = secret_formula(start=point)

or an element access:

beans, jars, crates = secret_formula(start.point)

Or pass a boolean

beans, jars, crates = secret_formula(start>point)

Or subscript with an also-missing close-bracket

beans, jars, crates = secret_formula(start[point])

Or call a function with an also-missing close-paren

beans, jars, crates = secret_formula(start(point))

Or it was just a finger-flub

beans, jars, crates = secret_formula(startpoint)

:)

-tkc
 
R

Roy Smith

Tim Chase said:
Though not a lisper, the Python tie-in was my reply: Python (among
many other languages) doesn't allow a "-" as a character in
identifiers as you appeared to use it in your code. Unlike HTML,
XML, CSS, and apparently lisp and COBOL (thanks, MRAB, for ripping
open that scab after years of trying to repress those COBOL memories
:) where identifiers may contain the dash.

-tkc

Does BNF count as a language?
 
S

Steven D'Aprano

Though not a lisper, the Python tie-in was my reply: Python (among many
other languages) doesn't allow a "-" as a character in identifiers as
you appeared to use it in your code. Unlike HTML, XML, CSS, and
apparently lisp and COBOL (thanks, MRAB, for ripping open that scab
after years of trying to repress those COBOL memories :) where
identifiers may contain the dash.

And Forth.

Generally speaking, concatenative languages like Forth can use any
symbols they wish in identifiers, apart from the token separator (usually
whitespace), since they don't have syntax as we know it in more
traditional languages.

E.g. in Forth : is the word (command) to start defining a new word, but
this does not stop you from defining a word called ::: or "foo:bar" (with
or without the quotes!).
 
A

alex23

Im using Textwrangler and thats the only text editor that im using just saying for everyone

Why bother using an actual development tool when you can get an entire
mailing list to be your syntax checker, right?
 
E

Ethan Furman

John said:
I am currently using python 2.6 and am not going to install the newer versions of python and i am looking for people that are still using ver 2.6 in python to help with with the code line:

sentence = "All good things come to those who wait."

then im getting this error message when i dont see the problem with it:

File "ex26.py", line 77
sentence = "All good things come to those who wait."
^
SyntaxError: invalid syntax
Current Problem at the moment

Traceback (most recent call last):
File "ex26.py", line 66, in <module>
beans, jars, crates = secret_formula(start-point)
NameError: name 'start' is not defined

anyone know how to make start defined

In your subject line you state that you are an intermediate Python user.
These are not the errors an intermediate user would make, nor the
questions an intermediate user would ask. These are the errors that
somebody who doesn't know Python would make.

Please do not misrepresent yourself.

~Ethan~

P.S. The scale I am accustomed to is Novice -> Intermediate -> Advanced
-> Master

Are there scales out there that would put these types of questions in
the "intermediate" category?
 
A

Alec Taylor

In your subject line you state that you are an intermediate Python user.
These are not the errors an intermediate user would make, nor the questions
an intermediate user would ask. These are the errors that somebody who
doesn't know Python would make.

Please do not misrepresent yourself. +1


~Ethan~

P.S. The scale I am accustomed to is Novice -> Intermediate -> Advanced ->
Master

What, no n00b before Novice?

:p
 
J

Jean-Michel Pichavant

Ethan said:
~Ethan~

P.S. The scale I am accustomed to is Novice -> Intermediate ->
Advanced -> Master

Are there scales out there that would put these types of questions in
the "intermediate" category?
Troll -> Novice -> Intermediate -> Advanced

Trolls are quite specific, they're able to spread over all upper
levels, in disguise.

:eek:)

JM
 
D

Dennis Lee Bieber

Are there scales out there that would put these types of questions in
the "intermediate" category?

"Never seen it" vs "Job Hunter Resume" <G>

{feel free to skip the rest, it's more of an autobiography}

I always hate trying to estimate my skill level with a language.
I've been using Python -- mostly for one-of quick&dirty jobs -- since
the first edition of Programming Python. My first real program (within a
week of obtaining the book and installing Python on my Amiga) was an
outgoing SMTPd with an ARexx script as the spooler from AmigaELM (The
first outgoing SMTPd I used was from the days before "ISP Relay only",
and generated an outgoing message for each target domain, and would
connect directly to that domain -- which failed when the target had no
SMTPd to receive mail, and blocked the outgoing queue as it kept
retrying; the second program used ISP Relay BUT failed to handshake
using the addresses in CC and BCC headers [and left the BCC header line
IN the sent messages]). I've written some nasty file handling code to
populate an SQLite3 database... I've written one program using
Tkinter/PMW to allow users to select a Clearcase configuration and push
the selected NetAcquire DLLs to a collection of machines, then reboot
the machines...

But I've never written a "decorator", or a meta-class... I
understand the impact of the GIL on threaded code (I/O bound - good, CPU
bound - bad).

So am I beginner, intermediate, advanced, expert?

I used to consider myself a near-expert with DEC VMS FORTRAN 77 (I'd
say VAX, but half the period was on Alpha systems too), but that was
after over 10 years using the system. After all, using the DEC I/O
extensions to patch in a double-buffered magtape handler into regular
F77 read statements has to count for something (the application had been
ported from PDP-11 Macro -- but they were dissatisfied with the long run
times; double-buffering the input tape meant the code didn't lose time
waiting for the next block of data to transfer; made a significant
speed-up).

These days, I suspect most new Fortran is F90/F95 (or later). I'd
only had a summer assignment with F90, and at the level of the
assignment, using "modules" was just a cleaner means of declaring a
"common block" include file and a set of subroutines using that "common
block".

Similar with C and C++... My major C development was to produce a
program that emulated the display of an obsolete Ramtek 9300 graphics
engine, using very low-level Xt/DECWindows for the user interface, and
(now practically forgotten) GKS to handle the plot data. The nature of
the plotting application(s) [a separate program was run to produce each
of the plot axis, color-coded data, and overlay notations -- something
like 80 programs in total] required an ability for the display to
"blank"/"redisplay" data and overlays under operator control; redisplay
could NOT require rerunning all the data manipulation code, hence GKS
for display list management. The C++ application (VC++) was controlling
a parallel port to emit three pseudo-RS422 balanced signals in response
to an externally applied clock signal (on one of the port input pins).

Both rather complex applications, but neither anything that really
lets me claim "advanced" overall skills.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top